[NEW PATCH] Related BZ#720911 - change class name from LVMInfo LVMCache (via gerrit-bot)
by smizrahi@redhat.com
New patch submitted by Saggi Mizrahi (smizrahi(a)redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/736
commit d0020c5bed9663da6c1cd25e9985b53615a13b9d
Author: Saggi Mizrahi <smizrahi(a)redhat.com>
Date: Sun Jul 24 18:48:46 2011 +0300
Related BZ#720911 - change class name from LVMInfo LVMCache
Change-Id: I14e5faede14285fce69666c8295976d7155a3f6c
diff --git a/vdsm/storage/lvm.py b/vdsm/storage/lvm.py
index 600a50f..f427677 100644
--- a/vdsm/storage/lvm.py
+++ b/vdsm/storage/lvm.py
@@ -322,7 +322,7 @@ def makeLV(*args):
return LV(*args)
-class LVMInfo(object):
+class LVMCache(object):
"""
Keep all the LVM information.
"""
@@ -647,7 +647,7 @@ class LVMInfo(object):
return lvs.values()
-_lvminfo = LVMInfo()
+_lvminfo = LVMCache()
def _vgmknodes(vg):
cmd = ["vgmknodes", vg]
12 years, 9 months
[NEW PATCH] BZ#720257 - Don't produce domain on teardown (via gerrit-bot)
by smizrahi@redhat.com
New patch submitted by Saggi Mizrahi (smizrahi(a)redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/724
commit 09c7acb7099810e7730055e8715e0f4b2f7be780
Author: Saggi Mizrahi <smizrahi(a)redhat.com>
Date: Mon Jul 18 16:23:28 2011 +0300
BZ#720257 - Don't produce domain on teardown
Change-Id: Iaf3311790a7927e3bf3d5e7a4820462d213bcdb6
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index a6de936..4154724 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -18,6 +18,7 @@ from fnmatch import fnmatch
from copy import deepcopy
from config import config
from itertools import imap
+from collections import defaultdict
import sp
import sd
@@ -139,6 +140,8 @@ class HSM:
self._cachedStats = {}
self._statslock = threading.Lock()
+ self._preparedResources = defaultdict(list)
+
if not iscsi.isConfigured():
iscsi.setupiSCSI()
@@ -166,7 +169,6 @@ class HSM:
for spUUID in dirList:
poolPath = os.path.join(self.storage_repository, spUUID)
try:
- vars.task.getSharedLock(STORAGE, spUUID)
if os.path.exists(poolPath):
self._restorePool(spUUID)
#TODO Once we support simultaneous connection to multiple pools, remove following line (break)
@@ -1662,19 +1664,12 @@ class HSM:
vars.task.getSharedLock(STORAGE, sdUUID)
imageResourcesNamespace = sd.getNamespace(sdUUID, IMAGE_NAMESPACE)
- imgResource = rmanager.acquireResource(imageResourcesNamespace, imgUUID, rm.LockType.exclusive)
- imgResource.autoRelease = False
- try:
- vol = SDF.produce(sdUUID=sdUUID).produceVolume(imgUUID=imgUUID, volUUID=volUUID)
- # NB We want to be sure that at this point HSM does not use stale LVM
- # cache info, so we call refresh explicitely. We may want to remove
- # this refresh later, when we come up with something better.
- vol.refreshVolume()
- vol.prepare(rw=rw)
- except:
- self.log.error("Prepare volume %s in domain %s failed", volUUID, sdUUID, exc_info=True)
- rmanager.releaseResource(imageResourcesNamespace, imgUUID)
- raise
+ lockType = rm.LockType.exclusive
+ if not rw:
+ lockType = rm.LockType.shared
+
+ imgResource = rmanager.acquireResource(imageResourcesNamespace, imgUUID, lockType)
+ self._preparedVolumes[sdUUID + volUUID].append(imgResource)
def public_teardownVolume(self, sdUUID, spUUID, imgUUID, volUUID, rw=False, options = None):
@@ -1694,14 +1689,13 @@ class HSM:
:type rw: bool
:param options: ?
"""
- self.validatePoolSD(spUUID, sdUUID)
-
vars.task.getSharedLock(STORAGE, sdUUID)
- volclass = SDF.produce(sdUUID).getVolumeClass()
- volclass.teardown(sdUUID=sdUUID, volUUID=volUUID)
- imageResourcesNamespace = sd.getNamespace(sdUUID, IMAGE_NAMESPACE)
- rmanager.releaseResource(imageResourcesNamespace, imgUUID)
+ try:
+ imgResource = self._preparedVolumes[sdUUID + volUUID].pop()
+ except IndexError:
+ raise se.VolumeWasNotPreparedBeforeTeardown()
+ imgResource.release()
def public_getVolumesList(self, sdUUID, spUUID, imgUUID=volume.BLANK_UUID, options = None):
"""
diff --git a/vdsm/storage/resourceFactories.py b/vdsm/storage/resourceFactories.py
index ce3ec70..99990c8 100644
--- a/vdsm/storage/resourceFactories.py
+++ b/vdsm/storage/resourceFactories.py
@@ -36,7 +36,14 @@ class LvmActivation(object):
def __init__(self, vg, lv, lockType):
self._vg = vg
self._lv = lv
+
lvm.activateLVs(self._vg, self._lv)
+ rw = self._translateLockType(lockType)
+ lvm.setrwLV(self._vg, self._lv, rw)
+
+ @staticmethod
+ def _translateLockType(lockType):
+ return False if lockType == rm.LockType.shared else True
def close(self):
try:
@@ -48,7 +55,7 @@ class LvmActivation(object):
log.warn("Failure deactivate LV %s/%s (%s)", self._vg, self._lv, e)
def switchLockType(self, lockType):
- rw = False if lockType == rm.LockType.shared else True
+ rw = self._translateLockType(lockType)
lvm.setrwLV(self._vg, self._lv, rw)
diff --git a/vdsm/storage/storage_exception.py b/vdsm/storage/storage_exception.py
index c9df109..1496bbc 100644
--- a/vdsm/storage/storage_exception.py
+++ b/vdsm/storage/storage_exception.py
@@ -245,6 +245,10 @@ class createVolumeSizeError(StorageException):
code = 229
message = "Requested size is too small. Must be larger or equal to 1"
+class VolumeWasNotPreparedBeforeTeardown(StorageException):
+ code = 230
+ message = "Volume was not prepared before being torn down"
+
#################################################
# Images Exceptions
#################################################
12 years, 9 months
[NEW PATCH] Related BZ#720911 - Read user defincd device only once (via gerrit-bot)
by smizrahi@redhat.com
New patch submitted by Saggi Mizrahi (smizrahi(a)redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/735
commit 0081046940d86f1b86d387213b38e63ea1653027
Author: Saggi Mizrahi <smizrahi(a)redhat.com>
Date: Sun Jul 24 18:54:14 2011 +0300
Related BZ#720911 - Read user defincd device only once
Change-Id: Id0a36cf53d6497ab19f3d1c02a9375cd0d1fead5
diff --git a/vdsm/storage/lvm.py b/vdsm/storage/lvm.py
index ef60c02..600a50f 100644
--- a/vdsm/storage/lvm.py
+++ b/vdsm/storage/lvm.py
@@ -200,13 +200,13 @@ VAR_RUN_VDSM = constants.P_VDSM_RUN
VDSM_LVM_SYSTEM_DIR = os.path.join(VAR_RUN_VDSM, "lvm")
VDSM_LVM_CONF = os.path.join(VDSM_LVM_SYSTEM_DIR, "lvm.conf")
+try:
+ USER_DEV_LIST = config.config.get("irs", "lvm_dev_whitelist").split(",")
+except config.ConfigParser.Error:
+ USER_DEV_LIST = []
def buildFilter(autodevList):
- try:
- userDevList = config.config.get("irs", "lvm_dev_whitelist").split(",")
- except config.ConfigParser.Error:
- userDevList = []
- devList = userDevList + autodevList
+ devList = USER_DEV_LIST + autodevList
devList.sort()
filt = '|'.join([dev.strip() for dev in devList if dev.strip()])
if len(filt) > 0:
12 years, 9 months
Change in vdsm[master]: BZ#????? - one process pool to rule them all
by erez@redhat.com
Erez Sh has posted comments on this change.
Change subject: BZ#????? - one process pool to rule them all
......................................................................
Patch Set 1: I would prefer that you didn't submit this
Please comment on why you pre-create the Helper()s
--
To view, visit http://gerrit.usersys/744
To unsubscribe, visit http://gerrit.usersys/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia69071a049761b271a982c600cf0520a782c7eac
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi(a)redhat.com>
Gerrit-Reviewer: Ayal Baron
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Eduardo Warszawski <ewarszaw(a)redhat.com>
Gerrit-Reviewer: Erez Sh <erez(a)redhat.com>
Gerrit-Reviewer: Igor Lvovsky <ilvovsky(a)redhat.com>
12 years, 9 months
[NEW PATCH] BZ#723198 - Add timeout to migration: abort it if no progress has been made in a while (via gerrit-bot)
by erez@redhat.com
New patch submitted by Erez Sh (erez(a)redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/732
commit 64f1f3b58dd740ba736d1279137f05da2462c18c
Author: Erez Sh <erez(a)redhat.com>
Date: Tue Jul 19 17:12:10 2011 +0300
BZ#723198 - Add timeout to migration: abort it if no progress has been made in a while
Change-Id: If2eef2e38adbc5f187a51fa0caff8566af76e812
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index 21961c2..318080a 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -222,13 +222,28 @@ class MigrationMonitorThread(threading.Thread):
def run(self):
self._vm.log.debug('starting migration monitor thread')
+ lastProgressTime = time.time()
+ smallest_dataRemaining = None
+
while not self._stop.isSet():
self._stop.wait(self._MIGRATION_MONITOR_INTERVAL)
jobType, timeElapsed, _, \
- dataTotal, dataProcessed, _, \
+ dataTotal, dataProcessed, dataRemaining, \
memTotal, memProcessed, _, \
fileTotal, fileProcessed, _ = self._vm._dom.jobInfo()
+ if smallest_dataRemaining is None or smallest_dataRemaining > dataRemaining:
+ smallest_dataRemaining = dataRemaining
+ lastProgressTime = time.time()
+ elif time.time() - lastProgressTime > config.getint('vars', 'migration_timeout'):
+ # Migration is stuck, abort
+ self._vm.log.warn(
+ 'Migration is stuck: Hasn\'t progressed in %s seconds. Aborting.' % (time.time() - lastProgressTime)
+ )
+ self._vm._dom.abortJob()
+ self.stop()
+ break
+
if jobType == 0:
continue
@@ -240,6 +255,7 @@ class MigrationMonitorThread(threading.Thread):
% (timeElapsed/1000,dataProgress,memProgress)
)
+
def stop(self):
self._vm.log.debug('stopping migration monitor thread')
self._stop.set()
12 years, 9 months
Change in vdsm[master]: task.py: use LoggerAdapter
by erez@redhat.com
Erez Sh has posted comments on this change.
Change subject: task.py: use LoggerAdapter
......................................................................
Patch Set 1: Looks good to me, but someone else must approve
--
To view, visit http://gerrit.usersys/708
To unsubscribe, visit http://gerrit.usersys/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia7a6e1a7de796bbafb45597221e83c7419ce69c8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Erez Sh <erez(a)redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>
12 years, 9 months
[NEW PATCH] Use system-uuid parameter in dmidecode command (via gerrit-bot)
by Federico Simoncelli
New patch submitted by Federico Simoncelli (fsimonce(a)redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/720
commit b29b79bf23c41d97ff8c226b06aed5656aaa554d
Author: Federico Simoncelli <fsimonce(a)redhat.com>
Date: Mon Jul 18 09:31:08 2011 +0000
Use system-uuid parameter in dmidecode command
Change-Id: Id569873cadf794ea97aa95c3e1f775b2e7bce049
diff --git a/vdsm/constants.py b/vdsm/constants.py
index ae9a79b..0819f3a 100644
--- a/vdsm/constants.py
+++ b/vdsm/constants.py
@@ -51,7 +51,6 @@ P_VDSM_LOG = '@VDSMLOGDIR@'
# External programs (sorted, please keep in order).
#
EXT_ADDNETWORK = P_VDSM + 'addNetwork'
-EXT_AWK = P_BIN + 'awk'
EXT_BLOCKDEV = P_SBIN + 'blockdev'
EXT_BRCTL = P_USR_SBIN + 'brctl'
diff --git a/vdsm/utils.py b/vdsm/utils.py
index 89f786f..fd17df8 100644
--- a/vdsm/utils.py
+++ b/vdsm/utils.py
@@ -651,11 +651,10 @@ def getHostUUID():
__hostUUID = 'None'
try:
- p = subprocess.Popen(constants.EXT_SUDO + " " + constants.EXT_DMIDECODE + " |" +
- constants.EXT_AWK + " '/^\tUUID: /{ print $2 }'",
- close_fds=True, shell=True,
- stdin=subprocess.PIPE, stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
+ p = subprocess.Popen(constants.EXT_SUDO + " " +
+ constants.EXT_DMIDECODE + " -s system-uuid",
+ close_fds=True, shell=True, stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
if p.returncode == 0 and 'Not' not in out:
#Avoid error string - 'Not Settable' or 'Not Present'
diff --git a/vdsm_reg/deployUtil.py b/vdsm_reg/deployUtil.py
index 7564ed0..17cef2b 100644
--- a/vdsm_reg/deployUtil.py
+++ b/vdsm_reg/deployUtil.py
@@ -38,8 +38,6 @@ P_USR_SBIN = '/usr/sbin/'
P_LIBEXEC = '/usr/libexec/'
# Executables
-EX_AWK = P_BIN + 'awk'
-EX_BASH = P_BIN + 'bash'
EX_CAT = P_BIN + 'cat'
EX_CHKCONFIG = P_SBIN + 'chkconfig'
EX_DMIDECODE = P_USR_SBIN + 'dmidecode'
@@ -218,7 +216,7 @@ def getMachineUUID():
"""
strReturn = "None"
- out, err, ret = _logExec([EX_BASH, "-c", EX_DMIDECODE + "|" + EX_AWK + " ' /^\tUUID: /{ print $2; } '"])
+ out, err, ret = _logExec([EX_DMIDECODE + " -s system-uuid"])
if ret == 0 and "Not" not in out: #Avoid error string- 'Not Settable' or 'Not Present'
strReturn = out.replace ("\n", "")
else:
12 years, 10 months