Adam Litke has uploaded a new change for review.
Change subject: storage: Add garbage indicator to BlockSDVol namedtuple ......................................................................
storage: Add garbage indicator to BlockSDVol namedtuple
Change-Id: I3e71b3d0ff7c76b815f84d895cd0cbddff251791 Signed-off-by: Adam Litke alitke@redhat.com --- M vdsm/storage/blockSD.py 1 file changed, 27 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/68/44568/1
diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py index 8d571a6..77e162b 100644 --- a/vdsm/storage/blockSD.py +++ b/vdsm/storage/blockSD.py @@ -60,7 +60,7 @@ SPECIAL_LVS = (sd.METADATA, sd.LEASES, sd.IDS, sd.INBOX, sd.OUTBOX, MASTERLV)
MASTERLV_SIZE = "1024" # In MiB = 2 ** 20 = 1024 ** 2 => 1GiB -BlockSDVol = namedtuple("BlockSDVol", "name, image, parent") +BlockSDVol = namedtuple("BlockSDVol", "name, image, parent, garbage_meta_id")
log = logging.getLogger("Storage.BlockSD")
@@ -144,6 +144,24 @@ return f.tell()
+def _get_garbage_vol_meta_id(sdUUID, volUUID, tags): + """ + If the LV contains TAG_VOL_GARBAGE then treat this volume as garbage. In + order to garbage collect the LV metadata associated with this volume we + need the metadata ID. We cannot call getMetadataId when the LV contains + TAG_VOL_UNINIT so we handle this case specially. + """ + if blockVolume.TAG_VOL_GARBAGE not in tags: + return None + for tag in tags: + if tag.startswith(blockVolume.TAG_PREFIX_MD): + meta_offset = tag[len(blockVolume.TAG_PREFIX_MD):] + return sdUUID, meta_offset + log.error("missing offset tag on volume %s/%s", sdUUID, volUUID) + raise se.VolumeMetadataReadError("missing offset tag on volume %s/%s" % + (sdUUID, volUUID)) + + def _getVolsTree(sdUUID): lvs = lvm.getLV(sdUUID) vols = {} @@ -156,7 +174,8 @@ elif tag.startswith(blockVolume.TAG_PREFIX_PARENT): parent = tag[len(blockVolume.TAG_PREFIX_PARENT):] if parent and image: - vols[lv.name] = BlockSDVol(lv.name, image, parent) + gc_meta_id = _get_garbage_vol_meta_id(sdUUID, lv.name, lv.tags) + vols[lv.name] = BlockSDVol(lv.name, image, parent, gc_meta_id) break else: if lv.name not in SPECIAL_LVS: @@ -175,6 +194,12 @@ Template self image is the 1st term in template volume entry images. """ vols = _getVolsTree(sdUUID) + + # Remove volumes awaiting garbage collection from the result + for vol_id in vols.iterkeys(): + if vols[vol_id].garbage_meta_id is not None: + del vols[vol_id] + res = {} for volName in vols.iterkeys(): res[volName] = {'imgs': [], 'parent': None}
automation@ovirt.org has posted comments on this change.
Change subject: storage: Add garbage indicator to BlockSDVol namedtuple ......................................................................
Patch Set 1:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
automation@ovirt.org has posted comments on this change.
Change subject: storage: Add garbage indicator to BlockSDVol namedtuple ......................................................................
Patch Set 2:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
automation@ovirt.org has posted comments on this change.
Change subject: storage: Add garbage indicator to BlockSDVol namedtuple ......................................................................
Patch Set 3:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
automation@ovirt.org has posted comments on this change.
Change subject: storage: Add garbage indicator to BlockSDVol namedtuple ......................................................................
Patch Set 4:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
Jenkins CI RO has abandoned this change.
Change subject: storage: Add garbage indicator to BlockSDVol namedtuple ......................................................................
Abandoned
Abandoned due to no activity - please restore if still relevant
gerrit-hooks has posted comments on this change.
Change subject: storage: Add garbage indicator to BlockSDVol namedtuple ......................................................................
Patch Set 4:
* Update tracker: IGNORE, no Bug-Url found
vdsm-patches@lists.fedorahosted.org