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>
10 years
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>
10 years
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>
10 years
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>
10 years
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>
10 years
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>
10 years
Change in vdsm[master]: Move fenceNode out of API.py
by smizrahi@redhat.com
Saggi Mizrahi has uploaded a new change for review.
Change subject: Move fenceNode out of API.py
......................................................................
Move fenceNode out of API.py
The actual details of how the response is mangles is part of the
bindings so API.py really doesn't serve a purpose.
This is the first step in a general trend of moving the logic out of
API.py to dedicated modules and move the response mangling to the
binding wrappers.
Change-Id: Idaba551333a0f289abaff11dc113e09c426d591a
Signed-off-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
M vdsm/API.py
M vdsm/BindingXMLRPC.py
2 files changed, 25 insertions(+), 38 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/91/7191/1
diff --git a/vdsm/API.py b/vdsm/API.py
index 5826d81..4fdc7e7 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -37,7 +37,6 @@
from vdsm.define import doneCode, errCode, Kbytes, Mbytes
import caps
from vdsm.config import config
-import fenceAgent
import supervdsm
@@ -972,40 +971,6 @@
APIBase.__init__(self)
# General Host functions
- def fenceNode(self, addr, port, agent, username, password, action,
- secure=False, options=''):
- """Send a fencing command to a remote node.
-
- agent is one of (rsa, ilo, drac5, ipmilan, etc)
- action can be one of (status, on, off, reboot)."""
-
- self.log.debug('fenceNode(addr=%s,port=%s,agent=%s,user=%s,' +
- 'passwd=%s,action=%s,secure=%s,options=%s)', addr, port, agent,
- username, 'XXXX', action, secure, options)
-
- secure = utils.tobool(secure)
- port = int(port)
-
- if action == "status":
- try:
- power = fenceAgent.getFenceStatus(addr, port, agent, username,
- password, secure, options)
-
- return {'status': doneCode,
- 'power': power}
-
- except fenceAgent.FenceStatusCheckError as e:
- return {'status': {'code': 1, 'message': str(e)}}
-
- try:
- fenceAgent.fenceNode(addr, port, agent, username, password, secure,
- options, self._cif.shutdownEvent)
-
- return {'status': doneCode}
-
- except fenceAgent.UnsupportedFencingAgentError:
- return errCode['fenceAgent']
-
def ping(self):
"Ping the server. Useful for tests"
return {'status': doneCode}
diff --git a/vdsm/BindingXMLRPC.py b/vdsm/BindingXMLRPC.py
index 48f4723..7eee29e 100644
--- a/vdsm/BindingXMLRPC.py
+++ b/vdsm/BindingXMLRPC.py
@@ -32,6 +32,8 @@
from vdsm.define import doneCode, errCode
import API
from vdsm.exception import VdsmException
+import fenceAgent
+
try:
from gluster.api import getGlusterMethods
_glusterEnabled = True
@@ -355,9 +357,29 @@
def fenceNode(self, addr, port, agent, username, password, action,
secure=False, options=''):
- api = API.Global()
- return api.fenceNode(addr, port, agent, username, password,
- action, secure, options)
+
+ secure = utils.tobool(secure)
+ port = int(port)
+
+ if action == "status":
+ try:
+ power = fenceAgent.getFenceStatus(addr, port, agent, username,
+ password, secure, options)
+
+ return {'status': doneCode,
+ 'power': power}
+
+ except fenceAgent.FenceStatusCheckError as e:
+ return {'status': {'code': 1, 'message': str(e)}}
+
+ try:
+ fenceAgent.fenceNode(addr, port, agent, username, password, secure,
+ options, self.cif.shutdownEvent)
+
+ return {'status': doneCode}
+
+ except fenceAgent.UnsupportedFencingAgentError:
+ return errCode['fenceAgent']
def setLogLevel(self, level):
api = API.Global()
--
To view, visit http://gerrit.ovirt.org/7191
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idaba551333a0f289abaff11dc113e09c426d591a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi(a)redhat.com>
10 years
Change in vdsm[master]: vdsm: storage/task.py replace/remove too generic except hand...
by Vinzenz Feenstra
Vinzenz Feenstra has uploaded a new change for review.
Change subject: vdsm: storage/task.py replace/remove too generic except handlers
......................................................................
vdsm: storage/task.py replace/remove too generic except handlers
Change-Id: Ia09dcada40bca3f16f94ad7a6c83e6d7a85ade77
Signed-off-by: Vinzenz Feenstra <vfeenstr(a)redhat.com>
---
M vdsm/storage/task.py
1 file changed, 2 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/51/17751/1
diff --git a/vdsm/storage/task.py b/vdsm/storage/task.py
index 4eff5c1..5b8613f 100644
--- a/vdsm/storage/task.py
+++ b/vdsm/storage/task.py
@@ -173,7 +173,7 @@
self.state = self.unknown
else:
self.state = getattr(self, state)
- except:
+ except AttributeError:
self.state = self.unknown
def value(self):
@@ -751,7 +751,7 @@
self.log.error("Unexpected error", exc_info=True)
try:
getProcPool().fileUtils.cleanupdir(taskDir)
- except:
+ except Exception:
self.log.warning("can't remove temp taskdir %s" % taskDir)
raise se.TaskPersistError("%s persist failed: %s" % (self, e))
# Make sure backup dir doesn't exist
@@ -862,8 +862,6 @@
except Exception as e:
message = unicode(e)
self._setError(e)
- except:
- self._setError()
self.log.debug("Task._run: %s %s %s failed - stopping task",
self, args, kargs)
--
To view, visit http://gerrit.ovirt.org/17751
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia09dcada40bca3f16f94ad7a6c83e6d7a85ade77
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr(a)redhat.com>
10 years
Change in vdsm[master]: gluster: Replace bricks verbs removed
by avishwan@redhat.com
Aravinda VK has uploaded a new change for review.
Change subject: gluster: Replace bricks verbs removed
......................................................................
gluster: Replace bricks verbs removed
glusterfs phased out replace-brick feature.
http://lists.nongnu.org/archive/html/gluster-devel/2013-09/msg00155.html
Existing replace-bricks verbs are not yet consumed by ovirt-engine, so removing
all the verbs.
Removed verbs:
glusterVolumeReplaceBrickStart
glusterVolumeReplaceBrickAbort
glusterVolumeReplaceBrickPause
glusterVolumeReplaceBrickStatus
glusterVolumeReplaceBrickCommit
glusterVolumeRemoveBrickStart
Change-Id: I23cd224ced9c6892ab182f663476df428f2f35da
Signed-off-by: Aravinda VK <avishwan(a)redhat.com>
---
M vdsm/gluster/api.py
M vdsm/gluster/cli.py
M vdsm/gluster/exception.py
M vdsm/gluster/tasks.py
4 files changed, 1 insertion(+), 163 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/60/20060/1
diff --git a/vdsm/gluster/api.py b/vdsm/gluster/api.py
index ebb0901..43e60cf 100644
--- a/vdsm/gluster/api.py
+++ b/vdsm/gluster/api.py
@@ -129,43 +129,6 @@
return self.svdsmProxy.glusterVolumeRebalanceStatus(volumeName)
@exportAsVerb
- def volumeReplaceBrickStart(self, volumeName, existingBrick, newBrick,
- options=None):
- return self.svdsmProxy.glusterVolumeReplaceBrickStart(volumeName,
- existingBrick,
- newBrick)
-
- @exportAsVerb
- def volumeReplaceBrickAbort(self, volumeName, existingBrick, newBrick,
- options=None):
- self.svdsmProxy.glusterVolumeReplaceBrickAbort(volumeName,
- existingBrick,
- newBrick)
-
- @exportAsVerb
- def volumeReplaceBrickPause(self, volumeName, existingBrick, newBrick,
- options=None):
- self.svdsmProxy.glusterVolumeReplaceBrickPause(volumeName,
- existingBrick,
- newBrick)
-
- @exportAsVerb
- def volumeReplaceBrickStatus(self, volumeName, oldBrick, newBrick,
- options=None):
- st, msg = self.svdsmProxy.glusterVolumeReplaceBrickStatus(volumeName,
- oldBrick,
- newBrick)
- return {'replaceBrick': st, 'message': msg}
-
- @exportAsVerb
- def volumeReplaceBrickCommit(self, volumeName, existingBrick, newBrick,
- force=False, options=None):
- self.svdsmProxy.glusterVolumeReplaceBrickCommit(volumeName,
- existingBrick,
- newBrick,
- force)
-
- @exportAsVerb
def volumeRemoveBrickStart(self, volumeName, brickList,
replicaCount=0, options=None):
return self.svdsmProxy.glusterVolumeRemoveBrickStart(volumeName,
diff --git a/vdsm/gluster/cli.py b/vdsm/gluster/cli.py
index a67658f..3ed3bd4 100644
--- a/vdsm/gluster/cli.py
+++ b/vdsm/gluster/cli.py
@@ -75,7 +75,6 @@
class TaskType:
REBALANCE = 'REBALANCE'
- REPLACE_BRICK = 'REPLACE_BRICK'
REMOVE_BRICK = 'REMOVE_BRICK'
@@ -651,83 +650,6 @@
@makePublic
-def volumeReplaceBrickStart(volumeName, existingBrick, newBrick):
- command = _getGlusterVolCmd() + ["replace-brick", volumeName,
- existingBrick, newBrick, "start"]
- try:
- xmltree = _execGlusterXml(command)
- except ge.GlusterCmdFailedException, e:
- raise ge.GlusterVolumeReplaceBrickStartFailedException(rc=e.rc,
- err=e.err)
- try:
- return {'taskId': xmltree.find('volReplaceBrick/task-id').text}
- except _etreeExceptions:
- raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
-
-
-@makePublic
-def volumeReplaceBrickAbort(volumeName, existingBrick, newBrick):
- command = _getGlusterVolCmd() + ["replace-brick", volumeName,
- existingBrick, newBrick, "abort"]
- try:
- _execGlusterXml(command)
- return True
- except ge.GlusterCmdFailedException, e:
- raise ge.GlusterVolumeReplaceBrickAbortFailedException(rc=e.rc,
- err=e.err)
-
-
-@makePublic
-def volumeReplaceBrickPause(volumeName, existingBrick, newBrick):
- command = _getGlusterVolCmd() + ["replace-brick", volumeName,
- existingBrick, newBrick, "pause"]
- try:
- _execGlusterXml(command)
- return True
- except ge.GlusterCmdFailedException, e:
- raise ge.GlusterVolumeReplaceBrickPauseFailedException(rc=e.rc,
- err=e.err)
-
-
-@makePublic
-def volumeReplaceBrickStatus(volumeName, existingBrick, newBrick):
- rc, out, err = _execGluster(_getGlusterVolCmd() + ["replace-brick",
- volumeName,
- existingBrick, newBrick,
- "status"])
- if rc:
- raise ge.GlusterVolumeReplaceBrickStatusFailedException(rc, out,
- err)
- message = "\n".join(out)
- statLine = out[0].strip().upper()
- if BrickStatus.PAUSED in statLine:
- return BrickStatus.PAUSED, message
- elif statLine.endswith('MIGRATION COMPLETE'):
- return BrickStatus.COMPLETED, message
- elif statLine.startswith('NUMBER OF FILES MIGRATED'):
- return BrickStatus.RUNNING, message
- elif statLine.endswith("UNKNOWN"):
- return BrickStatus.UNKNOWN, message
- else:
- return BrickStatus.NA, message
-
-
-@makePublic
-def volumeReplaceBrickCommit(volumeName, existingBrick, newBrick,
- force=False):
- command = _getGlusterVolCmd() + ["replace-brick", volumeName,
- existingBrick, newBrick, "commit"]
- if force:
- command.append('force')
- try:
- _execGlusterXml(command)
- return True
- except ge.GlusterCmdFailedException, e:
- raise ge.GlusterVolumeReplaceBrickCommitFailedException(rc=e.rc,
- err=e.err)
-
-
-@makePublic
def volumeRemoveBrickStart(volumeName, brickList, replicaCount=0):
command = _getGlusterVolCmd() + ["remove-brick", volumeName]
if replicaCount:
@@ -969,10 +891,7 @@
taskType = taskType.upper().replace('-', '_').replace(' ', '_')
taskId = c.find('id').text
bricks = []
- if taskType == TaskType.REPLACE_BRICK:
- bricks.append(c.find('params/srcBrick').text)
- bricks.append(c.find('params/dstBrick').text)
- elif taskType == TaskType.REMOVE_BRICK:
+ if taskType == TaskType.REMOVE_BRICK:
for b in c.findall('params/brick'):
bricks.append(b.text)
elif taskType == TaskType.REBALANCE:
diff --git a/vdsm/gluster/exception.py b/vdsm/gluster/exception.py
index 20c157e..4e9d08a 100644
--- a/vdsm/gluster/exception.py
+++ b/vdsm/gluster/exception.py
@@ -251,46 +251,6 @@
message = "Volume delete failed"
-class GlusterVolumeReplaceBrickAlreadyStartedException(GlusterVolumeException):
- code = 4141
- message = "Volume replace brick failed"
-
-
-class GlusterVolumeReplaceBrickStartFailedException(GlusterVolumeException):
- code = 4142
- message = "Volume replace brick start failed"
-
-
-class GlusterVolumeReplaceBrickNotStartedException(GlusterVolumeException):
- code = 4143
- message = "Volume replace brick not started"
-
-
-class GlusterVolumeReplaceBrickAbortFailedException(GlusterVolumeException):
- code = 4144
- message = "Volume replace brick abort failed"
-
-
-class GlusterVolumeReplaceBrickPauseFailedException(GlusterVolumeException):
- code = 4145
- message = "Volume replace brick pause failed"
-
-
-class GlusterVolumeReplaceBrickStatusFailedException(GlusterVolumeException):
- code = 4146
- message = "Volume replace brick status failed"
-
-
-class GlusterVolumeReplaceBrickInProgressException(GlusterVolumeException):
- code = 4147
- message = "Volume replace brick in progress"
-
-
-class GlusterVolumeReplaceBrickCommitFailedException(GlusterVolumeException):
- code = 4148
- message = "Volume replace brick commit failed"
-
-
class GlusterVolumesListFailedException(GlusterVolumeException):
code = 4149
message = "Volume list failed"
diff --git a/vdsm/gluster/tasks.py b/vdsm/gluster/tasks.py
index 8defd9b..f76d4a8 100644
--- a/vdsm/gluster/tasks.py
+++ b/vdsm/gluster/tasks.py
@@ -38,10 +38,6 @@
elif taskType == TaskType.REMOVE_BRICK:
data = cli.volumeRemoveBrickStatus(volumeName,
value['bricks'])
- elif taskType == TaskType.REPLACE_BRICK:
- data = cli.volumeReplaceBrickStatus(volumeName,
- value['bricks'][0],
- value['bricks'][1])
summary = data['summary'] if 'summary' in data else {}
return {"volume": volumeName,
--
To view, visit http://gerrit.ovirt.org/20060
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I23cd224ced9c6892ab182f663476df428f2f35da
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Aravinda VK <avishwan(a)redhat.com>
10 years
Change in vdsm[master]: More safe startSpm().
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: More safe startSpm().
......................................................................
More safe startSpm().
Change-Id: I1e6b32bdf1dd8dc36f6633306d4edef89d542e31
---
M vdsm/storage/sp.py
1 file changed, 16 insertions(+), 19 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/51/451/1
--
To view, visit http://gerrit.ovirt.org/451
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1e6b32bdf1dd8dc36f6633306d4edef89d542e31
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
10 years