Change in vdsm[ovirt-3.6]: blockVolume: Fail if metadata overflows

nsoffer at redhat.com nsoffer at redhat.com
Thu Sep 17 17:23:24 UTC 2015


Hello Adam Litke, Allon Mureinik, Freddy Rolland, Maor Lipchuk,

I'd like you to do a code review.  Please visit

    https://gerrit.ovirt.org/46329

to review the following change.

Change subject: blockVolume: Fail if metadata overflows
......................................................................

blockVolume: Fail if metadata overflows

We used to truncate silently volume metadata if it was too long, storing
invalid metadata that would cause various failures later.

The metadata can overflow if volume description, or since ovirt 3.5,
volume alias is too long. Both alias and description are stored now in
json format in the DESCRIPTION field.

Now we raise MetadataOverflowError, the same error raised when storage
domain metadata overflow. This will fail the volume creation.

Change-Id: I9ac286c68307e4a1925b9430a0b3b9909cdd682a
Backport-To: 3.6
Bug-Url: https://bugzilla.redhat.com/1258097
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
Reviewed-on: https://gerrit.ovirt.org/45472
Reviewed-by: Idan Shaby <ishaby at redhat.com>
Reviewed-by: Allon Mureinik <amureini at redhat.com>
Reviewed-by: Maor Lipchuk <mlipchuk at redhat.com>
Reviewed-by: Freddy Rolland <frolland at redhat.com>
Reviewed-by: Tal Nisan <tnisan at redhat.com>
Reviewed-by: Adam Litke <alitke at redhat.com>
Continuous-Integration: Jenkins CI
---
M vdsm/storage/blockVolume.py
1 file changed, 3 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/29/46329/1

diff --git a/vdsm/storage/blockVolume.py b/vdsm/storage/blockVolume.py
index ac29f40..55ac3c3 100644
--- a/vdsm/storage/blockVolume.py
+++ b/vdsm/storage/blockVolume.py
@@ -545,10 +545,9 @@
         with fileUtils.DirectFile(metavol, "r+d") as f:
             data = "".join(lines)
             if len(data) > VOLUME_METASIZE:
-                cls.log.warn("Truncating volume metadata (%s)", data)
-                data = data[:VOLUME_METASIZE]
-            else:
-                data += "\0" * (VOLUME_METASIZE - len(data))
+                raise se.MetadataOverflowError(data)
+
+            data += "\0" * (VOLUME_METASIZE - len(data))
 
             f.seek(offs * VOLUME_METASIZE)
             f.write(data)


-- 
To view, visit https://gerrit.ovirt.org/46329
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9ac286c68307e4a1925b9430a0b3b9909cdd682a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Freddy Rolland <frolland at redhat.com>
Gerrit-Reviewer: Maor Lipchuk <mlipchuk at redhat.com>


More information about the vdsm-patches mailing list