Change in vdsm[master]: vm: implement VM.sdIds as read-only property
Federico Simoncelli
fsimonce at redhat.com
Wed Sep 10 21:48:09 UTC 2014
Federico Simoncelli has posted comments on this change.
Change subject: vm: implement VM.sdIds as read-only property
......................................................................
Patch Set 1:
(7 comments)
http://gerrit.ovirt.org/#/c/32796/1//COMMIT_MSG
Commit Message:
Line 5: CommitDate: 2014-09-10 23:27:17 +0200
Line 6:
Line 7: vm: implement VM.sdIds as read-only property
Line 8:
Line 9: Changed the VM object sdIds list attribute. It used to be a list that kept a copy of the storage domains in use in an additional list (with all the difficulties of keeping the list in sync). That list has been replaced with a property that returns the storage domains in use getting them directly from the the vm devices in use.
Commit message should respect the 72 columns limit.
Line 10:
Line 11: Change-Id: Ie445d4689aa562b00229844007ffa05eaecebdcb
Line 12: Bug-Url: https://bugzilla.redhat.com/1094518
http://gerrit.ovirt.org/#/c/32796/1/tests/vmTests.py
File tests/vmTests.py:
Line 1308: log=self.log,
Line 1309: index=0,
Line 1310: device="hdd",
Line 1311: path="/dev/dummy",
Line 1312: type=vm.DISK_DEVICES,
I don't recall, can't you add domainID (etc) here?
Line 1313: iface="ide")
Line 1314: ]
Line 1315:
Line 1316: # Make the drive look like a VDSM volume
Line 1309: index=0,
Line 1310: device="hdd",
Line 1311: path="/dev/dummy",
Line 1312: type=vm.DISK_DEVICES,
Line 1313: iface="ide")
Maybe you could add another drive that doesn't contain domainID to check that we're not failing. (Code as it is now will crash iiuc)
Line 1314: ]
Line 1315:
Line 1316: # Make the drive look like a VDSM volume
Line 1317: required = ('domainID', 'imageID', 'poolID', 'volumeID')
Line 1315:
Line 1316: # Make the drive look like a VDSM volume
Line 1317: required = ('domainID', 'imageID', 'poolID', 'volumeID')
Line 1318: for p in required:
Line 1319: setattr(drives[0], p, "1")
Please use uuids for consistency.
Line 1320:
Line 1321: with FakeVM() as machine:
Line 1322: dom = FakeDomain()
Line 1323: machine._dom = dom
Line 1321: with FakeVM() as machine:
Line 1322: dom = FakeDomain()
Line 1323: machine._dom = dom
Line 1324: ids = []
Line 1325: for drive in drives:
I prefer that the expected output is explicitly written instead of re-generated with the same algorithm used in the code.
Line 1326: ids.append(drive.domainId)
Line 1327: machine._devices[drive.type].append(drive)
Line 1328:
Line 1329: self.assertEqual(machine.sdId, ids)
http://gerrit.ovirt.org/#/c/32796/1/vdsm/virt/vm.py
File vdsm/virt/vm.py:
Line 2867: # So, to get proper device objects during VM recovery flow
Line 2868: # we must to have updated conf before VM run
Line 2869: self.saveState()
Line 2870: else:
Line 2871: pass
I think this block can be removed entirely.
Line 2872: # Note that we do not start disk stats collection here since
Line 2873: # in the recovery flow irs may not be ready yet.
Line 2874: # Disk stats collection is started from clientIF at the end
Line 2875: # of the recovery process.
Line 5597: def sdIds(self):
Line 5598: """
Line 5599: Returns a list of the ids of the storage domains in use by the VM.
Line 5600: """
Line 5601: return [device.domainID for device in self._devices[DISK_DEVICES]]
Not all the disks are vdsm images, therefore not all of them have domainID.
Line 5602:
Line 5603:
Line 5604: class LiveMergeCleanupThread(threading.Thread):
Line 5605: def __init__(self, vm, jobId, drive, doPivot):
--
To view, visit http://gerrit.ovirt.org/32796
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ie445d4689aa562b00229844007ffa05eaecebdcb
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Fabio Pliger <fabio.pliger at gmail.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list