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 <[email protected]>
Reviewed-on: https://gerrit.ovirt.org/45472
Reviewed-by: Idan Shaby <[email protected]>
Reviewed-by: Allon Mureinik <[email protected]>
Reviewed-by: Maor Lipchuk <[email protected]>
Reviewed-by: Freddy Rolland <[email protected]>
Reviewed-by: Tal Nisan <[email protected]>
Reviewed-by: Adam Litke <[email protected]>
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 <[email protected]>
Gerrit-Reviewer: Adam Litke <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Freddy Rolland <[email protected]>
Gerrit-Reviewer: Maor Lipchuk <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to