Change in vdsm[master]: volume: support multi line metadata values

laravot at redhat.com laravot at redhat.com
Mon Jun 9 11:24:34 UTC 2014


Liron Ar has uploaded a new change for review.

Change subject: volume: support multi line metadata values
......................................................................

volume: support multi line metadata values

Currently when creating the metadata dict it's assumed that each value
can be in a single line only while it's not necessarily true.

Change-Id: Ib03152b852294f7b69a8734c2aa1206ea2c1fabe
Signed-off-by: Liron Aravot <laravot at redhat.com>
---
M vdsm/storage/blockVolume.py
M vdsm/storage/volume.py
2 files changed, 12 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/93/28493/1

diff --git a/vdsm/storage/blockVolume.py b/vdsm/storage/blockVolume.py
index d448e00..d7cf020 100644
--- a/vdsm/storage/blockVolume.py
+++ b/vdsm/storage/blockVolume.py
@@ -580,7 +580,6 @@
             self.log.error(e, exc_info=True)
             raise se.VolumeMetadataReadError("%s: %s" % (metaId, e))
 
-
     def setMetadata(self, meta, metaId=None):
         """
         Set the meta data hash as the new meta data of the Volume
diff --git a/vdsm/storage/volume.py b/vdsm/storage/volume.py
index aed932e..bfc1ff1 100644
--- a/vdsm/storage/volume.py
+++ b/vdsm/storage/volume.py
@@ -814,19 +814,27 @@
         """
         pass
 
-
     def metadata2dict(self, meta):
         out = {}
+        key = None
+        value = None
+
+        def put(key, value):
+            out[key.strip()] = "\n".join(value).strip()
+
         for l in meta:
             if l.startswith("EOF"):
-                return out
+                break
             if l.find("=") < 0:
+                value.append(l)
                 continue
+            if key:
+                put(key, value)
             key, value = l.split("=")
-            out[key.strip()] = value.strip()
+            value = [value]
 
+        put(key, value)
         return out
-
 
     def metadata2info(self, meta):
         return {


-- 
To view, visit http://gerrit.ovirt.org/28493
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib03152b852294f7b69a8734c2aa1206ea2c1fabe
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Liron Ar <laravot at redhat.com>


More information about the vdsm-patches mailing list