Change in vdsm[master]: VolumeMetadata: Add from_lines factory method
alitke at redhat.com
alitke at redhat.com
Wed Apr 20 20:10:03 UTC 2016
Adam Litke has posted comments on this change.
Change subject: VolumeMetadata: Add from_lines factory method
......................................................................
Patch Set 3:
(6 comments)
https://gerrit.ovirt.org/#/c/52672/3/tests/storage_volume_metadata_test.py
File tests/storage_volume_metadata_test.py:
Line 105: self.assertRaises(TypeError, volume.VolumeMetadata.from_lines, [])
Line 106:
Line 107: def test_from_lines_invalid_param(self):
Line 108: self.assertRaises(se.VolumeMetadataReadError,
Line 109: volume.VolumeMetadata.from_lines, ["FOO=bar"])
> this doesn't raise anymore.
Done
Line 110:
Line 111: def test_from_lines_invalid_format(self):
Line 112: lines = ["DOMAIN=domain", "IMAGE=image", "PUUID=parent", "SIZE=FOO",
Line 113: "FORMAT=format", "TYPE=type", "VOLTYPE=voltype",
https://gerrit.ovirt.org/#/c/52672/3/vdsm/storage/volume.py
File vdsm/storage/volume.py:
Line 176: IMAGE: 'img_id',
Line 177: PUUID: 'parent_vol_id',
Line 178: SIZE: 'size',
Line 179: FORMAT: 'vol_format',
Line 180: TYPE: 'prealloc',
> change to alloc_policy.
Done
Line 181: VOLTYPE: 'vol_type',
Line 182: DISKTYPE: 'disk_type',
Line 183: DESCRIPTION: 'description',
Line 184: LEGALITY: 'legality',
Line 177: PUUID: 'parent_vol_id',
Line 178: SIZE: 'size',
Line 179: FORMAT: 'vol_format',
Line 180: TYPE: 'prealloc',
Line 181: VOLTYPE: 'vol_type',
change to parental_status... done.
Line 182: DISKTYPE: 'disk_type',
Line 183: DESCRIPTION: 'description',
Line 184: LEGALITY: 'legality',
Line 185: CTIME: 'ctime',
Line 184: LEGALITY: 'legality',
Line 185: CTIME: 'ctime',
Line 186: MTIME: 'mtime',
Line 187: }
Line 188: INT_KEYS = [SIZE, CTIME, MTIME]
> merge this back into above struct.
Done
Line 189:
Line 190: log = logging.getLogger('Storage.VolumeMetadata')
Line 191:
Line 192: def __init__(self, sd_id, img_id, parent_vol_id, size, vol_format,
Line 219: continue
Line 220: try:
Line 221: param = cls.MD_FIELDS[key]
Line 222: except KeyError:
Line 223: raise se.VolumeMetadataReadError("Invalid key: %s" % key)
> don't raise here (breaks compatibility). Just log bad line and continue.
Done
Line 224:
Line 225: kwargs[param] = int(value) if key in cls.INT_KEYS else value
Line 226: return cls(**kwargs)
Line 227:
Line 265: Return metadata in dictionary format
Line 266: """
Line 267: ret = {}
Line 268: for field, attr in self.MD_FIELDS.items():
Line 269: ret[field] = getattr(self, attr)
> Go back to old style for this function.
Done
Line 270: ret[sd.DMDK_POOLS] = "" # Deprecated
Line 271: return ret
Line 272:
Line 273:
--
To view, visit https://gerrit.ovirt.org/52672
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Id7f63dce8e42e99d3240f4e916a9bd6ee5ee4b61
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list