Change in vdsm[master]: Extract the DOM to Drive name, alias and path logic to reusa...
msivak at redhat.com
msivak at redhat.com
Mon Jun 23 11:29:38 UTC 2014
Martin Sivák has uploaded a new change for review.
Change subject: Extract the DOM to Drive name, alias and path logic to reusable method
......................................................................
Extract the DOM to Drive name, alias and path logic to reusable method
Change-Id: I7389dd8960c9c6245148d9191b2bea5a7e9e4a46
Signed-off-by: Martin Sivak <msivak at redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 14 insertions(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/59/29059/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 234b75a..3177677 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -5097,6 +5097,19 @@
dev['alias'] = alias
break
+ def _getDriveIdentification(self, dom):
+ sources = dom.getElementsByTagName('source')
+ if sources:
+ devPath = (sources[0].getAttribute('file') or
+ sources[0].getAttribute('dev') or
+ sources[0].getAttribute('name'))
+ else:
+ devPath = ''
+ target = dom.getElementsByTagName('target')
+ name = target[0].getAttribute('dev') if target else ''
+ alias = dom.getElementsByTagName('alias')[0].getAttribute('name')
+ return alias, devPath, name
+
def _getUnderlyingDriveInfo(self):
"""
Obtain block devices info from libvirt.
@@ -5107,17 +5120,7 @@
# In the future we can return this real data to management instead of
# vm's conf
for x in disksxml:
- sources = x.getElementsByTagName('source')
- if sources:
- devPath = (sources[0].getAttribute('file') or
- sources[0].getAttribute('dev') or
- sources[0].getAttribute('name'))
- else:
- devPath = ''
-
- target = x.getElementsByTagName('target')
- name = target[0].getAttribute('dev') if target else ''
- alias = x.getElementsByTagName('alias')[0].getAttribute('name')
+ alias, devPath, name = self._getDriveIdentification(x)
readonly = bool(x.getElementsByTagName('readonly'))
boot = x.getElementsByTagName('boot')
bootOrder = boot[0].getAttribute('order') if boot else ''
--
To view, visit http://gerrit.ovirt.org/29059
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7389dd8960c9c6245148d9191b2bea5a7e9e4a46
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Sivák <msivak at redhat.com>
More information about the vdsm-patches
mailing list