Change in vdsm[master]: janitorial: move isVdsmImage into utils
fromani at redhat.com
fromani at redhat.com
Mon Jun 9 07:55:51 UTC 2014
Francesco Romani has uploaded a new change for review.
Change subject: janitorial: move isVdsmImage into utils
......................................................................
janitorial: move isVdsmImage into utils
this patch moves vdsm/virt/vm.isVdsmImage into utils without code
changes.
The move has little oif any benefit on its own, but it is a preliminary
step to the move of VmSamplingThread from vm.py to sampling.py.
Change-Id: I9cb288eef41b567da36849e00f848e1ba20a62af
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M lib/vdsm/utils.py
M vdsm/clientIF.py
M vdsm/virt/vm.py
3 files changed, 15 insertions(+), 14 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/77/28477/1
diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index 4e60acf..95ce617 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -104,6 +104,18 @@
return stat.S_ISBLK(os.stat(path).st_mode)
+def isVdsmImage(drive):
+ """
+ Tell if drive looks like a vdsm image
+
+ :param drive: drive to check
+ :type drive: dict or vm.Drive
+ :return: bool
+ """
+ required = ('domainID', 'imageID', 'poolID', 'volumeID')
+ return all(k in drive for k in required)
+
+
def touchFile(filePath):
"""
http://www.unix.com/man-page/POSIX/1posix/touch/
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index ea950b6..8811fa5 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -249,7 +249,7 @@
if type(drive) is dict:
device = drive['device']
# PDIV drive format
- if device == 'disk' and vm.isVdsmImage(drive):
+ if device == 'disk' and utils.isVdsmImage(drive):
res = self.irs.prepareImage(
drive['domainID'], drive['poolID'],
drive['imageID'], drive['volumeID'])
@@ -336,7 +336,7 @@
def teardownVolumePath(self, drive):
res = {'status': doneCode}
try:
- if vm.isVdsmImage(drive):
+ if utils.isVdsmImage(drive):
res = self.irs.teardownImage(drive['domainID'],
drive['poolID'], drive['imageID'])
except TypeError:
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 7bb1f94..fabd0db 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -45,6 +45,7 @@
from vdsm.config import config
from vdsm.define import ERROR, NORMAL, doneCode, errCode
from vdsm.netinfo import DUMMY_BRIDGE
+from vdsm.utils import isVdsmImage
from storage import outOfProcess as oop
from storage import sd
from storage import fileUtils
@@ -87,18 +88,6 @@
CONSOLE_DEVICES = 'console'
SMARTCARD_DEVICES = 'smartcard'
TPM_DEVICES = 'tpm'
-
-
-def isVdsmImage(drive):
- """
- Tell if drive looks like a vdsm image
-
- :param drive: drive to check
- :type drive: dict or vm.Drive
- :return: bool
- """
- required = ('domainID', 'imageID', 'poolID', 'volumeID')
- return all(k in drive for k in required)
def _filterSnappableDiskDevices(diskDeviceXmlElements):
--
To view, visit http://gerrit.ovirt.org/28477
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9cb288eef41b567da36849e00f848e1ba20a62af
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
More information about the vdsm-patches
mailing list