Change in vdsm[master]: configNetwork: _updateConfigValue: Add a new line char '\n' ...
by Igor Lvovsky
Igor Lvovsky has uploaded a new change for review.
Change subject: configNetwork: _updateConfigValue: Add a new line char '\n' at the end of the line
......................................................................
configNetwork: _updateConfigValue: Add a new line char '\n' at the end of the line
This patch remove an empty line from the middle of iface
config file when removing network with custom MTU.
Example:
---------
[root@zeus02 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth3
DEVICE=eth3
ONBOOT=yes
HWADDR=78:ac:c0:11:79:79
NM_CONTROLLED=no
STP=no
MTU=9000[root@zeus02 ~]#
Change-Id: I6030f0c92a2f3f2572b52cc48df6198da5cd2847
Signed-off-by: Igor Lvovsky <ilvovsky(a)redhat.com>
---
M vdsm/configNetwork.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/88/7688/1
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 74d19c7..20f1136 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -558,7 +558,7 @@
if not line.startswith(entry + '=') ]
if not delete:
- entries.append('\n' + entry + '=' + value)
+ entries.append(entry + '=' + value + '\n')
self._backup(conffile)
with open(conffile, 'w') as f:
--
To view, visit http://gerrit.ovirt.org/7688
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6030f0c92a2f3f2572b52cc48df6198da5cd2847
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Igor Lvovsky <ilvovsky(a)redhat.com>
11 years, 4 months
Change in vdsm[master]: BZ#836161 - Remove preDeleteRename().
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: BZ#836161 - Remove preDeleteRename().
......................................................................
BZ#836161 - Remove preDeleteRename().
Change-Id: I2452594c701eb9c3ccbab7de92e8fca69f033074
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/image.py
M vdsm/storage/sp.py
2 files changed, 0 insertions(+), 35 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/08/8508/1
diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py
index 9a22863..5871c3a 100644
--- a/vdsm/storage/image.py
+++ b/vdsm/storage/image.py
@@ -214,37 +214,6 @@
randomStr = misc.randomStr(RENAME_RANDOM_STRING_LEN)
return "%s%s_%s" % (REMOVED_IMAGE_PREFIX, randomStr, uuid)
- def preDeleteRename(self, sdUUID, imgUUID):
- # Get the list of the volumes
- volclass = sdCache.produce(sdUUID).getVolumeClass()
- uuidlist = volclass.getImageVolumes(self.repoPath, sdUUID, imgUUID)
- imageDir = self.getImageDir(sdUUID, imgUUID)
-
- # If image directory doesn't exist we are done
- if not os.path.exists(imageDir):
- return imgUUID
-
- # Otherwise move it out of the way
- newImgUUID = self.deletedVolumeName(imgUUID)
- self.log.info("Rename image %s -> %s", imgUUID, newImgUUID)
- if not imgUUID.startswith(REMOVED_IMAGE_PREFIX):
- removedImage = os.path.join(os.path.dirname(imageDir), newImgUUID)
- os.rename(imageDir, removedImage)
- else:
- self.log.warning("Image %s in domain %s already renamed", imgUUID, sdUUID)
-
- volumes = [volclass(self.repoPath, sdUUID, newImgUUID, volUUID) for volUUID in uuidlist]
- for vol in volumes:
- if not vol.volUUID.startswith(REMOVED_IMAGE_PREFIX):
- vol.rename(self.deletedVolumeName(vol.volUUID), recovery=False)
- else:
- self.log.warning("Volume %s of image %s already renamed", vol.volUUID, imgUUID)
- # We change image UUID in metadata
- # (and IU_ LV tag for block volumes) of all volumes in image
- vol.setImage(newImgUUID)
-
- return newImgUUID
-
def __chainSizeCalc(self, sdUUID, imgUUID, volUUID, size):
"""
Compute an estimate of the whole chain size
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index 0ade40d..115f575 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -1942,10 +1942,6 @@
except:
self.log.warning("SP %s SD %s img %s Vol %s - teardown failed")
- def preDeleteRename(self, sdUUID, imgUUID):
- repoPath = os.path.join(self.storage_repository, self.spUUID)
- return image.Image(repoPath).preDeleteRename(sdUUID, imgUUID)
-
def validateVolumeChain(self, sdUUID, imgUUID):
repoPath = os.path.join(self.storage_repository, self.spUUID)
image.Image(repoPath).validateVolumeChain(sdUUID, imgUUID)
--
To view, visit http://gerrit.ovirt.org/8508
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2452594c701eb9c3ccbab7de92e8fca69f033074
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
11 years, 4 months
Change in vdsm[master]: enable task tag as list of strings
by barumuga@redhat.com
Hello Ayal Baron, Timothy Asir, Saggi Mizrahi, Federico Simoncelli, Dan Kenigsberg,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/8899
to review the following change.
Change subject: enable task tag as list of strings
......................................................................
enable task tag as list of strings
Multiple tags are stored as space-separated string and search is done
an in-string search instead of a proper set membership. This approach
enables tag as list of strings and supports backward compatibility
Change-Id: Ib3c6f8cba17df7f545049eabe2b8f38318c5db7f
Signed-off-by: Bala.FA <barumuga(a)redhat.com>
---
M vdsm/storage/task.py
1 file changed, 14 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/99/8899/1
diff --git a/vdsm/storage/task.py b/vdsm/storage/task.py
index a596494..6c79c85 100644
--- a/vdsm/storage/task.py
+++ b/vdsm/storage/task.py
@@ -49,6 +49,7 @@
import logging
import threading
import types
+import ast
import storage_exception as se
import uuid
@@ -411,13 +412,22 @@
high = "high"
+class TagList(list):
+ def __init__(self, s):
+ if s.startswith('[') and s.endswith(']'):
+ l = ast.literal_eval(s)
+ else:
+ l = s.split(' ')
+ list.__init__(self, l)
+
+
class Task:
# External Task info
fields = {
# field_name: type
"id": str,
"name": unicode,
- "tag": unicode,
+ "tag": TagList,
"store": unicode,
"recoveryPolicy": TaskRecoveryType,
"persistPolicy": TaskPersistType,
@@ -448,7 +458,7 @@
self.callbackLock = threading.Lock()
self.id = str(id)
self.name = name
- self.tag = tag
+ self.tag = TagList(tag)
self.priority = priority
self.recoveryPolicy = recovery
self.persistPolicy = TaskPersistType.none
@@ -972,7 +982,7 @@
def setTag(self, tag):
if KEY_SEPERATOR in tag:
raise ValueError("tag cannot include %s character" % KEY_SEPERATOR)
- self.tag = unicode(tag)
+ self.tag = TagList(unicode(tag))
def isDone(self):
return self.state.isDone()
@@ -1257,7 +1267,7 @@
"code": self.result.code,
"message": self.result.message,
"result": self.result.result,
- "tag": self.tag
+ "tag": str(self.tag)
}
def getID(self):
--
To view, visit http://gerrit.ovirt.org/8899
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib3c6f8cba17df7f545049eabe2b8f38318c5db7f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Bala.FA <barumuga(a)redhat.com>
Gerrit-Reviewer: Ayal Baron <abaron(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>
Gerrit-Reviewer: Timothy Asir <tjeyasin(a)redhat.com>
11 years, 5 months
Change in vdsm[master]: Expose a custom property for tunnelled migration of a VM
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: Expose a custom property for tunnelled migration of a VM
......................................................................
Expose a custom property for tunnelled migration of a VM
Change-Id: Id713b455db4f9bf437720b64c92bba9377cd89ae
---
M vdsm/libvirtvm.py
1 file changed, 9 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/51/2551/1
--
To view, visit http://gerrit.ovirt.org/2551
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id713b455db4f9bf437720b64c92bba9377cd89ae
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
11 years, 5 months
Change in vdsm[master]: Add lvm.lvPhysDev() to get the physical LV device.
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: Add lvm.lvPhysDev() to get the physical LV device.
......................................................................
Add lvm.lvPhysDev() to get the physical LV device.
Change-Id: I6d3286589ea02025713d10d85a9892024f586b73
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/lvm.py
1 file changed, 10 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/51/8751/1
diff --git a/vdsm/storage/lvm.py b/vdsm/storage/lvm.py
index 78c846a..094569d 100644
--- a/vdsm/storage/lvm.py
+++ b/vdsm/storage/lvm.py
@@ -1156,6 +1156,16 @@
def lvPath(vgName, lvName):
return os.path.join("/dev", vgName, lvName)
+def lvPhysDev(vgName, lvName):
+ """Return the LV physical device.
+
+ returns: dm-X
+ The LV should be active.
+ """
+
+ lvp = lvPath(vgName, lvName)
+ return os.path.basename(os.readlink(lvp))
+
def _isLVActive(vgName, lvName):
"""Active volumes have a mp link.
--
To view, visit http://gerrit.ovirt.org/8751
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6d3286589ea02025713d10d85a9892024f586b73
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
11 years, 5 months
Change in vdsm[master]: [RFC] Support for GLUSTERFS_DOMAIN
by deepakcs@linux.vnet.ibm.com
Deepak C Shetty has uploaded a new change for review.
Change subject: [RFC] Support for GLUSTERFS_DOMAIN
......................................................................
[RFC] Support for GLUSTERFS_DOMAIN
This patch introduces a new storage domain of type
GLUSTERFS_DOMAIN, which uses gluster as the storage backend.
In GLUSTERFS_DOMAIN, vdsm creates the storage domain by mounting
the gluster volume (akin to nfs mounting export path). VMs
created using this domain exploit the QEMU's gluster block
backend. Instead of accessing the vmdisk as a file path, it
accesses the vmdisk as a network disk device, served by gluster
server/volume.
This patch attempts to re-use nfsSD core logic to support
domain of type GLUSTERFS_DOMAIN.
Also has some changes to pass pep8 checks
Change-Id: I9ac37da88625f20d148beaf53bb6371c15b33ad7
Signed-off-by: Deepak C Shetty <deepakcs(a)linux.vnet.ibm.com>
---
M vdsm.spec.in
M vdsm/API.py
M vdsm/BindingXMLRPC.py
M vdsm/libvirtvm.py
M vdsm/storage/Makefile.am
M vdsm/storage/fileSD.py
A vdsm/storage/glusterVolume.py
M vdsm/storage/hsm.py
M vdsm/storage/nfsSD.py
M vdsm/storage/sd.py
M vdsm/storage/volume.py
M vdsm/vm.py
12 files changed, 124 insertions(+), 34 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/56/6856/1
--
To view, visit http://gerrit.ovirt.org/6856
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9ac37da88625f20d148beaf53bb6371c15b33ad7
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Deepak C Shetty <deepakcs(a)linux.vnet.ibm.com>
11 years, 5 months
Change in vdsm[master]: [WIP] BZ#748386 - refactor qemuConvert to only use qemu-img ...
by lyarwood@redhat.com
Lee Yarwood has uploaded a new change for review.
Change subject: [WIP] BZ#748386 - refactor qemuConvert to only use qemu-img convert.
......................................................................
[WIP] BZ#748386 - refactor qemuConvert to only use qemu-img convert.
This change refactors the qemuConvert method, dropping the use of dd with RAW volumes in favour of qemu-img
convert thus preserving sparseness. The change also introduces the use of the backing_file and backing_fmt
options when converting COW volumes.
Change-Id: I7adc41e8a9f5d4b9faa58a8cf5bec685b66e303e
Signed-off-by: Lee Yarwood <lyarwood(a)redhat.com>
---
M vdsm/storage/image.py
M vdsm/storage/volume.py
2 files changed, 25 insertions(+), 38 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/28/8728/1
diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py
index e86d94c..69ab6b6 100644
--- a/vdsm/storage/image.py
+++ b/vdsm/storage/image.py
@@ -788,19 +788,9 @@
try:
# Start the actual copy image procedure
- srcVol.prepare(rw=False)
+ srcVol.prepare(rw=True, chainrw=True, setrw=True)
dstVol.prepare(rw=True, setrw=True)
-
- try:
- (rc, out, err) = volume.qemuConvert(volParams['path'], dstPath,
- volParams['volFormat'], dstVolFormat, vars.task.aborting,
- size=srcVol.getVolumeSize(bs=1), dstvolType=dstVol.getType())
- if rc:
- raise se.StorageException("rc: %s, err: %s" % (rc, err))
- except se.ActionStopped, e:
- raise e
- except se.StorageException, e:
- raise se.CopyImageError(str(e))
+ (rc, out, err) = volume.qemuConvert(srcVol, dstVol, self.idle, vars.task.aborting)
# Mark volume as SHARED
if volType == volume.SHARED_VOL:
@@ -997,12 +987,12 @@
# Step 2: Convert successor to new volume
# qemu-img convert -f qcow2 successor -O raw newUUID
- (rc, out, err) = volume.qemuConvert(srcVolParams['path'], newVol.getVolumePath(),
- srcVolParams['volFormat'], volParams['volFormat'], vars.task.aborting,
- size=volParams['apparentsize'], dstvolType=newVol.getType())
- if rc:
- self.log.error("qemu-img convert failed: rc=%s, out=%s, err=%s",
- rc, out, err)
+ try:
+ (rc, out, err) = volume.qemuConvert(srcVol, newVol, self.idle, vars.task.aborting)
+ except se.ActionStopped:
+ raise
+ except se.StorageException:
+ self.log.error("Unexpected error", exc_info=True)
raise se.MergeSnapshotsError(newUUID)
newVol.teardown(sdUUID=newVol.sdUUID, volUUID=newVol.volUUID)
diff --git a/vdsm/storage/volume.py b/vdsm/storage/volume.py
index b9eb356..875b59a 100644
--- a/vdsm/storage/volume.py
+++ b/vdsm/storage/volume.py
@@ -960,28 +960,25 @@
log.debug('(qemuRebase): REBASE %s DONE' % (src))
return (rc, out, err)
+def qemuConvert(src, dst, idle, stop):
+ """
+ Copy the src image into the new dst.
+ """
+ cmd = constants.CMD_LOWPRIO + [constants.EXT_QEMUIMG, "convert", "-t", "none",
+ "-f", fmt2str(src.getFormat()), "-O", fmt2str(dst.getFormat())]
-def qemuConvert(src, dst, src_fmt, dst_fmt, stop, size, dstvolType):
- """
- Convert the 'src' image (or chain of images) into a new single 'dst'
- """
- src_fmt = fmt2str(src_fmt)
- dst_fmt = fmt2str(dst_fmt)
- log.debug('(qemuConvert): COPY %s (%s) to %s (%s) START' %
- (src, src_fmt, dst, dst_fmt))
+ # backing_file only used when src has a parent and both volumes are COW.
+ if src.getParentVolume() and src.getFormat() == COW_FORMAT and dst.getFormat() == COW_FORMAT :
+ cmd += ["-o", "backing_file=%s,backing_fmt=%s" % (src.getParentVolume().getVolumePath(),
+ fmt2str(src.getParentVolume().getFormat()))]
- if (src_fmt == "raw" and dst_fmt == "raw" and
- dstvolType == PREALLOCATED_VOL):
- (rc, out, err) = misc.ddWatchCopy(
- src=src, dst=dst,
- stop=stop, size=size,
- recoveryCallback=baseAsyncTasksRollback)
- else:
- cmd = constants.CMD_LOWPRIO + [constants.EXT_QEMUIMG, "convert",
- "-t", "none", "-f", src_fmt, src,
- "-O", dst_fmt, dst]
- (rc, out, err) = misc.watchCmd(cmd, stop=stop,
+ cmd += [src.getVolumePath(), dst.getVolumePath()]
+
+ (rc, out, err) = misc.watchCmd(cmd, stop=stop, idle=idle, sudo=False,
recoveryCallback=baseAsyncTasksRollback)
- log.debug('(qemuConvert): COPY %s to %s DONE' % (src, dst))
+ if rc:
+ raise se.StorageException
+
return (rc, out, err)
+
--
To view, visit http://gerrit.ovirt.org/8728
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7adc41e8a9f5d4b9faa58a8cf5bec685b66e303e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Lee Yarwood <lyarwood(a)redhat.com>
11 years, 5 months
Change in vdsm[master]: Extract bonding options building into a separate function.
by wudxw@linux.vnet.ibm.com
Mark Wu has uploaded a new change for review.
Change subject: Extract bonding options building into a separate function.
......................................................................
Extract bonding options building into a separate function.
To make setupNetworks shorter, move the bonding options building code
into a separate function.
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
Change-Id: I77fefefcefa05f5bd0d7fa2755357d88b7aa615e
---
M vdsm/configNetwork.py
1 file changed, 30 insertions(+), 27 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/85/8885/1
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 3940446..6de38e3 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -1249,6 +1249,30 @@
del bondings[bond]
+def _buildBondOptions(bondName, bondings):
+ logger = logging.getLogger("_buildBondOptions")
+
+ # We need to use the newest host info
+ _ni = netinfo.NetInfo()
+
+ bond = {}
+ if bondings.get(bondName):
+ bond['nics'] = bondings[bondName]['nics']
+ bond['bondingOptions'] = bondings[bondName].get('options', None)
+ elif bondName in _ni.bondings:
+ # We may not receive any information about the bonding device if it is
+ # unchanged. In this case check whether this bond exists on host and
+ # take its parameters.
+ logger.debug("Fetching bond %r info", bondName)
+ existingBond = _ni.bondings[bondName]
+ bond['nics'] = existingBond['slaves']
+ bond['bondingOptions'] = existingBond['cfg'].get('BONDING_OPTS', None)
+ else:
+ raise ConfigNetworkError(ne.ERR_BAD_PARAMS, "No given bonding option, \
+ nor existing bond %s found." % bondName)
+ return bond
+
+
def setupNetworks(networks={}, bondings={}, **options):
"""Add/Edit/Remove configuration for networks and bondings.
@@ -1292,12 +1316,6 @@
_netinfo = netinfo.NetInfo()
configWriter = ConfigWriter()
networksAdded = set()
- # keep set netsWithNewBonds to be able remove
- # a new added network if connectivity check fail.
- # If a new network needs to be created on top of existing bond,
- # we will need to keep the bond on rollback flow,
- # else we will break the new created bond.
- netsWithNewBonds = set()
logger.debug("Setting up network according to configuration: "
"networks:%r, bondings:%r, options:%r" % (networks,
@@ -1327,28 +1345,10 @@
# Check whether bonds should be resized
_editBondings(bondings, configWriter)
- # We need to use the newest host info
- _ni = netinfo.NetInfo()
for network, networkAttrs in networks.iteritems():
d = dict(networkAttrs)
if 'bonding' in d:
- # we may not receive any information
- # about the bonding device if it is unchanged
- # In this case check whether this bond exists
- # on host and take its parameters
- if bondings.get(d['bonding']):
- d['nics'] = bondings[d['bonding']]['nics']
- d['bondingOptions'] = \
- bondings[d['bonding']].get('options', None)
- # we create a new bond
- if network in networksAdded:
- netsWithNewBonds.add(network)
- elif d['bonding'] in _ni.bondings:
- logger.debug("Updating bond %r info", d['bonding'])
- d['nics'] = _ni.bondings[d['bonding']]['slaves']
- d['bondingOptions'] = \
- _ni.bondings[d['bonding']]['cfg'].get(
- 'BONDING_OPTS', None)
+ d.update(_buildBondOptions(d['bonding'], bondings))
else:
d['nics'] = [d.pop('nic')]
d['force'] = force
@@ -1363,8 +1363,11 @@
CONNECTIVITY_TIMEOUT_DEFAULT))):
logger.info('Connectivity check failed, rolling back')
for network in networksAdded:
- delNetwork(network, force=True,
- implicitBonding=network in netsWithNewBonds)
+ # If the new added network was created on top of
+ # existing bond, we need to keep the bond on rollback
+ # flow, else we will break the new created bond.
+ isNew = networkAttrs['bonding'] in bondings
+ delNetwork(network, force=True, implicitBonding=isNew)
raise ConfigNetworkError(ne.ERR_LOST_CONNECTION,
'connectivity check failed')
except:
--
To view, visit http://gerrit.ovirt.org/8885
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I77fefefcefa05f5bd0d7fa2755357d88b7aa615e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <wudxw(a)linux.vnet.ibm.com>
11 years, 5 months
Change in vdsm[master]: Adding new resourceFactory that only opens fd
by ybronhei@redhat.com
Yaniv Bronhaim has uploaded a new change for review.
Change subject: Adding new resourceFactory that only opens fd
......................................................................
Adding new resourceFactory that only opens fd
Avoiding activate every time we try to access lv and only open fd
instead. This replace the refCounter and the call to lvchange anytime we
prepare volume.
Change-Id: Ic936c8959562a262de5ceba8ca4f68bc53b5cae2
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
---
M vdsm/storage/blockVolume.py
M vdsm/storage/resourceFactories.py
2 files changed, 51 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/84/8084/1
diff --git a/vdsm/storage/blockVolume.py b/vdsm/storage/blockVolume.py
index 38285c1..2324ee7 100644
--- a/vdsm/storage/blockVolume.py
+++ b/vdsm/storage/blockVolume.py
@@ -35,7 +35,7 @@
import resourceManager as rm
from threadLocal import vars
from sdc import sdCache
-from resourceFactories import LVM_ACTIVATION_NAMESPACE
+import resourceFactories as rf
import fileUtils
TAG_PREFIX_MD = "MD_"
@@ -75,8 +75,22 @@
def __init__(self, repoPath, sdUUID, imgUUID, volUUID):
self.metaoff = None
volume.Volume.__init__(self, repoPath, sdUUID, imgUUID, volUUID)
- self.lvmActivationNamespace = sd.getNamespace(self.sdUUID,
- LVM_ACTIVATION_NAMESPACE)
+ self._registerResourceNamespaces(sdUUID,volUUID)
+
+ def _registerResourceNamespaces(self, sdUUID, volUUID):
+ """
+ Register resources namespaces and create
+ factories for it.
+ """
+ rmanager = rm.ResourceManager.getInstance()
+ # Register lvm activation resource namespace for the underlying VG
+ volWatcherFactory = rf.VolumeWatcherFactory(sdUUID, volUUID)
+ self.volWatcherNamespace = rf.VOLUME_WATCHER_NAMESPACE
+ try:
+ rmanager.registerNamespace(self.volWatcherNamespace, volWatcherFactory)
+ except Exception:
+ self.log.warn("Resource namespace %s already registered", self.volWatcherNamespace)
+
def validate(self):
try:
@@ -356,8 +370,14 @@
if setrw:
self.setrw(rw=rw)
access = rm.LockType.exclusive if rw else rm.LockType.shared
- activation = rmanager.acquireResource(self.lvmActivationNamespace,
+
+ # active volume
+ self.activateVolumes(self.volUUID)
+
+ # acquireResource - open file
+ activation = rmanager.acquireResource(self.volWatcherNamespace,
self.volUUID, access)
+
activation.autoRelease = False
@classmethod
@@ -369,9 +389,10 @@
"""
cls.log.info("Tearing down volume %s/%s justme %s"
% (sdUUID, volUUID, justme))
- lvmActivationNamespace = sd.getNamespace(sdUUID,
- LVM_ACTIVATION_NAMESPACE)
- rmanager.releaseResource(lvmActivationNamespace, volUUID)
+
+ cls.deactivateVolumes(volUUID)
+
+ rmanager.releaseResource(cls.volWatcherNamespace, volUUID)
if not justme:
try:
pvolUUID = _getVolumeTag(sdUUID, volUUID, TAG_PREFIX_PARENT)
diff --git a/vdsm/storage/resourceFactories.py b/vdsm/storage/resourceFactories.py
index 02aba0f..8893f70 100644
--- a/vdsm/storage/resourceFactories.py
+++ b/vdsm/storage/resourceFactories.py
@@ -31,11 +31,34 @@
LVM_ACTIVATION_NAMESPACE = 'lvmActivationNS'
IMAGE_NAMESPACE = 'imageNS'
VOLUME_NAMESPACE = 'volumeNS'
+VOLUME_WATCHER_NAMESPACE = 'volWatchNS'
rmanager = rm.ResourceManager.getInstance()
log = logging.getLogger('Storage.ResourcesFactories')
+class VolumeWatcher(object):
+ def __init__(self, vgName, lvName):
+ self._path = lvm.lvPath(vgName, lvName)
+ try:
+ self._f = open(self._path)
+ except IOError:
+ log.error("Cannot open device %s", self._path)
+
+ def close(self):
+ try:
+ self._f.close()
+ except:
+ log.error("error closing device %s", self._path)
+
+class VolumeWatcherFactory(rm.SimpleResourceFactory):
+ def __init__(self, vgName, lvName):
+ rm.SimpleResourceFactory.__init__(self)
+ self._lv = lvName
+ self._vg = vgName
+
+ def createResource(self):
+ return VolumeWatcher(self._lv, self._vg)
class LvmActivation(object):
"""
--
To view, visit http://gerrit.ovirt.org/8084
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic936c8959562a262de5ceba8ca4f68bc53b5cae2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
11 years, 5 months
Change in vdsm[master]: prepare volume instead of prepare blockSD
by ybronhei@redhat.com
Yaniv Bronhaim has uploaded a new change for review.
Change subject: prepare volume instead of prepare blockSD
......................................................................
prepare volume instead of prepare blockSD
Bug-Id: https://bugzilla.redhat.com/show_bug.cgi?id=851837
change the call of activateVolume to llprepare volume, and
teardown instead of deactiveVolume, which sperates lv
syscall operation to only verifies that the lv is in used as
part of the volume. If the sd is in use by the checked volume,
we want to keep ref counter to sign this volume, and when we
teardown it, we verify that there are no references to the same
sd before deactivate it.
Change-Id: I25b9c260a7de5f883420a5322f90195b3379e80e
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
---
M vdsm/storage/image.py
1 file changed, 2 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/50/8050/1
diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py
index d004046..97112dc 100644
--- a/vdsm/storage/image.py
+++ b/vdsm/storage/image.py
@@ -383,8 +383,7 @@
chain.insert(0, tmplVolume)
# Activating the volumes
- sdCache.produce(sdUUID).activateVolumes(
- volUUIDs=[vol.volUUID for vol in chain])
+ sdCache.produce(sdUUID).llPrepare()
return chain
@@ -392,11 +391,8 @@
chain = self.getChain(sdUUID, imgUUID, volUUID)
# Deactivating the volumes
- sdCache.produce(sdUUID).deactivateVolumes(
- volUUIDs=[vol.volUUID for vol in chain])
-
# Do not deactivate the template yet (might be in use by an other vm)
- # TODO: reference counting to deactivate when unused
+ sdCache.produce(sdUUID).teardown(sdUUID, volUUIDs=[vol.volUUID for vol in chain])
def __templateRelink(self, destDom, imgUUID, volUUID):
"""
--
To view, visit http://gerrit.ovirt.org/8050
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I25b9c260a7de5f883420a5322f90195b3379e80e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
11 years, 5 months