New patch submitted by Eduardo Warszawski (ewarszaw(a)redhat.com)
You can review this change at:
http://gerrit.usersys.redhat.com/640
commit 33f2b8cc81c462ce183ff42c5ca2fa29db16ba2a
Author: Eduardo Warszawski <ewarszaw(a)redhat.com>
Date: Thu Jun 30 16:07:58 2011 +0300
BZ#717658 - Change format signature.
Change-Id: Iea1e5735563087195181c625e57b8ba8e75d3441
diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py
index 3a1975f..df37019 100644
--- a/vdsm/storage/blockSD.py
+++ b/vdsm/storage/blockSD.py
@@ -697,12 +697,17 @@ class BlockStorageDomain(sd.StorageDomain):
fileUtils.cleanupdir(os.path.join("/dev", self.sdUUID))
@classmethod
- def format(cls, sdUUID, domaindir):
+ def format(cls, sdUUID):
"""Format detached storage domain.
This removes all data from the storage domain.
"""
# Remove the directory tree
- fileUtils.cleanupdir(domaindir, ignoreErrors = True)
+ try:
+ domaindir = cls.findDomainPath(sdUUID)
+ except (se.StorageDomainDoesNotExist):
+ pass
+ else:
+ fileUtils.cleanupdir(domaindir, ignoreErrors = True)
# Remove special metadata and service volumes
# Remove all volumes LV if exists
_removeVMSfs(lvm.lvPath(sdUUID, MASTERLV))
diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py
index 35f7ab3..8015926 100644
--- a/vdsm/storage/fileSD.py
+++ b/vdsm/storage/fileSD.py
@@ -212,13 +212,18 @@ class FileStorageDomain(sd.StorageDomain):
return imgList
@classmethod
- def format(cls, sdUUID, domaindir):
+ def format(cls, sdUUID):
"""
Format detached storage domain.
This removes all data from the storage domain.
"""
cls.log.info("Formating domain %s", sdUUID)
- oop.getProcessPool(sdUUID).fileUtils.cleanupdir(domaindir, ignoreErrors = False)
+ try:
+ domaindir = cls.findDomainPath(sdUUID)
+ except (se.StorageDomainDoesNotExist):
+ pass
+ else:
+ oop.getProcessPool(sdUUID).fileUtils.cleanupdir(domaindir, ignoreErrors =
False)
return True
def getRemotePath(self):
diff --git a/vdsm/storage/sd.py b/vdsm/storage/sd.py
index fd915a0..562982c 100644
--- a/vdsm/storage/sd.py
+++ b/vdsm/storage/sd.py
@@ -535,13 +535,6 @@ class StorageDomain:
self.mountMaster()
self.createMasterTree()
- def format(self):
- """
- Format detached storage domain.
- This removes all data from the storage domain.
- """
- pass
-
def getAllImages(self):
"""
Fetch the list of the Image UUIDs
diff --git a/vdsm/storage/sdf.py b/vdsm/storage/sdf.py
index 2e2126d..f13c933 100644
--- a/vdsm/storage/sdf.py
+++ b/vdsm/storage/sdf.py
@@ -91,14 +91,7 @@ class StorageDomainFactory:
cls.log.warn("Storage domain %s doesn't exist. Trying recycle
leftovers ...", sdUUID)
for domClass in (blockSD.BlockStorageDomain, nfsSD.NfsStorageDomain,
localFsSD.LocalFsStorageDomain):
- try:
- domaindir = domClass.findDomainPath(sdUUID)
- except (se.StorageDomainDoesNotExist):
- pass
- except Exception:
- cls.log.error("Can't find out domain %s", sdUUID,
exc_info=True)
- else:
- return domClass.format(sdUUID, domaindir)
+ return domClass.format(sdUUID)
raise se.StorageDomainTypeError(sdUUID)