Adam Litke has uploaded a new change for review.
Change subject: storage: Factor apparentsize adjustment into a reusable function ......................................................................
storage: Factor apparentsize adjustment into a reusable function
When creating a new volume sometimes the actual size is larger than the requested size due to underlying storage limitations (such as physical extent granularity in LVM). In these cases, the new volume's size must be adjusted to match the actual size. The SDM volume creation code would also like to use this function so extract it into the VolumeMetadata class.
Change-Id: I7395850e127b941fc50ae8d5659868a2499b5076 Signed-off-by: Adam Litke alitke@redhat.com --- M vdsm/storage/volume.py 1 file changed, 28 insertions(+), 18 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/44/44044/1
diff --git a/vdsm/storage/volume.py b/vdsm/storage/volume.py index f7e5bc0..723b3d9 100644 --- a/vdsm/storage/volume.py +++ b/vdsm/storage/volume.py @@ -495,6 +495,31 @@ puuid) return None
+ @classmethod + def adjust_new_volume_size(cls, dom_manifest, img_id, vol_id, req_size, + vol_format): + # When the volume format is raw what the guest sees is the apparent + # size of the file/device therefore if the requested size doesn't + # match the apparent size (eg: physical extent granularity in LVM) + # we need to update the size value so that the metadata reflects + # the correct state. + if vol_format == RAW_FORMAT: + apparentSize = int(dom_manifest.getVSize(img_id, vol_id) / + BLOCK_SIZE) + if apparentSize < req_size: + cls.log.error("The volume %s apparent size %s is smaller " + "than the requested size %s", + vol_id, apparentSize, req_size) + raise se.VolumeCreationError() + if apparentSize > req_size: + cls.log.info("The requested size for volume %s doesn't " + "match the granularity on domain %s, " + "updating the volume size from %s to %s", + vol_id, dom_manifest.sdUUID, req_size, + apparentSize) + return apparentSize + return req_size +
class Volume(object): log = logging.getLogger('Storage.Volume') @@ -850,24 +875,9 @@ cls.log.error("Failed to create volume %s: %s", volPath, e) vars.task.popRecovery() raise - # When the volume format is raw what the guest sees is the apparent - # size of the file/device therefore if the requested size doesn't - # match the apparent size (eg: physical extent granularity in LVM) - # we need to update the size value so that the metadata reflects - # the correct state. - if volFormat == RAW_FORMAT: - apparentSize = int(dom.getVSize(imgUUID, volUUID) / BLOCK_SIZE) - if apparentSize < size: - cls.log.error("The volume %s apparent size %s is smaller " - "than the requested size %s", - volUUID, apparentSize, size) - raise se.VolumeCreationError() - if apparentSize > size: - cls.log.info("The requested size for volume %s doesn't " - "match the granularity on domain %s, " - "updating the volume size from %s to %s", - volUUID, sdUUID, size, apparentSize) - size = apparentSize + + size = VolumeMetadata.adjust_new_volume_size(dom, imgUUID, volUUID, + size, volFormat)
vars.task.pushRecovery( task.Recovery("Create volume metadata rollback", clsModule,
automation@ovirt.org has posted comments on this change.
Change subject: storage: Factor apparentsize adjustment into a reusable function ......................................................................
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: Factor apparentsize adjustment into a reusable function ......................................................................
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: Factor apparentsize adjustment into a reusable function ......................................................................
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: Factor apparentsize adjustment into a reusable function ......................................................................
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'])
automation@ovirt.org has posted comments on this change.
Change subject: storage: Factor apparentsize adjustment into a reusable function ......................................................................
Patch Set 5:
* 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'])
gerrit-hooks has posted comments on this change.
Change subject: storage: Factor apparentsize adjustment into a reusable function ......................................................................
Patch Set 5:
* Update tracker: IGNORE, no Bug-Url found
Jenkins CI RO has abandoned this change.
Change subject: storage: Factor apparentsize adjustment into a reusable function ......................................................................
Abandoned
Abandoned due to no activity - please restore if still relevant
vdsm-patches@lists.fedorahosted.org