Change in vdsm[ovirt-3.3]: vm: discover volume path from xml definition

Federico Simoncelli fsimonce at redhat.com
Tue Feb 11 14:24:05 UTC 2014


Hello Dan Kenigsberg,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/24329

to review the following change.

Change subject: vm: discover volume path from xml definition
......................................................................

vm: discover volume path from xml definition

In a previous commit (c072945 One shot prepare) we involuntarily
changed the path used for virtual machine images from:

 /rhev/data-center/<spUUID>/<sdUUID>/images/<imgUUID>/<volUUID>

to:

 /rhev/data-center/mnt/blockSD/<sdUUID>/images/<imgUUID>/<volUUID>

This generated an issue during live migration between different
vdsm versions:

 libvirtError: invalid argument: invalid path ... not assigned to
 domain

In this patch we inspect libvirt xml during live migration and vdsm
restart to identify if it is necessary to update the path cached in
the drive object (provided by prepareImage).

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1061621
Change-Id: I322f1f879fbd5b6415789f3b307e8741d846d694
Signed-off-by: Federico Simoncelli <fsimonce at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/24202
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
Signed-off-by: Federico Simoncelli <fsimonce at redhat.com>
---
M vdsm/vm.py
1 file changed, 18 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/29/24329/1

diff --git a/vdsm/vm.py b/vdsm/vm.py
index bb35f0e..fd295eb 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -4743,6 +4743,16 @@
             address = self._getUnderlyingDeviceAddress(x)
 
             for d in self._devices[DISK_DEVICES]:
+                # When we analyze a disk device that was already discovered in
+                # the past (generally as soon as the VM is created) we should
+                # verify that the cached path is the one used in libvirt.
+                # We already hit few times the problem that after a live
+                # migration the paths were not in sync anymore (BZ#1059482).
+                if (hasattr(d, 'alias') and d.alias == alias
+                        and d.path != devPath):
+                    self.log.warning('updating drive %s path from %s to %s',
+                                     d.alias, d.path, devPath)
+                    d.path = devPath
                 if d.path == devPath:
                     d.name = name
                     d.type = devType
@@ -4755,6 +4765,14 @@
             # Update vm's conf with address for known disk devices
             knownDev = False
             for dev in self.conf['devices']:
+                # See comment in previous loop. This part is used to update
+                # the vm configuration as well.
+                if ('alias' in dev and dev['alias'] == alias
+                        and dev['path'] != devPath):
+                    self.log.warning('updating drive %s config path from %s '
+                                     'to %s', dev['alias'], dev['path'],
+                                     devPath)
+                    dev['path'] = devPath
                 if dev['type'] == DISK_DEVICES and dev['path'] == devPath:
                     dev['name'] = name
                     dev['address'] = address


-- 
To view, visit http://gerrit.ovirt.org/24329
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I322f1f879fbd5b6415789f3b307e8741d846d694
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.3
Gerrit-Owner: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>


More information about the vdsm-patches mailing list