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, 11 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, 11 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, 11 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, 11 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, 11 months
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>
9 years, 11 months
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>
9 years, 11 months
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>
9 years, 11 months
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>
9 years, 11 months
Change in vdsm[master]: [WIP] Add a releaseHostId option to stop the DomainMonitorTh...
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: [WIP] Add a releaseHostId option to stop the DomainMonitorThread
......................................................................
[WIP] Add a releaseHostId option to stop the DomainMonitorThread
Bug-Id: https://bugzilla.redhat.com/show_bug.cgi?id=851151
Change-Id: I83458fb4146de7e402606916615533da305bd867
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
M vdsm/storage/domainMonitor.py
M vdsm/storage/sp.py
2 files changed, 19 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/81/7581/1
diff --git a/vdsm/storage/domainMonitor.py b/vdsm/storage/domainMonitor.py
index 95e2f7b..c1ec5a9 100644
--- a/vdsm/storage/domainMonitor.py
+++ b/vdsm/storage/domainMonitor.py
@@ -84,14 +84,14 @@
# The domain should be added only after it succesfully started
self._domains[sdUUID] = domainThread
- def stopMonitoring(self, sdUUID):
+ def stopMonitoring(self, sdUUID, releaseHostId=False):
# The domain monitor issues events that might become raceful if
# stopMonitoring doesn't stop until the thread exits.
# Eg: when a domain is detached the domain monitor is stopped and
# the host id is released. If the monitor didn't actually exit it
# might respawn a new acquire host id.
try:
- self._domains[sdUUID].stop()
+ self._domains[sdUUID].stop(releaseHostId=releaseHostId)
except KeyError:
return
@@ -100,13 +100,15 @@
def getStatus(self, sdUUID):
return self._domains[sdUUID].getStatus()
- def close(self):
+ def close(self, releaseHostId=False):
for sdUUID in self._domains.keys():
- self.stopMonitoring(sdUUID)
+ self.stopMonitoring(sdUUID, releaseHostId=releaseHostId)
class DomainMonitorThread(object):
log = logging.getLogger('Storage.DomainMonitorThread')
+
+ RELEASE_HOSTID_DEFAULT = False
def __init__(self, sdUUID, hostId, interval):
self.thread = Thread(target=self._monitorLoop)
@@ -121,16 +123,20 @@
self.nextStatus = DomainMonitorStatus()
self.isIsoDomain = None
self.lastRefresh = time()
+ self.releaseHostId = self.RELEASE_HOSTID_DEFAULT
self.refreshTime = \
config.getint("irs", "repo_stats_cache_refresh_timeout")
def start(self):
self.thread.start()
- def stop(self, wait=True):
+ def stop(self, wait=True, releaseHostId):
+ self.releaseHostId = releaseHostId
+
self.stopEvent.set()
if wait:
self.thread.join()
+
self.domain = None
def getStatus(self):
@@ -151,13 +157,17 @@
# If this is an ISO domain we didn't acquire the host id and releasing
# it is superfluous.
- if not self.isIsoDomain:
+ if not self.isIsoDomain and self.releaseHostId:
try:
self.domain.releaseHostId(self.hostId, unused=True)
except:
self.log.debug("Unable to release the host id %s for domain "
"%s", self.hostId, self.sdUUID, exc_info=True)
+ # Resetting the releaseHostId value to its default just to be sure in
+ # case in the future we want to recycle the DomainMonitor objects.
+ self.releaseHostId = self.RELEASE_HOSTID_DEFAULT
+
def _monitorDomain(self):
self.nextStatus.clear()
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index 40de20a..e8c59f3 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -647,8 +647,8 @@
@unsecured
- def stopMonitoringDomains(self):
- self.domainMonitor.close()
+ def stopMonitoringDomains(self, releaseHostId=False):
+ self.domainMonitor.close(releaseHostId=releaseHostId)
return True
@@ -675,7 +675,7 @@
if os.path.exists(self.poolPath):
fileUtils.cleanupdir(self.poolPath)
- self.stopMonitoringDomains()
+ self.stopMonitoringDomains(releaseHostId=True)
return True
--
To view, visit http://gerrit.ovirt.org/7581
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I83458fb4146de7e402606916615533da305bd867
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
9 years, 11 months