Change in vdsm[master]: volume: add the extendVolumeSize method

abaron at redhat.com abaron at redhat.com
Tue Jun 25 10:26:58 UTC 2013


Ayal Baron has posted comments on this change.

Change subject: volume: add the extendVolumeSize method
......................................................................


Patch Set 3: (6 inline comments)

....................................................
File client/vdsClient.py
Line 2152:             'Extend the volume size (virtual disk size seen by the guest).',
Line 2153:             'If the updateCow argument is True (default) and the volume is ',
Line 2154:             'COW also the COW header will be updated. The value False is ',
Line 2155:             'used in the live disk extension where the COW header is updated ',
Line 2156:             'by the runninng VM.'
s/runninng/running/
Line 2157:         )),
Line 2158:         'uploadVolume': (serv.uploadVolume,
Line 2159:                          ('<sdUUID> <spUUID> <imgUUID> <volUUID> <srcPath> '
Line 2160:                           '<size>',


....................................................
File vdsm/storage/blockVolume.py
Line 640:             mtime = 0
Line 641: 
Line 642:         return mtime
Line 643: 
Line 644:     def _extendSizeRaw(self, newSize):
If the function is called "extend" then it should validate that newSize is greater than old size and not cause data loss for invalid input.
Line 645:         # No sanity checks here, they should be included in the calling
Line 646:         # function/method. If newSize is smaller than the current size
Line 647:         # this will lead to data loss.
Line 648:         newSizeMb = newSize / 2 / 1024


....................................................
File vdsm/storage/fileVolume.py
Line 617:             misc.ddWatchCopy("/dev/zero", volPath, vars.task.aborting,
Line 618:                              newSizeBytes - curSizeBytes, curSizeBytes)
Line 619:         else:
Line 620:             # for sparse files we can just truncate to the correct size
Line 621:             self.oop.truncateFile(volPath, newSizeBytes)
You should always truncate and do this before dd so that in case of failure the result is a file with the right size but just partially not preallocated versus having the wrong size.


....................................................
File vdsm/storage/hsm.py
Line 661:     @public
Line 662:     def extendVolumeSize(self, spUUID, sdUUID, imgUUID, volUUID, newSize,
Line 663:                          updateCow):
Line 664:         pool = self.getPool(spUUID)
Line 665:         newSize = self._parseVolumeSize(newSize, "newSize")
I'm not convinced we need 'updateCow' and cannot determine this automatically.
Where do you update the VM?
If we already have a separate flow that does this, why not have the cow update there either through qemu or qemu-img ?
Line 666:         vars.task.getSharedLock(STORAGE, sdUUID)
Line 667:         self._spmSchedule(
Line 668:             spUUID, "extendVolumeSize", pool.extendVolumeSize, sdUUID,
Line 669:             imgUUID, volUUID, newSize, misc.parseBool(updateCow))


Line 1376: 
Line 1377:     def _parseVolumeSize(self, size, name):
Line 1378:         # TODO: For backwards compatibility, we need to support accepting
Line 1379:         # number of sectors as int type Updated interface is accepting string
Line 1380:         # type in bytes (ugly, get rid of this when possible)
I think we can get rid of this right now, please check.

In addition, for new APIs I don't think we need this at all as there is no bc issue.
Line 1381:         if not isinstance(size, types.IntType):
Line 1382:             size = misc.validateN(size, name)
Line 1383:             size = (size + SECTOR_SIZE - 1) / SECTOR_SIZE
Line 1384:         return size


....................................................
File vdsm/storage/volume.py
Line 574: 
Line 575:         oldVolSize = self.getSize()
Line 576: 
Line 577:         if oldVolSize == newVolSize:
Line 578:             self.log.debug("skipping metadata update for volume %s size %",
"size in metadata is up to date, nothing to do" or something.
Line 579:                            self.volUUID, oldVolSize)
Line 580:         else:
Line 581:             self.log.debug("updating metadata for volume %s changing the "
Line 582:                            "size %s to %s", self.volUUID, oldVolSize,


-- 
To view, visit http://gerrit.ovirt.org/14590
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I817be851d7fbe080adf4da297b526837e244cec6
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Ayal Baron <abaron at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Maor Lipchuk <mlipchuk at redhat.com>
Gerrit-Reviewer: Sergey Gotliv <sgotliv at redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server


More information about the vdsm-patches mailing list