Change in vdsm[master]: fileVolume: refactor _putMetadata to support volume artifacts
alitke at redhat.com
alitke at redhat.com
Wed Dec 2 02:51:11 UTC 2015
Adam Litke has uploaded a new change for review.
Change subject: fileVolume: refactor _putMetadata to support volume artifacts
......................................................................
fileVolume: refactor _putMetadata to support volume artifacts
When writing normal FileVolume metadata we use the standard metadata
path. When creating a FileVolumeArtifact we need to write the metadata
to a different location. Refactor _putMetadata and create a new method
_putArtifactMetadata for writing in the special location.
Change-Id: I5253b6692b8c58967bbd2c421abcce05c584d769
Signed-off-by: Adam Litke <alitke at redhat.com>
---
M vdsm/storage/fileVolume.py
1 file changed, 15 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/45/49545/1
diff --git a/vdsm/storage/fileVolume.py b/vdsm/storage/fileVolume.py
index bcc7a3a..70bb7a6 100644
--- a/vdsm/storage/fileVolume.py
+++ b/vdsm/storage/fileVolume.py
@@ -237,18 +237,26 @@
self.file_setrw(self.getVolumePath(), rw=rw)
@classmethod
- def _putMetadata(cls, metaId, meta):
- volPath, = metaId
- metaPath = cls._metaVolumePath(volPath)
-
+ def __writeMetadata(cls, metaPath, meta):
data = cls.formatMetadata(meta)
-
with open(metaPath + ".new", "w") as f:
f.write(data)
-
- sdUUID = getDomUuidFromVolumePath(volPath)
+
+ sdUUID = getDomUuidFromVolumePath(metaPath)
oop.getProcessPool(sdUUID).os.rename(metaPath + ".new", metaPath)
+ @classmethod
+ def _putMetadata(cls, metaId, meta):
+ volPath, = metaId
+ path = cls._metaVolumePath(volPath)
+ cls.__writeMetadata(path, meta)
+
+ @classmethod
+ def putArtifactMetadata(cls, metaId, meta):
+ volPath, = metaId
+ path = cls._metaVolumePath(volPath) + ARTIFACT_FILEEXT
+ cls.__writeMetadata(path, meta)
+
def setImage(self, imgUUID):
"""
Set image UUID
--
To view, visit https://gerrit.ovirt.org/49545
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5253b6692b8c58967bbd2c421abcce05c584d769
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke at redhat.com>
More information about the vdsm-patches
mailing list