[NEW PATCH] BZ#719516 vdsClient: avoid possible race in list table. (via gerrit-bot)
by David Naori
New patch submitted by David Naori (dnaori(a)redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/671
commit 8f4d660ec410cfb9dbf55f3565111663306a6670
Author: David Naori <dnaori(a)redhat.com>
Date: Thu Jul 7 09:24:20 2011 +0300
BZ#719516 vdsClient: avoid possible race in list table.
Change-Id: I7fc52ac0428fd0a2128376a97d56df0fc41ff8ac
diff --git a/vdsm_cli/vdsClient.py b/vdsm_cli/vdsClient.py
index 903dc46..ddada10 100755
--- a/vdsm_cli/vdsClient.py
+++ b/vdsm_cli/vdsClient.py
@@ -173,34 +173,35 @@ class service:
return self.ExecAndExit(self.s.changeFloppy(vmId, file))
def do_list(self, args):
- table=False
- if len(args):
- if args[0] == 'table':
- table=True
response = self.s.list(True)
- if response['status']['code'] != 0:
- print response['status']['message']
- else:
- if table:
- allStats = {}
- for s in self.s.getAllVmStats()['statsList']:
- allStats[s['vmId']] = s
- for conf in response['vmList']:
- if table:
- id = conf['vmId']
- status = conf['status']
- if allStats[id].get('monitorResponse') == '-1':
- status += '*'
- print "%-36s %6s %-20s %-20s %-20s" % (id,
- conf.get('pid', 'none'),
- conf.get('vmName', '<< NO NAME >>'),
- status, allStats[id].get('guestIPs', '') )
- else:
- if 'sysprepInf' in conf:
- conf['sysprepInf'] = '<<exists>>'
- printConf(conf)
- sys.exit(response['status']['code'])
+ if response['status']['code']:
+ print response['status']['message']
+ return
+
+ allStats = dict()
+
+ if 'table' in args:
+ for s in self.s.getAllVmStats()['statsList']:
+ allStats[ s['vmId'] ] = s
+
+ for conf in response['vmList']:
+ if allStats:
+ id = conf['vmId']
+ if id not in allStats.keys():
+ continue
+ status = conf['status']
+ if allStats[id].get('monitorResponse') == '-1':
+ status += '*'
+ print "%-36s %6s %-20s %-20s %-20s" % ( id,
+ conf.get('pid', 'none'),
+ conf.get('vmName', '<< NO NAME >>'),
+ status, allStats[id].get('guestIPs', '') )
+ else:
+ if 'sysprepInf' in conf:
+ conf['sysprepInf'] = '<<exists>>'
+ printConf(conf)
+ sys.exit(response['status']['code'])
def do_listNames(self, args):
response = self.s.list()
12 years, 10 months
[NEW PATCH] BZ#718993 - Remove vgchange --refresh (via gerrit-bot)
by ewarszaw@redhat.com
New patch submitted by Eduardo Warszawski (ewarszaw(a)redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/662
commit 8e2a1b9332d66cde99b46de62f7ea5d4efad641d
Author: Eduardo Warszawski <ewarszaw(a)redhat.com>
Date: Tue Jul 5 18:05:39 2011 +0300
BZ#718993 - Remove vgchange --refresh
vgchange --refresh:
If any logical volume in the volume group is active, reload its metadata.
vgchange --refresh may be too long when are many LVs in the VG.
vgchange --refresh was NOT needed for refreshLV after migration in bug 651803,
since the LV metadata is reloaded using lvchange --refresh.
Change-Id: I123480a2f687bbfacaf8308fbfa3d0a7f5c29c47
diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py
index 9f744b2..0c00dd3 100644
--- a/vdsm/storage/blockSD.py
+++ b/vdsm/storage/blockSD.py
@@ -105,7 +105,7 @@ class VGTagMetadataRW(object):
self._vgName = vgName
def readlines(self):
- lvm.refreshVG(self._vgName)
+ lvm.invalidateVG(self._vgName)
vg = lvm.getVG(self._vgName)
metadata = []
for tag in vg.tags:
@@ -921,7 +921,7 @@ class BlockStorageDomain(sd.StorageDomain):
def refresh(self):
self.refreshDirTree()
- lvm.refreshVG(self.sdUUID)
+ lvm.invalidateVG(self.sdUUID)
self._metadata = selectMetadata(self.sdUUID)
@staticmethod
diff --git a/vdsm/storage/lvm.py b/vdsm/storage/lvm.py
index d6159eb..8a89a01 100644
--- a/vdsm/storage/lvm.py
+++ b/vdsm/storage/lvm.py
@@ -881,14 +881,9 @@ def deactivateVG(vgName):
_setVgAvailability(vgName, available="n")
-def refreshVG(vgName):
- #If any logical volume in the volume group is active, reload its metadata.
- cmd = ['vgchange', '--refresh', vgName]
- rc, out, err = _lvminfo.cmd(cmd)
+def invalidateVG(vgName):
_lvminfo._invalidatevgs(vgName)
_lvminfo._invalidatelvs(vgName)
- if rc != 0:
- raise se.LogicalVolumeRefreshError("vgchange --refresh %s failed" % (vgName,))
#
12 years, 10 months
[NEW PATCH] BZ#719346 vdsClient: Remove unsupported "stopAllCopies" (via gerrit-bot)
by David Naori
New patch submitted by David Naori (dnaori(a)redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/670
commit 467ed4a594d24309b376bd04a104a5965a67280d
Author: David Naori <dnaori(a)redhat.com>
Date: Wed Jul 6 19:45:23 2011 +0300
BZ#719346 vdsClient: Remove unsupported "stopAllCopies"
Change-Id: I8c60725179eb9d2d75eaa62f796aec8b10be133c
diff --git a/vdsm_cli/vdsClient.py b/vdsm_cli/vdsClient.py
index 5239187..903dc46 100755
--- a/vdsm_cli/vdsClient.py
+++ b/vdsm_cli/vdsClient.py
@@ -1238,12 +1238,6 @@ class service:
return image['status']['code'], image['status']['message']
return 0, ''
- def stopAllCopies(self, args):
- stats = self.s.stopAllCopies()
- if stats['status']['code']:
- return stats['status']['code'], stats['status']['message']
- return 0, ''
-
def prepareForShutdown(self, args):
stats = self.s.prepareForShutdown()
if stats['status']['code']:
@@ -1866,9 +1860,6 @@ if __name__ == '__main__':
('<TaskID>',
'revert async task'
)),
- 'stopAllCopies': ( serv.stopAllCopies,
- ('',''
- )),
'prepareForShutdown': ( serv.prepareForShutdown,
('',''
)),
12 years, 10 months
[NEW PATCH] BZ#719255 - Release lock if prepare volume failed (via gerrit-bot)
by Igor Lvovsky
New patch submitted by Igor Lvovsky (ilvovsky(a)redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/665
commit 700bc5898fa71ae91b8e7ac2cfdd4804d40cdab4
Author: Igor Lvovsky <ilvovsky(a)redhat.com>
Date: Wed Jul 6 13:52:45 2011 +0300
BZ#719255 - Release lock if prepare volume failed
Change-Id: I57a78ff800f0b8f006ca9c4fed3bb6ac185a55ed
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 7081558..14c281e 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -1663,12 +1663,17 @@ class HSM:
imageResourcesNamespace = sd.getNamespace(sdUUID, IMAGE_NAMESPACE)
imgResource = rmanager.acquireResource(imageResourcesNamespace, imgUUID, rm.LockType.exclusive)
imgResource.autoRelease = False
- 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)
+ 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 Exception:
+ imgResource.autoRelease = True
+ self.log.error("Prepare volume %s in domain %s failed", volUUID, sdUUID, exc_info=True)
+ raise
def public_teardownVolume(self, sdUUID, spUUID, imgUUID, volUUID, rw=False, options = None):
12 years, 10 months
[NEW PATCH] BZ#719301 clientIF: fix log typo. (via gerrit-bot)
by David Naori
New patch submitted by David Naori (dnaori(a)redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/667
commit 62c25ccb5a6633e76289e60f926d507ec614ac11
Author: David Naori <dnaori(a)redhat.com>
Date: Wed Jul 6 15:09:39 2011 +0300
BZ#719301 clientIF: fix log typo.
Change-Id: Iae1a8ba75df6e85b22184fe0fd9e7ccbecbb9b90
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index c1219e4..c5169a4 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -433,7 +433,7 @@ class clientIF:
Destroy the specified VM.
"""
self.vmContainerLock.acquire()
- self.log.info("vmContainerLock aquired by vm %s", vmId)
+ self.log.info("vmContainerLock acquired by vm %s", vmId)
try:
v = self.vmContainer.get(vmId)
if not v:
@@ -639,7 +639,7 @@ class clientIF:
vmParams['displayIp'] = self._getNetworkIp(vmParams.get(
'displayNetwork'))
self.vmContainerLock.acquire()
- self.log.info("vmContainerLock aquired by vm %s", vmParams['vmId'])
+ self.log.info("vmContainerLock acquired by vm %s", vmParams['vmId'])
try:
if 'recover' not in vmParams:
if vmParams['vmId'] in self.vmContainer:
12 years, 10 months
[NEW PATCH] Return 1 socket when "physical id" not present (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/666
commit 532621aaab3c287a285100e94957db3f7d691331
Author: Federico Simoncelli <fsimonce(a)redhat.com>
Date: Wed Jul 6 11:52:09 2011 +0000
Return 1 socket when "physical id" not present
When "physical id" is not present in /proc/cpuinfo return 1 socket.
Change-Id: If25e97830d35286b32083f57156ebb97a0e1aeb0
diff --git a/vdsm/caps.py b/vdsm/caps.py
index e943321..57a1bbf 100644
--- a/vdsm/caps.py
+++ b/vdsm/caps.py
@@ -44,7 +44,8 @@ class CpuInfo(object):
return len(self._info)
def sockets(self):
- return len(set([ p['physical id'] for p in self._info.values() ]))
+ phys_ids = [ p.get('physical id', '0') for p in self._info.values() ]
+ return len(set(phys_ids))
def flags(self):
return self._info.itervalues().next()['flags'].split()
12 years, 10 months
[NEW PATCH] BZ#719255 - Release lock if prepare volume failed (via gerrit-bot)
by Igor Lvovsky
New patch submitted by Igor Lvovsky (ilvovsky(a)redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/665
commit 25c86464dab07fd608ee326f59a253f93037672c
Author: Igor Lvovsky <ilvovsky(a)redhat.com>
Date: Wed Jul 6 13:52:45 2011 +0300
BZ#719255 - Release lock if prepare volume failed
Change-Id: I57a78ff800f0b8f006ca9c4fed3bb6ac185a55ed
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 7081558..e8194af 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -1663,12 +1663,17 @@ class HSM:
imageResourcesNamespace = sd.getNamespace(sdUUID, IMAGE_NAMESPACE)
imgResource = rmanager.acquireResource(imageResourcesNamespace, imgUUID, rm.LockType.exclusive)
imgResource.autoRelease = False
- 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)
+ 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 Exception:
+ imgResource.autoRelease = True
+ self.log.error("Prepare volume %s in domain %s failed", volUUID, sdUUID, exc_info=True)
+ raise
def public_teardownVolume(self, sdUUID, spUUID, imgUUID, volUUID, rw=False, options = None):
@@ -1691,10 +1696,15 @@ class HSM:
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:
+ volclass = SDF.produce(sdUUID).getVolumeClass()
+ volclass.teardown(sdUUID=sdUUID, volUUID=volUUID)
+ except Exception:
+ self.log.error("Teardown volume %s in domain %s failed", volUUID, sdUUID, exc_info=True)
+ raise
+ finally:
+ imageResourcesNamespace = sd.getNamespace(sdUUID, IMAGE_NAMESPACE)
+ rmanager.releaseResource(imageResourcesNamespace, imgUUID)
def public_getVolumesList(self, sdUUID, spUUID, imgUUID=volume.BLANK_UUID, options = None):
12 years, 10 months