Deepak C Shetty has uploaded a new change for review.
Change subject: Unify produceVolume
......................................................................
Unify produceVolume
Unify produceVolume function and make it use getVolumeClass
so that subclasses can override getVolumeClass to specify
their own Volume and ensure that produceVolume works
properly with subclass supplying their own volumeclass.
Change-Id: I367582b2741dc0276ec64d8d13fa1e4953f0314b
Signed-off-by: Deepak C Shetty <deepakcs(a)linux.vnet.ibm.com>
---
M vdsm/storage/blockSD.py
M vdsm/storage/fileSD.py
M vdsm/storage/sd.py
3 files changed, 7 insertions(+), 15 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/15/8115/1
diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py
index e596fb6..2da277d 100644
--- a/vdsm/storage/blockSD.py
+++ b/vdsm/storage/blockSD.py
@@ -477,14 +477,6 @@
return time.time() - t
- def produceVolume(self, imgUUID, volUUID):
- """
- Produce a type specific volume object
- """
- repoPath = self._getRepoPath()
- return blockVolume.BlockVolume(repoPath, self.sdUUID, imgUUID, volUUID)
-
-
def getVolumeClass(self):
"""
Return a type specific volume generator object
diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py
index 054fadb..ae06c90 100644
--- a/vdsm/storage/fileSD.py
+++ b/vdsm/storage/fileSD.py
@@ -215,13 +215,6 @@
filesDict[fileName] = stats
return filesDict
- def produceVolume(self, imgUUID, volUUID):
- """
- Produce a type specific volume object
- """
- repoPath = self._getRepoPath()
- return fileVolume.FileVolume(repoPath, self.sdUUID, imgUUID, volUUID)
-
def getVolumeClass(self):
"""
Return a type specific volume generator object
diff --git a/vdsm/storage/sd.py b/vdsm/storage/sd.py
index 55c5b12..4e7485f 100644
--- a/vdsm/storage/sd.py
+++ b/vdsm/storage/sd.py
@@ -358,6 +358,13 @@
self.log.warn("Resource namespace %s already registered",
volumeResourcesNamespace)
+ def produceVolume(self, imgUUID, volUUID):
+ """
+ Produce a type specific volume object
+ """
+ repoPath = self._getRepoPath()
+ return self.getVolumeClass()(repoPath, self.sdUUID, imgUUID, volUUID)
+
def getVolumeClass(self):
"""
Return a type specific volume generator object
--
To view, visit http://gerrit.ovirt.org/8115
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I367582b2741dc0276ec64d8d13fa1e4953f0314b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Deepak C Shetty <deepakcs(a)linux.vnet.ibm.com>
Deepak C Shetty has uploaded a new change for review.
Change subject: Introduce getMountPoint for NfsStorageDomain
......................................................................
Introduce getMountPoint for NfsStorageDomain
Move the code to generate the mount point into a seperate
function, so that classes reusing NfsStorageDomain can
override the function to present their own mount point path.
Change-Id: I80f98eddcc31c1f01f42af838ecc483abb955f41
Signed-off-by: Deepak C Shetty <deepakcs(a)linux.vnet.ibm.com>
---
M vdsm/storage/nfsSD.py
1 file changed, 6 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/85/8085/1
diff --git a/vdsm/storage/nfsSD.py b/vdsm/storage/nfsSD.py
index d84fee6..6b53208 100644
--- a/vdsm/storage/nfsSD.py
+++ b/vdsm/storage/nfsSD.py
@@ -71,8 +71,7 @@
# Create local path
mntPath = fileUtils.transformPath(remotePath)
- mntPoint = os.path.join(cls.storage_repository,
- sd.DOMAIN_MNT_POINT, mntPath)
+ mntPoint = cls.getMountPoint(mntPath)
cls._preCreateValidation(sdUUID, mntPoint, remotePath, version)
@@ -94,6 +93,11 @@
return fsd
+ @classmethod
+ def getMountPoint(cls, mountPath):
+ return os.path.join(cls.storage_repository,
+ sd.DOMAIN_MNT_POINT, mountPath)
+
def selftest(self):
"""
Run internal self test
--
To view, visit http://gerrit.ovirt.org/8085
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I80f98eddcc31c1f01f42af838ecc483abb955f41
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Deepak C Shetty <deepakcs(a)linux.vnet.ibm.com>
Adam Litke has uploaded a new change for review.
Change subject: libvirtvm: Cast text to string when creating text node
......................................................................
libvirtvm: Cast text to string when creating text node
When creating a text node for a libvirt domain xml file, the content of the node
is expected to be a string. To avoid errors in the xml file, cast the parameter
to a string representation when creating the child node.
Change-Id: Id22db83062eaf85645c2d61c83f3f20943918413
Signed-off-by: Adam Litke <agl(a)us.ibm.com>
---
M vdsm/libvirtvm.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/32/7832/1
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index 3306cc2..eaf899d 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -542,7 +542,7 @@
def appendChildWithText(self, childName, text):
childNode = self.doc.createElement(childName)
- textNode = self.doc.createTextNode(text)
+ textNode = self.doc.createTextNode(str(text))
childNode.appendChild(textNode)
self.dom.appendChild(childNode)
--
To view, visit http://gerrit.ovirt.org/7832
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id22db83062eaf85645c2d61c83f3f20943918413
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <agl(a)us.ibm.com>
Saggi Mizrahi has uploaded a new change for review.
Change subject: Add callback to the plethora of retry halting possibilities
......................................................................
Add callback to the plethora of retry halting possibilities
Change-Id: Idb5a2158f008b41133352dcfb4926ad21dcceea1
Signed-off-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
M tests/miscTests.py
M vdsm/storage/misc.py
2 files changed, 35 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/93/8093/1
diff --git a/tests/miscTests.py b/tests/miscTests.py
index bec6539..c8bcf09 100644
--- a/tests/miscTests.py
+++ b/tests/miscTests.py
@@ -621,6 +621,35 @@
self.assertEquals(misc._alignData(1, 1), (1, 1, 1))
+class RetryTests(TestCaseBase):
+ def testStopCallback(self):
+ counter = [0]
+ limit = 4
+ def stopCallback():
+ counter[0] += 1
+ if counter[0] == limit:
+ return True
+
+ return False
+
+ def foo():
+ print counter[0]
+ if counter[0] == (limit - 1):
+ return
+
+ raise RuntimeError("If at first you don't succeed, try, try again."
+ "Then quit. There's no point in being a damn"
+ "fool about it.")
+ # W. C. Fields
+
+ self.assertRaises(RuntimeError, misc.retry, foo, tries=(limit - 1), sleep=0,
+ stopCallback=stopCallback)
+
+ counter[0] = 0
+ misc.retry(foo, RuntimeError, tries=limit, sleep=0,
+ stopCallback=stopCallback)
+
+
class ValidateDDBytes(TestCaseBase):
def testValidInputTrue(self):
"""
diff --git a/vdsm/storage/misc.py b/vdsm/storage/misc.py
index 161726b..ef0c74e 100644
--- a/vdsm/storage/misc.py
+++ b/vdsm/storage/misc.py
@@ -728,7 +728,7 @@
def retry(func, expectedException=Exception, tries=None,
- timeout=None, sleep=1):
+ timeout=None, sleep=1, stopCallback=None):
"""
Retry a function. Wraps the retry logic so you don't have to
implement it each time you need it.
@@ -741,6 +741,8 @@
the method. It will just not run it if it ended after the
timeout.
:param sleep: Time to sleep between calls in seconds.
+ :param stopCallback: A function that takes no parameters and invokes a
+ bail-out when it returns with a positive value.
"""
if tries in [0, None]:
tries = -1
@@ -761,6 +763,9 @@
if (timeout > 0) and ((time.time() - startTime) > timeout):
raise
+ if stopCallback is not None and stopCallback():
+ raise
+
time.sleep(sleep)
--
To view, visit http://gerrit.ovirt.org/8093
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idb5a2158f008b41133352dcfb4926ad21dcceea1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi(a)redhat.com>
Ryan Harper has uploaded a new change for review.
Change subject: pylint:vdsm/*.py cast output to str() for .strip()/splitlines()
......................................................................
pylint:vdsm/*.py cast output to str() for .strip()/splitlines()
************* Module caps
E:187,35:osversion: Instance of 'list' has no 'splitlines' member (but some types could not be inferred
************* Module configNetwork
E: 68,7:ifdown: Instance of 'list' has no 'strip' member (but some types could not be inferred)
E: 70,7:ifdown: Instance of 'list' has no 'strip' member (but some types could not be inferred)
E: 71,49:ifdown: Instance of 'list' has no 'splitlines' member (but some types could not be inferred)
E: 80,7:ifup: Instance of 'list' has no 'strip' member (but some types could not be inferred)
E: 82,7:ifup: Instance of 'list' has no 'strip' member (but some types could not be inferred)
************* Module netinfo
E: 45,23:nics: Instance of '_Chainmap' has no 'split' member (but some types could not be inferred)
E:137,22:ifconfig: Instance of 'list' has no 'split' member (but some types could not be inferred)
************* Module utils
E:681,42:getHostUUID: Instance of 'list' has no 'splitlines' member (but some types could not be inferred)
wrapper command and config output with str() to help pylint.
Change-Id: Iae2c0ece02d5e41e0080bf41c0d9ea3544965274
Signed-off-by: Ryan Harper <ryanh(a)us.ibm.com>
---
M vdsm/caps.py
M vdsm/configNetwork.py
M vdsm/netinfo.py
M vdsm/utils.py
4 files changed, 9 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/44/3444/1
--
To view, visit http://gerrit.ovirt.org/3444
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iae2c0ece02d5e41e0080bf41c0d9ea3544965274
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ryan Harper <ryanh(a)us.ibm.com>