Change in vdsm[master]: virt: recovery: add constant for file extension
fromani at redhat.com
fromani at redhat.com
Wed Feb 3 13:59:43 UTC 2016
Francesco Romani has uploaded a new change for review.
Change subject: virt: recovery: add constant for file extension
......................................................................
virt: recovery: add constant for file extension
Consolidate the ".recovery" extension string on
one single place instead of scatter it all around
the module.
Change-Id: I4bf4209eeabe20e4b9241093c4f2a3ff47f403c7
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/virt/recovery.py
1 file changed, 5 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/54/53054/1
diff --git a/vdsm/virt/recovery.py b/vdsm/virt/recovery.py
index e41309a..f5d4400 100644
--- a/vdsm/virt/recovery.py
+++ b/vdsm/virt/recovery.py
@@ -67,11 +67,13 @@
"pickle" for vm state.
"""
+ EXTENSION = ".recovery"
+
_log = logging.getLogger("virt.recovery.file")
def __init__(self, vmid):
self._vmid = vmid
- self._name = '%s.recovery' % vmid
+ self._name = '%s%s' % (vmid, self.EXTENSION)
self._path = os.path.join(constants.P_VDSM_RUN, self._name)
self._lock = threading.Lock()
@@ -206,7 +208,7 @@
vms = []
for f in os.listdir(constants.P_VDSM_RUN):
vm_id, fileType = os.path.splitext(f)
- if fileType == ".recovery":
+ if fileType == File.EXTENSION:
if vm_id not in cif.vmContainer:
vms.append(vm_id)
return vms
@@ -220,6 +222,6 @@
# If file is missing type extention - ignore it
pass
else:
- if fileType == ".recovery" and vmId not in cif.vmContainer:
+ if fileType == File.EXTENSION and vmId not in cif.vmContainer:
cif.log.debug("cleaning old file " + f)
utils.rmFile(os.path.join(constants.P_VDSM_RUN, f))
--
To view, visit https://gerrit.ovirt.org/53054
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4bf4209eeabe20e4b9241093c4f2a3ff47f403c7
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