Bug 32098 - UVMM shows "default"-storage at instance while other storage is configured
UVMM shows "default"-storage at instance while other storage is configured
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC - Virtual machines (UVMM)
UCS 3.1
Other Linux
: P5 normal (vote)
: UCS 3.2
Assigned To: Philipp Hahn
Moritz Muehlenhoff
: interim-1
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-26 20:14 CEST by Ingo Steuwer
Modified: 2013-11-19 06:41 CET (History)
2 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments
Fix storage pool detection (2.13 KB, patch)
2013-07-27 13:00 CEST, Philipp Hahn
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ingo Steuwer univentionstaff 2013-07-26 20:14:31 CEST
seen on UCS 3.1-1 Errata 156 with a KVM node

My steps, I think not all are necessary:
- configure a second storage pool (on a different partition)
- create a new instance whith its harddisk (qcow2) in the second storage pool
- add an DVD ISO (in my case also in the second pool)
- save (I installed UCS 3.1-1 amd64)
- open, remove the DVD ISO
- save the instance
- open the instance again, the harddisk is show at the "default" storage but with a correct path to the second storage

Looking into the XML the path is correct, the instance also boots up correctly.
Comment 1 Philipp Hahn univentionstaff 2013-07-26 21:39:06 CEST
Please provide the output of
  uvmm pools "qemu://$(hostname -f)/system"
or
  umc-command -r -U Administrator -P univention uvmm/storage/pool/query -o nodeURI="qemu://$(hostname -f)/system"
or
  cat /etc/libvirt/storage/*.xml

an dump of the domain-XML:
  virsh dumpxml "$DOMAIN"
or
  cat /etc/libvirt/qemu/"$DOMAIN".xml

and finally the UMC view of that situation:
  host=$(hostname -f)
  uuid=$(virsh domuuid "$DOMAIN")
  umc-command -r -U Administrator -P univention uvmm/domain/get \
    -o domainURI="qemu://$host/system#$uuid"
Comment 2 Ingo Steuwer univentionstaff 2013-07-27 08:18:21 CEST
(In reply to Philipp Hahn from comment #1)

# uvmm pools "qemu://$(hostname -f)/system"
DATA:
[{'active': True,
  'available': 40633081856,
  'capacity': 90049912832,
  'name': 'default',
  'path': u'/var/lib/libvirt/images',
  'type': u'dir',
  'uuid': u'b3d63289-bb90-29ea-1756-ba6d621a8aa2'},
 {'active': True,
  'available': 1021838528512,
  'capacity': 1969006952448,
  'name': 'images-disk2',
  'path': u'/var/lib/libvirt/images-disk2',
  'type': u'dir',
  'uuid': u'4997329c-7a56-a77f-65b9-9a0a2f8ab40f'}]



# virsh dumpxml "$DOMAIN"
<domain type='kvm'>
  <name>debian7-horde</name>
  <uuid>3420e0c4-ec07-d594-7c59-68a62b5824d9</uuid>
  <memory unit='KiB'>1572864</memory>
  <currentMemory unit='KiB'>1572864</currentMemory>
  <vcpu placement='static'>2</vcpu>
  <os>
    <type arch='x86_64' machine='pc-1.1'>hvm</type>
    <boot dev='cdrom'/>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/bin/kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/var/lib/libvirt/images-disk2/debian7-horde_vda.qcow2'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>
    <controller type='usb' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:7e:10:8b'/>
      <source bridge='eth0'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <input type='tablet' bus='usb'/>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0' keymap='de'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='none'/>
</domain>


 umc-command -r -U Administrator -P $(cat /tmp/pwd) uvmm/domain/get -o domainURI="qemu://$host/system#$uuid"
27.07.13 08:16:25.221  DEBUG_INIT
Response: COMMAND
  data length   : 1345
  message length: 1271
  ---
  ARGUMENTS: ['uvmm/domain/get']
MIMETYPE   : application/json
  STATUS   : 200
  MESSAGE  : None
  RESULT   : { 'annotations': { },
  'arch': 'x86_64',
  'available': True,
  'boot': ['cdrom', 'hd'],
  'bootloader': None,
  'bootloader_args': None,
  'cmdline': None,
  'cputime': [0.0, 9.8813129168249309e-324, 3.6854058576541609e-74],
  'curMem': 0,
  'disks': [ { 'device': 'disk',
               'driver': 'qemu',
               'driver_cache': 'none',
               'driver_type': 'qcow2',
               'paravirtual': True,
               'pool': 'default',
               'readonly': False,
               'size': '80.0 GB',
               'source': '/var/lib/libvirt/images-disk2/debian7-horde_vda.qcow2',
               'target_bus': 'virtio',
               'target_dev': 'vda',
               'type': 'file',
               'volumeFilename': 'debian7-horde_vda.qcow2',
               'volumeType': 'file'}],
  'domain_type': 'kvm',
  'graphics': [ { 'autoport': True,
                  'keymap': 'de',
                  'listen': '0.0.0.0',
                  'passwd': None,
                  'port': -1,
                  'type': 'vnc'}],
  'initrd': None,
  'interfaces': [ { 'mac_address': '52:54:00:7e:10:8b',
                    'model': 'virtio',
                    'script': None,
                    'source': 'eth0',
                    'target': None,
                    'type': 'bridge'}],
  'kblayout': 'de',
  'kernel': None,
  'maxMem': '1.5 GB',
  'name': 'debian7-horde',
  'os_type': 'hvm',
  'rtc_offset': 'utc',
  'snapshots': { },
  'state': 'SHUTOFF',
  'suspended': 0,
  'type': 'kvm-hvm',
  'uuid': '3420e0c4-ec07-d594-7c59-68a62b5824d9',
  'vcpus': 2,
  'vnc': True,
  'vnc_host': None,
  'vnc_password': None,
  'vnc_port': None,
  'vnc_remote': True}
Comment 3 Philipp Hahn univentionstaff 2013-07-27 11:22:48 CEST
(In reply to Ingo Steuwer from comment #2)
...
>   'path': u'/var/lib/libvirt/images',
...
>   'path': u'/var/lib/libvirt/images-disk2',

Here's the problem: The default pool is a prefix of the second pool.

...
>                'pool': 'default',
...
>                'source':
> '/var/lib/libvirt/images-disk2/debian7-horde_vda.qcow2',

So the prefix-check wrongly puts the volume in the default pool.
Comment 4 Philipp Hahn univentionstaff 2013-07-27 13:00:51 CEST
Created attachment 5339 [details]
Fix storage pool detection

The patch fixes the imminent problem by fixing the path-prefix check to honor directory boundaries.

But there is a deeper problem: currently the pool-name and in-pool-filename are transmitted, when a volume is deleted. This can lead to the wrong file being deleted.
Comment 5 Philipp Hahn univentionstaff 2013-07-27 18:35:18 CEST
svn42857: storage volume naming
svn42856: storage capacity hint
svn42855: delete storage volumes by path
svn42854: remove unused storage_volume_usedby
svn42853: skip devices on domain delete
svn42852: storage pool detection
svn42851: Fix storage pool detection
svn42850: check JavaScript code using JSHint

univention-virtual-machine-manager-daemon_3.0.6-6.463.201307271829

svn42858: The storage pool handling has been overhauled and now better supports different storage pools. Especially a bug has been fixed, which could result in deleting the wrong storage volume when multiple storage pools were used
Comment 6 Philipp Hahn univentionstaff 2013-07-29 09:57:12 CEST
More fixed and clean after testing, since inactive pools were still shown as accessible, which results in errors when their volumes are listed or new volumes are created.
svn42869: remove dead storage code
svn42870: move pool type definition
svn42871: code cleanup
svn42872: ignore inactive pools
Comment 7 Moritz Muehlenhoff univentionstaff 2013-08-20 09:52:57 CEST
With UVMM from UCS 3.2 I could no longer reproduce the bug described. I created a machine is outlined by Ingo and after removal of the DVD the hard disk still remained on the correct storage pool. Changelog exists.
Comment 8 Stefan Gohmann univentionstaff 2013-11-19 06:41:55 CET
UCS 3.2 has been released:
 http://docs.univention.de/release-notes-3.2-en.html
 http://docs.univention.de/release-notes-3.2-de.html

If this error occurs again, please use "Clone This Bug".