Change in vdsm[master]: Rename *Volume.extend method to *Volume.enlarge
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: Rename *Volume.extend method to *Volume.enlarge
......................................................................
Rename *Volume.extend method to *Volume.enlarge
Change-Id: Id7b88067fa3fe2c19faab31d0c882b4494f0bc12
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/blockVolume.py
M vdsm/storage/image.py
M vdsm/storage/sp.py
M vdsm/storage/volume.py
4 files changed, 8 insertions(+), 8 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/02/17802/1
diff --git a/vdsm/storage/blockVolume.py b/vdsm/storage/blockVolume.py
index effd3a5..5a99333 100644
--- a/vdsm/storage/blockVolume.py
+++ b/vdsm/storage/blockVolume.py
@@ -284,7 +284,7 @@
raise eFound
- def extend(self, newSize):
+ def enlarge(self, newSize):
"""Extend a logical volume
'newSize' - new size in blocks
"""
diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py
index e3414b4..eb37f09 100644
--- a/vdsm/storage/image.py
+++ b/vdsm/storage/image.py
@@ -394,7 +394,7 @@
volUUID=srcVol.volUUID)
# Extend volume (for LV only) size to the actual size
- dstVol.extend((volParams['apparentsize'] + 511) / 512)
+ dstVol.enlarge((volParams['apparentsize'] + 511) / 512)
# Change destination volume metadata back to the original
# type.
@@ -742,7 +742,7 @@
newsize = volParams['size']
else:
newsize = volParams['apparentsize']
- dstVol.extend(newsize)
+ dstVol.enlarge(newsize)
dstPath = dstVol.getVolumePath()
# Change destination volume metadata back to the original size.
dstVol.setSize(volParams['size'])
@@ -882,7 +882,7 @@
srcVol = sdDom.produceVolume(imgUUID=srcVolParams['imgUUID'],
volUUID=srcVolParams['volUUID'])
# Extend successor volume to new accumulated subchain size
- srcVol.extend(newSize)
+ srcVol.enlarge(newSize)
srcVol.prepare(rw=True, chainrw=True, setrw=True)
try:
@@ -918,7 +918,7 @@
srcVol = sdDom.produceVolume(imgUUID=srcVolParams['imgUUID'],
volUUID=srcVolParams['volUUID'])
# Extend successor volume to new accumulated subchain size
- srcVol.extend(newSize)
+ srcVol.enlarge(newSize)
# Step 1: Create temporary volume with destination volume's parent
# parameters
newUUID = str(uuid.uuid4())
@@ -1178,7 +1178,7 @@
vol = self._activateVolumeForImportExport(domain, imgUUID, volUUID)
try:
# Extend the volume (if relevant) to the image size
- vol.extend(imageSharing.getSize(methodArgs) / volume.BLOCK_SIZE)
+ vol.enlarge(imageSharing.getSize(methodArgs) / volume.BLOCK_SIZE)
imageSharing.download(vol.getVolumePath(), methodArgs)
finally:
domain.deactivateVolumes(imgUUID, volUUIDs=[vol.volUUID])
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index 3f3c1bf..348c02a 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -2071,7 +2071,7 @@
raise se.NonLeafVolumeNotWritable(vol)
targetPath = vol.getVolumePath()
if vol.isSparse():
- vol.extend(int(size))
+ vol.enlarge(int(size))
vol.prepare(rw=True, setrw=False)
try:
diff --git a/vdsm/storage/volume.py b/vdsm/storage/volume.py
index 10b3363..6a028e4 100644
--- a/vdsm/storage/volume.py
+++ b/vdsm/storage/volume.py
@@ -540,7 +540,7 @@
self.log.warn("Volume %s metadata error (%s)",
self.volUUID, str(e))
- def extend(self, newsize):
+ def enlarge(self, newsize):
"""
Extend the apparent size of logical volume (thin provisioning)
"""
--
To view, visit http://gerrit.ovirt.org/17802
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id7b88067fa3fe2c19faab31d0c882b4494f0bc12
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
9 years, 4 months
Change in vdsm[master]: [WIP] Small objects repository file implementation
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: [WIP] Small objects repository file implementation
......................................................................
[WIP] Small objects repository file implementation
Change-Id: I3003f8652a58c68a966bc37e591c1d1d2308c164
---
M vdsm/storage/fileSD.py
M vdsm/storage/hsm.py
M vdsm/storage/outOfProcess.py
M vdsm/storage/sd.py
M vdsm/storage/sp.py
M vdsm_cli/vdsClient.py
6 files changed, 83 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/42/242/1
--
To view, visit http://gerrit.ovirt.org/242
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3003f8652a58c68a966bc37e591c1d1d2308c164
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
9 years, 4 months
Change in vdsm[master]: Add a chown implementation that looks up uid and gid
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: Add a chown implementation that looks up uid and gid
......................................................................
Add a chown implementation that looks up uid and gid
We already have a case in vdsm (configNetwork) where we need to use
a chown function that is capable to convert the owner and group names
to uid and gid. Going forward this can be reused for the deployment
utilities and to prepare the paths needed by vdsm (eg: /rhev and
/var/run/vdsm).
Change-Id: Iab6f67ba93a0d9cbac775992623f3bb2ab996555
---
M vdsm/configNetwork.py
M vdsm/utils.py
2 files changed, 21 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/87/387/1
--
To view, visit http://gerrit.ovirt.org/387
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iab6f67ba93a0d9cbac775992623f3bb2ab996555
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
9 years, 4 months
Change in vdsm[master]: constants: unify the BLANK_UUID definition
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: constants: unify the BLANK_UUID definition
......................................................................
constants: unify the BLANK_UUID definition
Change-Id: Ib9260d74ae1da1382394a375843b2edff112e6f7
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
M client/vdsClient.py
M lib/vdsm/constants.py.in
M vdsm/API.py
M vdsm/storage/misc.py
M vdsm/storage/sd.py
M vdsm/storage/volume.py
6 files changed, 11 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/42/15442/1
diff --git a/client/vdsClient.py b/client/vdsClient.py
index 332b438..0aabd5b 100644
--- a/client/vdsClient.py
+++ b/client/vdsClient.py
@@ -26,13 +26,13 @@
import pprint as pp
from vdsm import vdscli
+from vdsm.constants import BLANK_UUID
+
try:
import vdsClientGluster as ge
_glusterEnabled = True
except ImportError:
_glusterEnabled = False
-
-BLANK_UUID = '00000000-0000-0000-0000-000000000000'
STATUS_ERROR = {'status': {'code': 100, 'message': "ERROR"}}
diff --git a/lib/vdsm/constants.py.in b/lib/vdsm/constants.py.in
index 63771f6..c750462 100644
--- a/lib/vdsm/constants.py.in
+++ b/lib/vdsm/constants.py.in
@@ -53,6 +53,7 @@
SUPPORTED_DOMAIN_VERSIONS = DOMAIN_VERSIONS
UUID_GLOB_PATTERN = '*-*-*-*-*'
+BLANK_UUID = '00000000-0000-0000-0000-000000000000'
MEGAB = 2 ** 20 # = 1024 ** 2 = 1 MiB
diff --git a/vdsm/API.py b/vdsm/API.py
index e04e894..0eb23b4 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -104,6 +104,8 @@
class VM(APIBase):
ctorArgs = ['vmID']
+ BLANK_UUID = constants.BLANK_UUID
+
def __init__(self, UUID):
APIBase.__init__(self)
self._UUID = UUID
@@ -676,7 +678,7 @@
SHARED = storage.volume.SHARED_VOL
LEAF = storage.volume.LEAF_VOL
- BLANK_UUID = storage.volume.BLANK_UUID
+ BLANK_UUID = constants.BLANK_UUID
def __init__(self, UUID, spUUID, sdUUID, imgUUID):
APIBase.__init__(self)
@@ -747,7 +749,7 @@
class Image(APIBase):
ctorArgs = ['imageID', 'storagepoolID', 'storagedomainID']
- BLANK_UUID = storage.volume.BLANK_UUID
+ BLANK_UUID = constants.BLANK_UUID
class DiskTypes:
UNKNOWN = storage.image.UNKNOWN_DISK_TYPE
@@ -855,7 +857,7 @@
ISO = storage.sd.ISO_DOMAIN
BACKUP = storage.sd.BACKUP_DOMAIN
- BLANK_UUID = storage.sd.BLANK_UUID
+ BLANK_UUID = constants.BLANK_UUID
def __init__(self, UUID):
APIBase.__init__(self)
diff --git a/vdsm/storage/misc.py b/vdsm/storage/misc.py
index e5ba760..a107fb6 100644
--- a/vdsm/storage/misc.py
+++ b/vdsm/storage/misc.py
@@ -433,7 +433,6 @@
UUID_REGEX = re.compile("^[a-f0-9]{8}-(?:[a-f0-9]{4}-){3}[a-f0-9]{12}$")
-UUID_BLANK = "00000000-0000-0000-0000-000000000000"
def validateUUID(uuid, name="uuid", blank=True):
@@ -455,7 +454,7 @@
if m is None:
raise se.InvalidParameterException(name, uuid)
- if not blank and uuid == UUID_BLANK:
+ if not blank and uuid == constants.BLANK_UUID:
raise se.InvalidParameterException(name, uuid)
diff --git a/vdsm/storage/sd.py b/vdsm/storage/sd.py
index 8c55c09..0f71b3d 100644
--- a/vdsm/storage/sd.py
+++ b/vdsm/storage/sd.py
@@ -133,7 +133,7 @@
ImgsPar = namedtuple("ImgsPar", "imgs,parent")
ISO_IMAGE_UUID = '11111111-1111-1111-1111-111111111111'
-BLANK_UUID = '00000000-0000-0000-0000-000000000000'
+BLANK_UUID = constants.BLANK_UUID
REMOVED_IMAGE_PREFIX = "_remove_me_"
ZEROED_IMAGE_PREFIX = REMOVED_IMAGE_PREFIX + "ZERO_"
diff --git a/vdsm/storage/volume.py b/vdsm/storage/volume.py
index 36e8d30..737f24e 100644
--- a/vdsm/storage/volume.py
+++ b/vdsm/storage/volume.py
@@ -68,7 +68,7 @@
SHARED_VOL: 'SHARED', INTERNAL_VOL: 'INTERNAL',
LEAF_VOL: 'LEAF'}
-BLANK_UUID = misc.UUID_BLANK
+BLANK_UUID = constants.BLANK_UUID
# Volume meta data fields
SIZE = "SIZE"
--
To view, visit http://gerrit.ovirt.org/15442
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib9260d74ae1da1382394a375843b2edff112e6f7
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
9 years, 4 months
Change in vdsm[master]: Decouple images and volumes from pool path
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: Decouple images and volumes from pool path
......................................................................
Decouple images and volumes from pool path
Change-Id: Ibde0becf2600ddf2390d12a4e854e1abbd3b1e40
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/fileSD.py
M vdsm/storage/fileVolume.py
M vdsm/storage/hsm.py
M vdsm/storage/image.py
M vdsm/storage/resourceFactories.py
M vdsm/storage/sd.py
M vdsm/storage/sp.py
7 files changed, 31 insertions(+), 34 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/55/16055/1
diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py
index d5ae707..039a2a0 100644
--- a/vdsm/storage/fileSD.py
+++ b/vdsm/storage/fileSD.py
@@ -325,12 +325,8 @@
Fetch the list of the Image UUIDs
"""
# Get Volumes of an image
- pattern = os.path.join(self.storage_repository,
- # ISO domains don't have images,
- # we can assume single domain
- self.getPools()[0],
- self.sdUUID, sd.DOMAIN_IMAGES)
- pattern = os.path.join(pattern, constants.UUID_GLOB_PATTERN)
+ imgsPath = os.path.join(self._getRepoPath(), sd.DOMAIN_IMAGES)
+ pattern = os.path.join(imgsPath, constants.UUID_GLOB_PATTERN)
files = self.oop.glob.glob(pattern)
imgList = []
for i in files:
@@ -546,7 +542,7 @@
templateImage = tImgs[0]
relinkImgs = tuple(tImgs[1:])
repoPath = self._getRepoPath()
- basePath = os.path.join(repoPath, self.sdUUID, sd.DOMAIN_IMAGES)
+ basePath = os.path.join(repoPath, sd.DOMAIN_IMAGES)
volFiles = [volUUID, volUUID + fileVolume.META_FILEEXT]
if self.hasVolumeLeases():
volFiles.append(volUUID + fileVolume.LEASE_FILEEXT)
diff --git a/vdsm/storage/fileVolume.py b/vdsm/storage/fileVolume.py
index 8b0a33e..2706e52 100644
--- a/vdsm/storage/fileVolume.py
+++ b/vdsm/storage/fileVolume.py
@@ -355,8 +355,7 @@
not including the shared base (template)
"""
# Get Volumes of an image
- pattern = os.path.join(repoPath, sdUUID, sd.DOMAIN_IMAGES,
- imgUUID, "*.meta")
+ pattern = os.path.join(repoPath, sd.DOMAIN_IMAGES, imgUUID, "*.meta")
files = oop.getProcessPool(sdUUID).glob.glob(pattern)
volList = []
for i in files:
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 7b9ed70..df5ff6c 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -1485,8 +1485,7 @@
# we should use the new resource system to synchronize the process
# an eliminate all race conditions
if needFake:
- img = image.Image(os.path.join(self.storage_repository,
- spUUID))
+ img = image.Image(dom.domaindir)
tName = volsByImg.iterkeys()[0]
tParams = dom.produceVolume(imgUUID, tName).getVolumeParams()
img.createFakeTemplate(sdUUID=sdUUID, volParams=tParams)
@@ -1556,8 +1555,8 @@
tImgUUID = e.absentTemplateImageUUID
tParams = srcDom.produceVolume(tImgUUID,
tName).getVolumeParams()
- image.Image(os.path.join(self.storage_repository, spUUID)
- ).createFakeTemplate(dstDom.sdUUID, tParams)
+ image.Image(dstDom.domaindir).createFakeTemplate(dstDom.sdUUID,
+ tParams)
domains = [srcDomUUID, dstDomUUID]
domains.sort()
@@ -1636,7 +1635,7 @@
tImgUUID = e.absentTemplateImageUUID
tParams = srcDom.produceVolume(tImgUUID,
tName).getVolumeParams()
- image.Image(os.path.join(self.storage_repository, spUUID)
+ image.Image(dstDom.domaindir
).createFakeTemplate(dstDom.sdUUID, tParams)
domains = sorted([srcDomUUID, dstDomUUID])
@@ -3152,11 +3151,10 @@
"""
vars.task.getSharedLock(STORAGE, sdUUID)
- img = image.Image(os.path.join(self.storage_repository, spUUID))
- imgVolumes = img.prepare(sdUUID, imgUUID, volUUID)
-
chain = []
dom = sdCache.produce(sdUUID=sdUUID)
+ img = image.Image(dom.domaindir)
+ imgVolumes = img.prepare(sdUUID, imgUUID, volUUID)
for vol in imgVolumes:
volInfo = {'domainID': sdUUID, 'imageID': imgUUID,
@@ -3194,7 +3192,8 @@
"""
vars.task.getSharedLock(STORAGE, sdUUID)
- img = image.Image(os.path.join(self.storage_repository, spUUID))
+ dom = sdCache.produce(sdUUID=sdUUID)
+ img = image.Image(dom.domaindir)
img.teardown(sdUUID, imgUUID, volUUID)
@public
@@ -3221,10 +3220,9 @@
images = [imgUUID]
uuidlist = []
- repoPath = os.path.join(self.storage_repository, spUUID)
for img in images:
uuidlist += (dom.getVolumeClass().
- getImageVolumes(repoPath, sdUUID, img))
+ getImageVolumes(dom.domaindir, sdUUID, img))
self.log.info("List of volumes is %s", uuidlist)
return dict(uuidlist=uuidlist)
diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py
index e2c28cd..c54894f 100644
--- a/vdsm/storage/image.py
+++ b/vdsm/storage/image.py
@@ -115,8 +115,7 @@
'sdUUID' - storage domain UUID
'imgUUID' - image UUID
"""
- imageDir = os.path.join(self.repoPath, sdUUID, sd.DOMAIN_IMAGES,
- imgUUID)
+ imageDir = os.path.join(self.repoPath, sd.DOMAIN_IMAGES, imgUUID)
if not os.path.isdir(imageDir):
self.log.info("Create placeholder %s for image's volumes",
imageDir)
@@ -131,7 +130,7 @@
"""
Return image directory
"""
- return os.path.join(self.repoPath, sdUUID, sd.DOMAIN_IMAGES, imgUUID)
+ return os.path.join(self.repoPath, sd.DOMAIN_IMAGES, imgUUID)
def deletedVolumeName(self, uuid):
"""
diff --git a/vdsm/storage/resourceFactories.py b/vdsm/storage/resourceFactories.py
index 98c362b..708cce7 100644
--- a/vdsm/storage/resourceFactories.py
+++ b/vdsm/storage/resourceFactories.py
@@ -18,7 +18,6 @@
# Refer to the README and COPYING files for full details of the license
#
-import os
from vdsm.config import config
import logging
import lvm
@@ -96,7 +95,6 @@
"""
This factory produce resources for images
"""
- storage_repository = config.get('irs', 'repository')
# Resource timeouts are in seconds. It's written in ms in the config for
# backward competability reasons
resource_default_timeout = config.getint('irs',
@@ -116,7 +114,7 @@
template = None
dom = sdCache.produce(sdUUID=self.sdUUID)
# Get the list of the volumes
- repoPath = os.path.join(self.storage_repository, dom.getPools()[0])
+ repoPath = dom.domaindir
try:
chain = image.Image(repoPath).getChain(sdUUID=self.sdUUID,
imgUUID=resourceName)
diff --git a/vdsm/storage/sd.py b/vdsm/storage/sd.py
index 8c55c09..baba500 100644
--- a/vdsm/storage/sd.py
+++ b/vdsm/storage/sd.py
@@ -656,7 +656,7 @@
raise se.ImagesNotSupportedError()
# If it has a repo we don't have multiple domains. Assume single pool
- return os.path.join(self.storage_repository, self.getPools()[0])
+ return self.domaindir
def getIsoDomainImagesDir(self):
"""
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index 052bbf0..83a1f2b 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -1759,7 +1759,8 @@
rmanager.acquireResource(dstImageResourcesNamespace,
dstImgUUID, rm.LockType.exclusive)
):
- dstUUID = image.Image(self.poolPath).copy(
+ dom = sdCache.produce(sdUUID=sdUUID)
+ dstUUID = image.Image(dom.domaindir).copy(
sdUUID, vmUUID, srcImgUUID, srcVolUUID, dstImgUUID,
dstVolUUID, descr, dstSdUUID, volType, volFormat, preallocate,
postZero, force)
@@ -1806,7 +1807,8 @@
imgUUID, srcLock),
rmanager.acquireResource(dstImageResourcesNamespace,
imgUUID, rm.LockType.exclusive)):
- image.Image(self.poolPath).move(srcDomUUID, dstDomUUID, imgUUID,
+ dom = sdCache.produce(sdUUID=srcDomUUID)
+ image.Image(dom.domaindir).move(srcDomUUID, dstDomUUID, imgUUID,
vmUUID, op, postZero, force)
def cloneImageStructure(self, sdUUID, imgUUID, dstSdUUID):
@@ -1833,7 +1835,8 @@
)))
with nested(*resList):
- image.Image(self.poolPath).cloneStructure(
+ dom = sdCache.produce(sdUUID=sdUUID)
+ image.Image(dom.domaindir).cloneStructure(
sdUUID, imgUUID, dstSdUUID)
def syncImageData(self, sdUUID, imgUUID, dstSdUUID, syncType):
@@ -1861,7 +1864,8 @@
)))
with nested(*resList):
- image.Image(self.poolPath).syncData(
+ dom = sdCache.produce(sdUUID=sdUUID)
+ image.Image(dom.domaindir).syncData(
sdUUID, imgUUID, dstSdUUID, syncType)
def moveMultipleImages(self, srcDomUUID, dstDomUUID, imgDict, vmUUID,
@@ -1899,7 +1903,8 @@
dstImageResourcesNamespace, imgUUID, rm.LockType.exclusive))
with nested(*resourceList):
- image.Image(self.poolPath).multiMove(
+ dom = sdCache.produce(sdUUID=srcDomUUID)
+ image.Image(dom.domaindir).multiMove(
srcDomUUID, dstDomUUID, imgDict, vmUUID, force)
def mergeSnapshots(self, sdUUID, vmUUID, imgUUID, ancestor, successor,
@@ -1925,7 +1930,8 @@
with rmanager.acquireResource(imageResourcesNamespace, imgUUID,
rm.LockType.exclusive):
- image.Image(self.poolPath).merge(
+ dom = sdCache.produce(sdUUID=sdUUID)
+ image.Image(dom.domaindir).merge(
sdUUID, vmUUID, imgUUID, ancestor, successor, postZero)
def createVolume(self, sdUUID, imgUUID, size, volFormat, preallocate,
@@ -2097,7 +2103,8 @@
self.log.warning("SP %s SD %s img %s Vol %s - teardown failed")
def validateVolumeChain(self, sdUUID, imgUUID):
- image.Image(self.poolPath).validateVolumeChain(sdUUID, imgUUID)
+ dom = sdCache.produce(sdUUID=sdUUID)
+ image.Image(dom.domaindir).validateVolumeChain(sdUUID, imgUUID)
def extendSD(self, sdUUID, devlist, force):
sdCache.produce(sdUUID).extend(devlist, force)
--
To view, visit http://gerrit.ovirt.org/16055
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibde0becf2600ddf2390d12a4e854e1abbd3b1e40
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
Gerrit-Reviewer: Ayal Baron <abaron(a)redhat.com>
9 years, 4 months
Change in vdsm[master]: Remove StoragePool.createVolume().
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: Remove StoragePool.createVolume().
......................................................................
Remove StoragePool.createVolume().
Change-Id: I45186ab45d075d764c0a630e6b7a483baef1e45b
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/hsm.py
M vdsm/storage/sp.py
2 files changed, 7 insertions(+), 55 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/25/16325/1
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 5a5b4fb..ef354e0 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -1379,8 +1379,6 @@
diskType, volUUID, desc,
srcImgUUID, srcVolUUID))
vars.task.setDefaultException(se.VolumeCreationError(argsStr))
- # Validates that the pool is connected. WHY?
- pool = self.getPool(spUUID)
sdDom = self.validateSdUUID(sdUUID)
misc.validateUUID(imgUUID, 'imgUUID')
misc.validateUUID(volUUID, 'volUUID')
@@ -1399,9 +1397,13 @@
sdDom.validateCreateVolumeParams(volFormat, preallocate, srcVolUUID)
vars.task.getSharedLock(STORAGE, sdUUID)
- self._spmSchedule(spUUID, "createVolume", pool.createVolume, sdUUID,
- imgUUID, size, volFormat, preallocate, diskType,
- volUUID, desc, srcImgUUID, srcVolUUID)
+ imageResourcesNamespace = sd.getNamespace(sdUUID, IMAGE_NAMESPACE)
+ with rmanager.acquireResource(imageResourcesNamespace, imgUUID,
+ rm.LockType.exclusive):
+ self._spmSchedule(spUUID, "createVolume_%s" % volUUID,
+ sdDom.createVolume, imgUUID, size, volFormat,
+ preallocate, diskType, volUUID, desc,
+ srcImgUUID, srcVolUUID)
@public
def deleteVolume(self, sdUUID, spUUID, imgUUID, volumes, postZero=False,
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index 9b154f4..4a9fa05 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -49,7 +49,6 @@
from resourceFactories import IMAGE_NAMESPACE
from storageConstants import STORAGE
import resourceManager as rm
-import volume
import mount
from domainMonitor import DomainMonitor
@@ -1897,55 +1896,6 @@
rm.LockType.exclusive):
image.Image(self.poolPath).merge(
sdUUID, vmUUID, imgUUID, ancestor, successor, postZero)
-
- def createVolume(self, sdUUID, imgUUID, size, volFormat, preallocate,
- diskType, volUUID=None, desc="",
- srcImgUUID=volume.BLANK_UUID,
- srcVolUUID=volume.BLANK_UUID):
- """
- Creates a new volume.
-
- .. note::
- If the *imgUUID* is **identical** to the *srcImgUUID* the new
- volume will be logically considered a snapshot of the old volume.
- If the *imgUUID* is **different** from the *srcImgUUID* the old
- volume will be logically considered as a template of the new
- volume.
-
- :param sdUUID: The UUID of the storage domain that contains the volume.
- :type sdUUID: UUID
- :param imgUUID: The UUID of the image that the new volume will have.
- :type imgUUID: UUID
- :param size: The size of the new volume in bytes.
- :type size: int
- :param volFormat: The format of the new volume.
- :type volFormat: some enum ?!
- :param preallocate: Should the volume be preallocated.
- :type preallocate: bool
- :param diskType: The disk type of the new volume.
- :type diskType: :class:`API.Image.DiskTypes`
- :param volUUID: The UUID of the new volume that will be created.
- :type volUUID: UUID
- :param desc: A human readable description of the new volume.
- :param srcImgUUID: The UUID of the image that resides on the volume
- that will be the base of the new volume.
- :type srcImgUUID: UUID
- :param srcVolUUID: The UUID of the volume that will be the base of the
- new volume.
- :type srcVolUUID: UUID
-
- :returns: a dict with the UUID of the new volume.
- :rtype: dict
- """
- imageResourcesNamespace = sd.getNamespace(sdUUID, IMAGE_NAMESPACE)
-
- with rmanager.acquireResource(imageResourcesNamespace, imgUUID,
- rm.LockType.exclusive):
- uuid = sdCache.produce(sdUUID).createVolume(
- imgUUID=imgUUID, size=size, volFormat=volFormat,
- preallocate=preallocate, diskType=diskType, volUUID=volUUID,
- desc=desc, srcImgUUID=srcImgUUID, srcVolUUID=srcVolUUID)
- return dict(uuid=uuid)
def deleteVolume(self, sdUUID, imgUUID, volumes, postZero, force):
"""
--
To view, visit http://gerrit.ovirt.org/16325
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I45186ab45d075d764c0a630e6b7a483baef1e45b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
9 years, 4 months
Change in vdsm[master]: Remove redundant calls that slow down getVolumeInfo
by ykaplan@redhat.com
Yeela Kaplan has uploaded a new change for review.
Change subject: Remove redundant calls that slow down getVolumeInfo
......................................................................
Remove redundant calls that slow down getVolumeInfo
Change-Id: I30639134f9200fb6bfcf605b5d8fbc483b51d6e7
Signed-off-by: Yeela Kaplan <ykaplan(a)redhat.com>
---
M vdsm/storage/blockVolume.py
M vdsm/storage/fileVolume.py
M vdsm/storage/volume.py
3 files changed, 47 insertions(+), 40 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/73/18273/1
diff --git a/vdsm/storage/blockVolume.py b/vdsm/storage/blockVolume.py
index effd3a5..63d1593 100644
--- a/vdsm/storage/blockVolume.py
+++ b/vdsm/storage/blockVolume.py
@@ -631,24 +631,22 @@
"""
Return the volume size in blocks
"""
- # Just call the class method getVSize() - apparently it does what
- # we need. We consider incurred overhead of producing the SD object
- # to be a small price for code de-duplication.
sdobj = sdCache.produce(sdUUID=self.sdUUID)
return self.getVSize(sdobj, self.imgUUID, self.volUUID, bs)
- getVolumeTrueSize = getVolumeSize
-
- def getVolumeMtime(self):
+ def getVolumeSizes(self, bs=BLOCK_SIZE):
"""
- Return the volume mtime in msec epoch
+ Logical volumes apparent and true size are the same so return the
+ volume size for both
"""
- try:
- mtime = self.getMetaParam(volume.MTIME)
- except se.MetaDataKeyNotFoundError:
- mtime = 0
+ size = self.getVolumeSize(bs)
+ return (size, size)
- return mtime
+ def getMtime(self):
+ """
+ logical volumes don't have a modified time, so just return 0
+ """
+ return 0
def _extendSizeRaw(self, newSize):
# Since this method relies on lvm.extendLV (lvextend) when the
diff --git a/vdsm/storage/fileVolume.py b/vdsm/storage/fileVolume.py
index cc61dde..337026b 100644
--- a/vdsm/storage/fileVolume.py
+++ b/vdsm/storage/fileVolume.py
@@ -405,18 +405,6 @@
self.setMetaParam(volume.IMAGE, imgUUID)
@classmethod
- def getVSize(cls, sdobj, imgUUID, volUUID, bs=BLOCK_SIZE):
- volPath = os.path.join(sdobj.mountpoint, sdobj.sdUUID, 'images',
- imgUUID, volUUID)
- return int(sdobj.oop.os.stat(volPath).st_size / bs)
-
- @classmethod
- def getVTrueSize(cls, sdobj, imgUUID, volUUID, bs=BLOCK_SIZE):
- volPath = os.path.join(sdobj.mountpoint, sdobj.sdUUID, 'images',
- imgUUID, volUUID)
- return int(int(sdobj.oop.os.stat(volPath).st_blocks) * BLOCK_SIZE / bs)
-
- @classmethod
def renameVolumeRollback(cls, taskObj, oldPath, newPath):
try:
cls.log.info("oldPath=%s newPath=%s", oldPath, newPath)
@@ -538,30 +526,46 @@
if not self.oop.fileUtils.pathExists(metaVolumePath):
raise se.VolumeDoesNotExist(self.volUUID)
+ @classmethod
+ def getSizes(cls, volPath, bs=BLOCK_SIZE):
+ st = cls.oop.os.stat(volPath)
+ apparentSize = int(int(st.st_size) / bs)
+ trueSize = int(int(st.st_blocks) * BLOCK_SIZE / bs)
+ return (apparentSize, trueSize)
+
+ @classmethod
+ def getVSize(cls, sdobj, imgUUID, volUUID, bs=BLOCK_SIZE):
+ volPath = os.path.join(sdobj.mountpoint, sdobj.sdUUID, 'images',
+ imgUUID, volUUID)
+ return int(sdobj.oop.os.stat(volPath).st_size / bs)
+
+ @classmethod
+ def getVTrueSize(cls, sdobj, imgUUID, volUUID, bs=BLOCK_SIZE):
+ volPath = os.path.join(sdobj.mountpoint, sdobj.sdUUID, 'images',
+ imgUUID, volUUID)
+ return int(int(sdobj.oop.os.stat(volPath).st_blocks) * BLOCK_SIZE / bs)
+
def getVolumeSize(self, bs=BLOCK_SIZE):
"""
Return the volume size in blocks
"""
volPath = self.getVolumePath()
- return int(int(self.oop.os.stat(volPath).st_size) / bs)
+ return self.getSizes(volPath, bs)[0]
- def getVolumeTrueSize(self, bs=BLOCK_SIZE):
+ def getVolumeSizes(self, bs=BLOCK_SIZE):
"""
Return the size of the storage allocated for this volume
on underlying storage
"""
volPath = self.getVolumePath()
- return int(int(self.oop.os.stat(volPath).st_blocks) * BLOCK_SIZE / bs)
+ return self.getSizes(volPath, bs)
- def getVolumeMtime(self):
+ def getMtime(self):
"""
Return the volume mtime in msec epoch
"""
volPath = self.getVolumePath()
- try:
- return self.getMetaParam(volume.MTIME)
- except se.MetaDataKeyNotFoundError:
- return self.oop.os.stat(volPath).st_mtime
+ return self.oop.os.stat(volPath).st_mtime
def _extendSizeRaw(self, newSize):
volPath = self.getVolumePath()
diff --git a/vdsm/storage/volume.py b/vdsm/storage/volume.py
index 10b3363..014f733 100644
--- a/vdsm/storage/volume.py
+++ b/vdsm/storage/volume.py
@@ -884,7 +884,6 @@
"""
self.log.info("Info request: sdUUID=%s imgUUID=%s volUUID = %s ",
self.sdUUID, self.imgUUID, self.volUUID)
- image_corrupted = False
info = {}
try:
meta = self.getMetadata()
@@ -892,11 +891,14 @@
info["capacity"] = str(int(info["size"]) * BLOCK_SIZE)
del info["size"]
# Get the image actual size on disk
- vsize = self.getVolumeSize(bs=1)
- avsize = self.getVolumeTrueSize(bs=1)
+ (vsize, avsize) = self.getVolumeSizes(bs=1)
info['apparentsize'] = str(vsize)
info['truesize'] = str(avsize)
- info['mtime'] = self.getVolumeMtime()
+ if MTIME in info:
+ info['mtime'] = info[MTIME]
+ else:
+ info['mtime'] = self.getMtime()
+
info['status'] = "OK"
except se.StorageException as e:
self.log.debug("exception: %s:%s" % (str(e.message), str(e.value)))
@@ -905,11 +907,13 @@
info['mtime'] = "0"
info['status'] = "INVALID"
- info['children'] = self.getChildrenList()
+ # Both engine and dumpStorageTable don't use this option so
+ # only keeping it to not break existing scripts that look for the key
+ info['children'] = []
# If image was set to illegal, mark the status same
# (because of VDC constraints)
- if info.get('legality', None) == ILLEGAL_VOL or image_corrupted:
+ if info.get('legality', None) == ILLEGAL_VOL:
info['status'] = ILLEGAL_VOL
self.log.info("%s/%s/%s info is %s",
self.sdUUID, self.imgUUID, self.volUUID, str(info))
@@ -991,8 +995,9 @@
# to byte multiples everywhere to avoid conversion errors and change
# only at the end
volParams['size'] = self.getSize()
- volParams['apparentsize'] = self.getVolumeSize(bs=bs)
- volParams['truesize'] = self.getVolumeTrueSize(bs=bs)
+ (apparentSize, trueSize) = self.getVolumeSizes(bs=bs)
+ volParams['apparentsize'] = apparentSize
+ volParams['truesize'] = trueSize
volParams['parent'] = self.getParent()
volParams['descr'] = self.getDescription()
volParams['legality'] = self.getLegality()
--
To view, visit http://gerrit.ovirt.org/18273
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I30639134f9200fb6bfcf605b5d8fbc483b51d6e7
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan(a)redhat.com>
Gerrit-Reviewer: Ayal Baron <abaron(a)redhat.com>
9 years, 4 months
Change in vdsm[master]: Use the full prefix when removing file images.
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: Use the full prefix when removing file images.
......................................................................
Use the full prefix when removing file images.
os.tempnam() prefix is limited to 5 characters.
Related to: https://bugzilla.redhat.com/show_bug.cgi?id=1005788
Change-Id: Ie42dfb17eff1cbbf054de0cab493321567ea7e25
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/fileSD.py
1 file changed, 3 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/07/19107/1
diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py
index ee1255f..0cccaef 100644
--- a/vdsm/storage/fileSD.py
+++ b/vdsm/storage/fileSD.py
@@ -342,7 +342,9 @@
def deleteImage(self, sdUUID, imgUUID, volsImgs):
currImgDir = getImagePath(sdUUID, imgUUID)
dirName, baseName = os.path.split(currImgDir)
- toDelDir = os.tempnam(dirName, sd.REMOVED_IMAGE_PREFIX + baseName)
+ saltDir, salt = os.path.split(os.tempnam(dirName, "_DEL_"))
+ toDelDir = os.path.join(saltDir,
+ sd.REMOVED_IMAGE_PREFIX + baseName + salt)
try:
self.oop.os.rename(currImgDir, toDelDir)
except OSError as e:
--
To view, visit http://gerrit.ovirt.org/19107
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie42dfb17eff1cbbf054de0cab493321567ea7e25
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
9 years, 4 months
Change in vdsm[master]: lib: add rebase to qemuImg module
by ykaplan@redhat.com
Yeela Kaplan has uploaded a new change for review.
Change subject: lib: add rebase to qemuImg module
......................................................................
lib: add rebase to qemuImg module
Change-Id: I78e5584e59deaa5c302b1da67f5e3b840f6aa222
Signed-off-by: Yeela Kaplan <ykaplan(a)redhat.com>
---
M lib/vdsm/qemuImg.py
1 file changed, 21 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/29/19229/1
diff --git a/lib/vdsm/qemuImg.py b/lib/vdsm/qemuImg.py
index e9a328c..24d6940 100644
--- a/lib/vdsm/qemuImg.py
+++ b/lib/vdsm/qemuImg.py
@@ -167,3 +167,24 @@
if rc != 0:
raise QImgError(rc, out, err)
+
+
+def rebase(image, backing, format=None, backingFormat=None, unsafe=False):
+ cmd = [_qemuimg.cmd, "rebase"]
+
+ if format:
+ cmd.extend(("-f", format))
+
+ if unsafe:
+ cmd.append("-u")
+
+ cmd.extend(("-b", backing))
+
+ if backingFormat:
+ cmd.extend(("-F", backingFormat))
+
+ cmd.append(image)
+ rc, out, err = utils.execCmd(cmd)
+
+ if rc != 0:
+ raise QImgError(rc, out, err)
--
To view, visit http://gerrit.ovirt.org/19229
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I78e5584e59deaa5c302b1da67f5e3b840f6aa222
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan(a)redhat.com>
9 years, 4 months
Change in vdsm[master]: Fill volume children info.
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: Fill volume children info.
......................................................................
Fill volume children info.
In spite that they are no consumers for 'children' key in
Volume.getInfo() result adding the children set for correcteness.
Change-Id: Ibf374e6abe81962619baecf96fffa0f817ce5dcb
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/volume.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/04/20004/1
diff --git a/vdsm/storage/volume.py b/vdsm/storage/volume.py
index c19ec2f..96b84d7 100644
--- a/vdsm/storage/volume.py
+++ b/vdsm/storage/volume.py
@@ -903,7 +903,7 @@
# Both engine and dumpStorageTable don't use this option so
# only keeping it to not break existing scripts that look for the key
- info['children'] = []
+ info['children'] = list(self.getChildren())
# If image was set to illegal, mark the status same
# (because of VDC constraints)
--
To view, visit http://gerrit.ovirt.org/20004
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf374e6abe81962619baecf96fffa0f817ce5dcb
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
9 years, 4 months