Change in vdsm[ovirt-3.4]: vm: consider 'action' when handling I/O errors
by fromani@redhat.com
Hello Dan Kenigsberg,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/26023
to review the following change.
Change subject: vm: consider 'action' when handling I/O errors
......................................................................
vm: consider 'action' when handling I/O errors
When VDSM receives an I/O error event from libvirt,
it does not consider the value of the 'action' callback
field, and thus considers the guest CPU stopped.
This is true in the default configuration, which translates
to the disk write error policy 'stop', but not necessarily
true if the said policy is 'enospace'.
In this case the reported state of the CPU goes out of sync.
Since the error policy may be changed through an hook,
the safest thing to do is actually check the 'action'
value as reported by libvirt in the IOError callback.
This patch adds this check, and additional logging in
the case the guest CPU is reported running after I/O
errors.
Change-Id: I9299399c3e5bef7e6e3111aa35e3483827ad57da
Bug-Url: https://bugzilla.redhat.com/1064630
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
Reviewed-on: http://gerrit.ovirt.org/25157
Reviewed-by: Dan Kenigsberg <danken(a)redhat.com>
Tested-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm/clientIF.py
M vdsm/vm.py
2 files changed, 17 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/23/26023/1
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index c028216..624aee1 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -546,7 +546,7 @@
v._rtcUpdate(utcoffset)
elif eventid == libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON:
srcPath, devAlias, action, reason = args[:-1]
- v._onAbnormalStop(devAlias, reason)
+ v._onIOError(devAlias, reason, action)
elif eventid == libvirt.VIR_DOMAIN_EVENT_ID_GRAPHICS:
phase, localAddr, remoteAddr, authScheme, subject = args[:-1]
v.log.debug('graphics event phase '
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 0db8466..7944519 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -4510,20 +4510,28 @@
graphics.setAttribute('connected', 'keep')
self._dom.updateDeviceFlags(graphics.toxml(), 0)
- def _onAbnormalStop(self, blockDevAlias, err):
+ def _onIOError(self, blockDevAlias, err, action):
"""
Called back by IO_ERROR_REASON event
:param err: one of "eperm", "eio", "enospc" or "eother"
Note the different API from that of Vm._onAbnormalStop
"""
- self.log.info('abnormal vm stop device %s error %s',
- blockDevAlias, err)
- self.conf['pauseCode'] = err.upper()
- self._guestCpuRunning = False
- if err.upper() == 'ENOSPC':
- if not self.extendDrivesIfNeeded():
- self.log.info("No VM drives were extended")
+ if action == libvirt.VIR_DOMAIN_EVENT_IO_ERROR_PAUSE:
+ self.log.info('abnormal vm stop device %s error %s',
+ blockDevAlias, err)
+ self.conf['pauseCode'] = err.upper()
+ self._guestCpuRunning = False
+ if err.upper() == 'ENOSPC':
+ if not self.extendDrivesIfNeeded():
+ self.log.info("No VM drives were extended")
+ elif action == libvirt.VIR_DOMAIN_EVENT_IO_ERROR_REPORT:
+ self.log.info('I/O error %s device %s reported to guest OS',
+ err, blockDevAlias)
+ else:
+ # we do not support and do not expect other values
+ self.log.warning('unexpected action %i on device %s error %s',
+ action, blockDevAlias, err)
def _acpiShutdown(self):
self._dom.shutdownFlags(libvirt.VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN)
--
To view, visit http://gerrit.ovirt.org/26023
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9299399c3e5bef7e6e3111aa35e3483827ad57da
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.4
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
10 years
Change in vdsm[ovirt-3.4]: virt: Remove all guest sockets on cleanup
by Vinzenz Feenstra
Hello Dan Kenigsberg, Michal Skrivanek,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/26288
to review the following change.
Change subject: virt: Remove all guest sockets on cleanup
......................................................................
virt: Remove all guest sockets on cleanup
Previously vdsm was cleaning up the guest socket files, but when
introducing the symlinks we started leaving behind the real sockets
and just removed the symlinks.
This patch fixes this by first removing the file the symlink points
to and then removes the symlink.
Change-Id: Iaf3bfbd0eedcb6486cbde685d7b6ee64e8dc8d8c
Bug-Url: https://bugzilla.redhat.com/1082986
Signed-off-by: Vinzenz Feenstra <vfeenstr(a)redhat.com>
Reviewed-on: http://gerrit.ovirt.org/26278
Reviewed-by: Michal Skrivanek <michal.skrivanek(a)redhat.com>
Reviewed-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm/vm.py
1 file changed, 8 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/88/26288/1
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 832bca8..fd4c25a 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -2716,7 +2716,7 @@
except Exception:
pass
- utils.rmFile(self._guestSocketFile)
+ self._guestSockCleanup(self._guestSocketFile)
def setDownStatus(self, code, reason):
try:
@@ -2978,6 +2978,12 @@
self._vmStats.start()
self._guestEventTime = self._startTime
+ @staticmethod
+ def _guestSockCleanup(sock):
+ if os.path.islink(sock):
+ utils.rmFile(os.path.realpath(sock))
+ utils.rmFile(sock)
+
def _cleanup(self):
"""
General clean up routine
@@ -2986,7 +2992,7 @@
self._cleanupFloppy()
self._cleanupGuestAgent()
utils.rmFile(self._recoveryFile)
- utils.rmFile(self._qemuguestSocketFile)
+ self._guestSockCleanup(self._qemuguestSocketFile)
def updateGuestCpuRunning(self):
self._guestCpuRunning = (self._dom.info()[0] ==
--
To view, visit http://gerrit.ovirt.org/26288
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaf3bfbd0eedcb6486cbde685d7b6ee64e8dc8d8c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.4
Gerrit-Owner: Vinzenz Feenstra <vfeenstr(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek(a)redhat.com>
10 years
Change in vdsm[master]: oop: remove unused properties
by ykaplan@redhat.com
Yeela Kaplan has uploaded a new change for review.
Change subject: oop: remove unused properties
......................................................................
oop: remove unused properties
As part of the plan to move from the use of oop
in vdsm to ioprocess, starting cleaning up.
Change-Id: I35f3fae66a4ec71dea99f22d7e085f811f1e1b55
Signed-off-by: Yeela Kaplan <ykaplan(a)redhat.com>
---
M lib/vdsm/config.py.in
M vdsm/storage/outOfProcess.py
2 files changed, 0 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/74/26174/1
diff --git a/lib/vdsm/config.py.in b/lib/vdsm/config.py.in
index fb597a8..591f268 100644
--- a/lib/vdsm/config.py.in
+++ b/lib/vdsm/config.py.in
@@ -283,11 +283,7 @@
('maximum_domains_in_pool', '100',
'Process pool configuration.'),
- ('process_pool_size', '100', None),
-
('process_pool_timeout', '60', None),
-
- ('process_pool_grace_period', '2', None),
('process_pool_max_slots_per_domain', '10', None),
diff --git a/vdsm/storage/outOfProcess.py b/vdsm/storage/outOfProcess.py
index 65d29e9..6d251ba 100644
--- a/vdsm/storage/outOfProcess.py
+++ b/vdsm/storage/outOfProcess.py
@@ -25,8 +25,6 @@
from remoteFileHandler import RemoteFileHandlerPool
-# MAX_HELPERS = config.getint("irs", "process_pool_size")
-# GRACE_PERIOD = config.getint("irs", "process_pool_grace_period")
DEFAULT_TIMEOUT = config.getint("irs", "process_pool_timeout")
HELPERS_PER_DOMAIN = config.getint("irs", "process_pool_max_slots_per_domain")
--
To view, visit http://gerrit.ovirt.org/26174
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I35f3fae66a4ec71dea99f22d7e085f811f1e1b55
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan(a)redhat.com>
10 years
Change in vdsm[master]: vm: Log unhandled exception for new Thread
by Maor Lipchuk
Maor Lipchuk has uploaded a new change for review.
Change subject: vm: Log unhandled exception for new Thread
......................................................................
vm: Log unhandled exception for new Thread
Adding a traceback log for unhandled exceptions when execute
_startUnderlyingVm in vm class so it will not die silently.
Change-Id: I1a1d0c63234bc5a9d8287f3c92dc52b3eb125be1
Signed-off-by: Maor Lipchuk <mlipchuk(a)redhat.com>
---
M vdsm/vm.py
1 file changed, 1 insertion(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/84/23084/1
diff --git a/vdsm/vm.py b/vdsm/vm.py
index c917f48..e45ce39 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -2182,6 +2182,7 @@
memory += config.getint('vars', 'guest_ram_overhead')
self.memCommitted = 2 ** 20 * memory
+ @utils.traceback(on=log.name)
def _startUnderlyingVm(self):
self.log.debug("Start")
try:
--
To view, visit http://gerrit.ovirt.org/23084
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1a1d0c63234bc5a9d8287f3c92dc52b3eb125be1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Maor Lipchuk <mlipchuk(a)redhat.com>
10 years, 1 month
Change in vdsm[master]: misc: Log unhandled exception for new thread
by Maor Lipchuk
Maor Lipchuk has uploaded a new change for review.
Change subject: misc: Log unhandled exception for new thread
......................................................................
misc: Log unhandled exception for new thread
Adding a traceback log for unhandled exceptions when execute
_emit and wrapper in misc class so it will not die silently.
Since the log in misc instance is inaccessible from the decorator,
we use the default root logger.
Change-Id: Id61236a8a2e546f80c23c86d878347f5bd98784d
Signed-off-by: Maor Lipchuk <mlipchuk(a)redhat.com>
---
M vdsm/storage/misc.py
1 file changed, 3 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/83/23083/1
diff --git a/vdsm/storage/misc.py b/vdsm/storage/misc.py
index 48020b6..fea7a5d 100644
--- a/vdsm/storage/misc.py
+++ b/vdsm/storage/misc.py
@@ -874,6 +874,7 @@
resultsDict = {}
error = [None]
+ @utils.traceback()
def wrapper(f, arg, index):
try:
resultsDict[index] = f(arg)
@@ -926,6 +927,7 @@
with self._syncRoot:
del self._registrar[id(func)]
+ @utils.traceback()
def _emit(self, *args, **kwargs):
self._log.debug("Emitting event")
with self._syncRoot:
@@ -1052,6 +1054,7 @@
respQueue = Queue.Queue()
+ @utils.traceback()
def wrapper(value):
try:
respQueue.put(func(value))
--
To view, visit http://gerrit.ovirt.org/23083
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id61236a8a2e546f80c23c86d878347f5bd98784d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Maor Lipchuk <mlipchuk(a)redhat.com>
10 years, 1 month
Change in vdsm[master]: pep8: lib cleanups for pep-1.5.x
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: pep8: lib cleanups for pep-1.5.x
......................................................................
pep8: lib cleanups for pep-1.5.x
lib/* is now pep8 1.5.x clean.
Change-Id: I145fb9520219678d24d17698af618b44071ecbf4
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M lib/vdsm/ipwrapper.py
M lib/vdsm/netinfo.py
M lib/vdsm/tool/upgrade_300_networks.py
3 files changed, 5 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/25/26425/1
diff --git a/lib/vdsm/ipwrapper.py b/lib/vdsm/ipwrapper.py
index 3e43166..f51166c 100644
--- a/lib/vdsm/ipwrapper.py
+++ b/lib/vdsm/ipwrapper.py
@@ -668,7 +668,7 @@
# since that's how iproute2 reports it and there is currently no
# disambiguation (iproute bug https://bugzilla.redhat.com/1042799
data['name'] = data['name'].split('@', 1)[0]
- state = state if state or not 'state' in data else data['state']
+ state = state if state or 'state' not in data else data['state']
return MonitorEvent(data['index'], data['name'], data['flags'], state)
@classmethod
diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py
index 29b2bd2..bfc316c 100644
--- a/lib/vdsm/netinfo.py
+++ b/lib/vdsm/netinfo.py
@@ -510,8 +510,9 @@
def _bridgeinfo(link, gateways, ipv6routes, ipaddrs):
info = _devinfo(link, ipaddrs)
info.update({'gateway': getgateway(gateways, link.name),
- 'ipv6gateway': ipv6routes.get(link.name, '::'),
- 'ports': ports(link.name), 'stp': bridge_stp_state(link.name)})
+ 'ipv6gateway': ipv6routes.get(link.name, '::'),
+ 'ports': ports(link.name),
+ 'stp': bridge_stp_state(link.name)})
return info
diff --git a/lib/vdsm/tool/upgrade_300_networks.py b/lib/vdsm/tool/upgrade_300_networks.py
index 7a9ac91..9b29663 100644
--- a/lib/vdsm/tool/upgrade_300_networks.py
+++ b/lib/vdsm/tool/upgrade_300_networks.py
@@ -48,7 +48,7 @@
# Create a network for every bridge that doesn't have one
for bridge in bridges:
- if not bridge in networks:
+ if bridge not in networks:
logging.debug('Creating network %s', bridge)
configWriter.createLibvirtNetwork(network=bridge,
bridged=True,
--
To view, visit http://gerrit.ovirt.org/26425
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I145fb9520219678d24d17698af618b44071ecbf4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
10 years, 1 month
Change in vdsm[master]: pep8: storage cleanups for pep-1.5.x
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: pep8: storage cleanups for pep-1.5.x
......................................................................
pep8: storage cleanups for pep-1.5.x
storage/* is now pep8 1.5.x clean.
Change-Id: I49d4e4e59101ea54759a700644f04c9400fe2349
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/storage/blockSD.py
M vdsm/storage/blockVolume.py
M vdsm/storage/fileUtils.py
M vdsm/storage/hsm.py
M vdsm/storage/iscsi.py
M vdsm/storage/misc.py
M vdsm/storage/outOfProcess.py
M vdsm/storage/resourceManager.py
M vdsm/storage/storageServer.py
M vdsm/storage/storage_mailbox.py
10 files changed, 25 insertions(+), 25 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/24/26424/1
diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py
index f807d3e..58f5558 100644
--- a/vdsm/storage/blockSD.py
+++ b/vdsm/storage/blockSD.py
@@ -458,7 +458,7 @@
# extent size of 128MB. In any case we compute the right size on line.
vg = lvm.getVG(vgroup)
minmetasize = (SD_METADATA_SIZE / sd.METASIZE * int(vg.extent_size) +
- (1024 * 1024 - 1)) / (1024 * 1024)
+ (1024 * 1024 - 1)) / (1024 * 1024)
metaratio = int(vg.extent_size) / sd.METASIZE
metasize = (int(vg.extent_count) * sd.METASIZE +
(1024 * 1024 - 1)) / (1024 * 1024)
@@ -982,9 +982,9 @@
"""
try:
lvm.changelv(sdUUID, volUUIDs, (("-a", "y"),
- ("--deltag", blockVolume.TAG_PREFIX_IMAGE + imgUUID),
- ("--addtag", blockVolume.TAG_PREFIX_IMAGE +
- opTag + imgUUID)))
+ ("--deltag", blockVolume.TAG_PREFIX_IMAGE + imgUUID),
+ ("--addtag", blockVolume.TAG_PREFIX_IMAGE +
+ opTag + imgUUID)))
except se.StorageException as e:
log.error("Can't activate or change LV tags in SD %s. "
"failing Image %s %s operation for vols: %s. %s",
diff --git a/vdsm/storage/blockVolume.py b/vdsm/storage/blockVolume.py
index 36bfa1f..65be640 100644
--- a/vdsm/storage/blockVolume.py
+++ b/vdsm/storage/blockVolume.py
@@ -94,7 +94,7 @@
@classmethod
def halfbakedVolumeRollback(cls, taskObj, sdUUID, volUUID, volPath):
cls.log.info("sdUUID=%s volUUID=%s volPath=%s" %
- (sdUUID, volUUID, volPath))
+ (sdUUID, volUUID, volPath))
try:
# Fix me: assert resource lock.
tags = lvm.getLV(sdUUID, volUUID).tags
@@ -330,9 +330,9 @@
if recovery:
name = "Rename volume rollback: " + newUUID
- vars.task.pushRecovery(task.Recovery(name, "blockVolume",
- "BlockVolume", "renameVolumeRollback",
- [self.sdUUID, newUUID, self.volUUID]))
+ vars.task.pushRecovery(task.Recovery(
+ name, "blockVolume", "BlockVolume", "renameVolumeRollback",
+ [self.sdUUID, newUUID, self.volUUID]))
lvm.renameLV(self.sdUUID, self.volUUID, newUUID)
self.volUUID = newUUID
diff --git a/vdsm/storage/fileUtils.py b/vdsm/storage/fileUtils.py
index f1af44a..56dc1ef 100644
--- a/vdsm/storage/fileUtils.py
+++ b/vdsm/storage/fileUtils.py
@@ -229,7 +229,7 @@
class DirectFile(object):
def __init__(self, path, mode):
- if not "d" in mode:
+ if "d" not in mode:
raise ValueError("This class only handles direct IO")
if len(mode) < 2:
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 0ebe129..9040d79 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -2589,7 +2589,7 @@
misc.validateUUID(sdUUID, 'sdUUID')
self.validateNonDomain(sdUUID)
- if not domClass in sd.DOMAIN_CLASSES.keys():
+ if domClass not in sd.DOMAIN_CLASSES.keys():
raise se.StorageDomainClassError()
sd.validateDomainVersion(domVersion)
diff --git a/vdsm/storage/iscsi.py b/vdsm/storage/iscsi.py
index f0b3d54..bc57ecf 100644
--- a/vdsm/storage/iscsi.py
+++ b/vdsm/storage/iscsi.py
@@ -293,7 +293,7 @@
key, mode = self._fields[name]
- if not "r" in mode:
+ if "r" not in mode:
raise AttributeError(name)
value = self._conf[key]
@@ -316,7 +316,7 @@
raise AttributeError(name)
key, mode = self._fields[name]
- if not "w" in mode:
+ if "w" not in mode:
raise AttributeError(name)
self._conf[key] = value
diff --git a/vdsm/storage/misc.py b/vdsm/storage/misc.py
index a433723..0e11c65 100644
--- a/vdsm/storage/misc.py
+++ b/vdsm/storage/misc.py
@@ -654,7 +654,7 @@
def release(self):
currentThread = threading.currentThread()
- if not currentThread in self._holdingThreads:
+ if currentThread not in self._holdingThreads:
raise RuntimeError("Releasing an lock without acquiring it first")
# If in nested lock don't really release
diff --git a/vdsm/storage/outOfProcess.py b/vdsm/storage/outOfProcess.py
index 65d29e9..7b69faa 100644
--- a/vdsm/storage/outOfProcess.py
+++ b/vdsm/storage/outOfProcess.py
@@ -39,7 +39,7 @@
return _pools[clientName]
except KeyError:
with _poolsLock:
- if not clientName in _pools:
+ if clientName not in _pools:
_pools[clientName] = OopWrapper(
RemoteFileHandlerPool(HELPERS_PER_DOMAIN))
diff --git a/vdsm/storage/resourceManager.py b/vdsm/storage/resourceManager.py
index 2f40345..cdf8b84 100644
--- a/vdsm/storage/resourceManager.py
+++ b/vdsm/storage/resourceManager.py
@@ -56,7 +56,7 @@
@classmethod
def validate(cls, ltype):
validValues = ["shared", "exclusive"]
- if not ltype in validValues:
+ if ltype not in validValues:
raise ValueError("invalid lock type '%s'" % ltype)
@classmethod
@@ -424,7 +424,7 @@
def unregisterNamespace(self, namespace):
with self._syncRoot.exclusive:
- if not namespace in self._namespaces:
+ if namespace not in self._namespaces:
raise KeyError("Namespace '%s' doesn't exist" % namespace)
self._log.debug("Unregistering namespace '%s'", namespace)
@@ -453,7 +453,7 @@
raise KeyError("No such resource '%s.%s'" % (namespace,
name))
- if not name in resources:
+ if name not in resources:
return LockState.free
return LockState.fromType(resources[name].currentLock)
@@ -741,7 +741,7 @@
resource.fullName)
self.lock.acquire()
try:
- if not request in self.requests:
+ if request not in self.requests:
self.log.warning("request %s not requested by %s", request,
self)
resource.release()
@@ -777,7 +777,7 @@
self.log.debug("%s: request canceled %s", self, request)
self.lock.acquire()
try:
- if not request.fullName in self.requests:
+ if request.fullName not in self.requests:
self.log.warning("request %s not requested by %s", request,
self)
return
@@ -899,7 +899,7 @@
self.log.debug("%s: Trying to cancel request for '%s'", self, fullName)
self.lock.acquire()
try:
- if not fullName in self.requests:
+ if fullName not in self.requests:
self.log.warning("%s: Tried to cancel resource '%s' but it was"
" not requested or already canceled", self,
fullName)
@@ -951,7 +951,7 @@
fullName = "%s.%s" % (namespace, name)
self.lock.acquire()
try:
- if not fullName in self.resources:
+ if fullName not in self.resources:
raise ValueError("resource %s not owned by %s" %
(fullName, self))
diff --git a/vdsm/storage/storageServer.py b/vdsm/storage/storageServer.py
index e62e38a..21260b6 100644
--- a/vdsm/storage/storageServer.py
+++ b/vdsm/storage/storageServer.py
@@ -748,7 +748,7 @@
con = self._conDict[alias]
self._delConnection(alias)
self._log.info("Stopped managing connection alias %s", alias)
- if not con in self._conDict.values():
+ if con not in self._conDict.values():
return self._asyncDisconnect(con)
return AsyncCallStub(None)
diff --git a/vdsm/storage/storage_mailbox.py b/vdsm/storage/storage_mailbox.py
index b53fd5c..c31018a 100644
--- a/vdsm/storage/storage_mailbox.py
+++ b/vdsm/storage/storage_mailbox.py
@@ -90,9 +90,9 @@
def __init__(self, volumeData, newSize, callbackFunction=None):
- if (not 'poolID' in volumeData) or \
- (not 'domainID' in volumeData) or \
- (not 'volumeID' in volumeData):
+ if ('poolID' not in volumeData) or \
+ ('domainID' not in volumeData) or \
+ ('volumeID' not in volumeData):
self.log.error('create extend msg failed for volume: %s, size:'
' %d', '-'.join(volumeData.values()), newSize)
raise InvalidParameterException('volumeData dictionary',
--
To view, visit http://gerrit.ovirt.org/26424
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I49d4e4e59101ea54759a700644f04c9400fe2349
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
10 years, 1 month
Change in vdsm[master]: vm tests: avoid leaving /tmp/blechs.recovery behind
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: vm tests: avoid leaving /tmp/blechs.recovery behind
......................................................................
vm tests: avoid leaving /tmp/blechs.recovery behind
There's code that expects P_VDSM_VAR_RUN to end with a slash.
Change-Id: I73e7628be87692d17a6a5f629c3370df37e22dc8
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M tests/vmTests.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/97/26197/1
diff --git a/tests/vmTests.py b/tests/vmTests.py
index 91bbefb..3f6f695 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -699,7 +699,7 @@
@contextmanager
def FakeVM(params=None):
with namedTemporaryDir() as tmpDir:
- with MonkeyPatchScope([(constants, 'P_VDSM_RUN', tmpDir),
+ with MonkeyPatchScope([(constants, 'P_VDSM_RUN', tmpDir + '/'),
(libvirtconnection, 'get',
lambda x: ConnectionMock())]):
vmParams = {'vmId': 'TESTING'}
--
To view, visit http://gerrit.ovirt.org/26197
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I73e7628be87692d17a6a5f629c3370df37e22dc8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
10 years, 1 month
Change in vdsm[master]: vdsm_reg: remove engine.py.in
by Douglas Schilling Landgraf
Douglas Schilling Landgraf has uploaded a new change for review.
Change subject: vdsm_reg: remove engine.py.in
......................................................................
vdsm_reg: remove engine.py.in
engine.py.in was stored in vdsm_reg as part of ovirt-node
TUI registration stuff. Currently we have ovirt-node-plugin-vdsm
project which contain engine_page.py replacing this old file.
Change-Id: I255b7e4c1c336ceed3b9082ba6228fbc5a5795f8
Signed-off-by: Douglas Schilling Landgraf <dougsland(a)redhat.com>
---
D vdsm_reg/engine.py.in
1 file changed, 0 insertions(+), 384 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/11/26411/1
diff --git a/vdsm_reg/engine.py.in b/vdsm_reg/engine.py.in
deleted file mode 100644
index ac1ac02..0000000
--- a/vdsm_reg/engine.py.in
+++ /dev/null
@@ -1,384 +0,0 @@
-# Copyright 2011 Red Hat, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-# Refer to the README and COPYING files for full details of the license
-#
-# Written by Joey Boggs <jboggs(a)redhat.com>
-#
-
-import os
-import sys
-from ovirtnode.ovirtfunctions import ovirt_store_config, is_valid_host_or_ip, \
- is_valid_port, PluginBase, log, network_up, \
- password_check, augtool, is_console, system
-from ovirtnode.password import set_password
-
-from snack import ButtonChoiceWindow, Entry, Grid, Label, Checkbox, \
- FLAG_DISABLED, FLAGS_SET, customColorset, Textbox
-import subprocess
-
-sys.path.append('/usr/share/vdsm-reg')
-import deployUtil
-
-sys.path.append('/usr/share/vdsm')
-from vdsm import constants
-import httplib
-import socket
-
-VDSM_CONFIG = "/etc/vdsm/vdsm.conf"
-VDSM_REG_CONFIG = "/etc/vdsm-reg/vdsm-reg.conf"
-VDC_HOST_PORT = 443
-TIMEOUT_FIND_HOST_SEC = 5
-PASSWORD_MATCH = 0
-PASSWORD_DOESNT_MATCH = 1
-
-fWriteConfig = 0
-
-
-def set_defaults():
- vdsm_config_file = open(VDSM_CONFIG, "w")
- vdsm_config = """[vars]
-trust_store_path = /etc/pki/vdsm/
-ssl = true
-
-[addresses]
-management_port = 54321
-"""
- vdsm_config_file.write(vdsm_config)
- vdsm_config_file.close()
-
-
-def compatiblePort(portNumber):
- """
- Until the version 3.0, oVirt Engine provided port 8443/8080 to oVirt Node
- download cert and others files. Since 3.1 the default port changed to
- 443/80. This function, will return the compatible port in case the VDSM
- cannot communicate with oVirt Engine.
-
- :param portNumber: port which doesn't communicate with oVirt Engine
- :returns: compatible port number (or None if there is no compatible port)
- and if it's SSL port or not (bool)
- """
-
- compatPort = {
- '443': ('8443', True),
- '8443': ('443', True),
- '80': ('8080', False),
- '8080': ('80', False)
- }
-
- return compatPort.get(portNumber, (None, False))
-
-
-def isHostReachable(host, port=None, ssl=True,
- timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
- """
- This function will try a http connection to a host with determined
- port, ssl and timeout.
-
- :param host: Host to be tested
- :param port: Which port httplib should use for the test connection
- :param ssl: if it's ssl port or not (bool)
- :param timeout: timeout for the operation, if not speficied the default
- will be socket._GLOBAL_DEFAULT_TIMEOUT
- :returns True or False
- """
- if ssl:
- Connection = httplib.HTTPSConnection
- else:
- Connection = httplib.HTTPConnection
-
- try:
- conn = Connection(host, port=port, timeout=timeout)
- conn.request('HEAD', '/')
- return True
- except socket.error:
- return False
-
-
-def write_vdsm_config(engineHost, enginePort):
- if not os.path.exists(VDSM_CONFIG):
- system("touch " + VDSM_CONFIG)
- if os.path.getsize(VDSM_CONFIG) == 0:
- set_defaults()
- ovirt_store_config(VDSM_CONFIG)
- log("Agent configuration files created.")
- else:
- log("Agent configuration files already exist.")
-
- try:
- deployUtil.setVdsConf(
- "vdc_host_name=%s" % engineHost, VDSM_REG_CONFIG)
- log("The @ENGINENAME@'s address is set: %s\n" % engineHost)
- except Exception, err:
- log("deployUtil.setVdsConf() failed, err %s\n" % err)
-
- if enginePort != "":
- if deployUtil.setVdsConf(
- "vdc_host_port=%s" % str(enginePort), VDSM_REG_CONFIG):
- log("The @ENGINENAME@'s port set: %s\n" % enginePort)
- fWriteConfig = 1
-
- if fWriteConfig == 1:
- log("Saving vdsm-reg.conf\n")
- if ovirt_store_config(VDSM_REG_CONFIG):
- log("vdsm-reg.conf Saved\n")
- return True
-
-
-def getEngineConfig():
- vdsm_config = open(VDSM_REG_CONFIG)
- config = {}
- config["vdc_host_port"] = VDC_HOST_PORT
- for line in vdsm_config:
- line = line.strip().replace(" ", "").split("=")
- if "vdc_host_name" in line:
- item, config["vdc_host_name"] = line[0], line[1]
- if "vdc_host_port" in line:
- item, config["vdc_host_port"] = line[0], line[1]
- vdc_server = config["vdc_host_name"] + ":" + config["vdc_host_port"]
- vdsm_config.close()
- return vdc_server
-
-
-class Plugin(PluginBase):
- """Plugin for @ENGINENAME@ configuration.
- """
-
- def __init__(self, ncs):
- PluginBase.__init__(self, "@ENGINENAME@", ncs)
-
- def form(self):
- elements = Grid(2, 9)
- is_network_up = network_up()
- if is_network_up:
- header_message = "@ENGINENAME@ Configuration"
- else:
- header_message = "Network Down, @ENGINENAME@ Configuration " \
- "Disabled"
- heading = Label(header_message)
- if is_console():
- self.ncs.screen.setColor(customColorset(1), "black", "magenta")
- heading.setColors(customColorset(1))
- elements.setField(heading, 0, 0, anchorLeft=1)
- engine_grid = Grid(2, 2)
- engine_grid.setField(Label("Management Server:"), 0, 0, anchorLeft=1)
- self.engine_server = Entry(25, "")
- self.engine_server.setCallback(self.validEngineServerCallback)
- engine_grid.setField(Label("Management Server Port:"), 0, 1,
- anchorLeft=1)
- self.engine_server_port = Entry(6, "", scroll=0)
- self.engine_server_port.setCallback(self.validEngineServerPortCallback)
- engine_grid.setField(self.engine_server, 1, 0, anchorLeft=1,
- padding=(2, 0, 0, 1))
- engine_grid.setField(self.engine_server_port, 1, 1, anchorLeft=1,
- padding=(2, 0, 0, 0))
- elements.setField(engine_grid, 0, 1, anchorLeft=1,
- padding=(0, 0, 0, 0))
- elements.setField(Label(""), 0, 2, anchorLeft=1)
- self.verify_engine_cert = Checkbox("Connect to @ENGINENAME@ and "
- "Validate Certificate", isOn=True)
- elements.setField(self.verify_engine_cert, 0, 3, anchorLeft=1,
- padding=(0, 0, 0, 0))
- elements.setField(Label(""), 0, 4, anchorLeft=1)
-
- elements.setField(Label("Optional password for adding node through "
- "@ENGINENAME@ UI"), 0, 5, anchorLeft=1)
- elements.setField(Label("Note: Setting password will enable "
- "SSH daemon"), 0, 6, anchorLeft=1)
- pw_elements = Grid(3, 3)
-
- pw_elements.setField(Label("Password: "), 0, 1, anchorLeft=1)
- self.root_password_1 = Entry(15, password=1)
- self.root_password_1.setCallback(self.password_check_callback)
- pw_elements.setField(self.root_password_1, 1, 1)
- pw_elements.setField(Label("Confirm Password: "), 0, 2, anchorLeft=1)
- self.root_password_2 = Entry(15, password=1)
- self.root_password_2.setCallback(self.password_check_callback)
- pw_elements.setField(self.root_password_2, 1, 2)
- self.pw_pcheck_msg = ""
- self.pw_msg = Textbox(60, 6, self.pw_pcheck_msg, wrap=1)
- self.pw_resp = PASSWORD_MATCH
-
- elements.setField(pw_elements, 0, 7, anchorLeft=1)
- elements.setField(self.pw_msg, 0, 8, padding=(0, 0, 0, 0))
-
- inputFields = [self.engine_server, self.engine_server_port,
- self.verify_engine_cert, self.root_password_1,
- self.root_password_2]
- if not is_network_up:
- for field in inputFields:
- field.setFlags(FLAG_DISABLED, FLAGS_SET)
-
- try:
- engine_server = getEngineConfig()
- engine_server, engine_port = engine_server.split(":")
- if engine_server.startswith("None"):
- self.engine_server.set("")
- else:
- self.engine_server.set(engine_server)
- self.engine_server_port.set(engine_port)
-
- except:
- pass
- return [Label(""), elements]
-
- def password_check_callback(self):
- self.pw_resp, self.pw_pcheck_msg = \
- password_check(self.root_password_1.value(),
- self.root_password_2.value())
- self.pw_msg.setText(self.pw_pcheck_msg)
- return
-
- def action(self):
- # To manage the engine_server_port value, use enginePort var to avoid
- # TUI putting the port value in the screen when you are just changing
- # the value and not asking to draw/print it.
- enginePort = self.engine_server_port.value()
- if is_console():
- self.ncs.screen.setColor("BUTTON", "black", "red")
- self.ncs.screen.setColor("ACTBUTTON", "blue", "white")
-
- compatPort, sslPort = compatiblePort(enginePort)
-
- if self.pw_resp == PASSWORD_MATCH:
- set_password(self.root_password_1.value(), "root")
- augtool("set", "/files/etc/ssh/sshd_config/PasswordAuthentication",
- "yes")
- dn = file('/dev/null', 'w+')
- subprocess.Popen(['/sbin/service', 'sshd', 'restart'], stdout=dn,
- stderr=dn)
- # password_check() returns 1 for all situations that are failures.
- # However, it includes the case where password len is 0 and min_length
- # is 1 (default value of min_length as argument of function is 1).
- # To avoid falling in such case, let's validate the len of
- # self.root_password.value()
- elif self.pw_resp == PASSWORD_DOESNT_MATCH and \
- len(self.root_password_1.value()) > 0 or \
- self.pw_resp == PASSWORD_DOESNT_MATCH and \
- len(self.root_password_2.value()) > 0:
- # Required since we now are verifying if the Confirm Password were
- # filled and Password field not
- if self.pw_pcheck_msg.strip("\n") == "":
- self.pw_pcheck_msg = "Please check: Passwords Do Not Match!"
-
- ButtonChoiceWindow(self.ncs.screen, "@ENGINENAME@",
- self.pw_pcheck_msg, buttons=['Ok'])
- return
-
- if len(self.engine_server.value()) > 0:
- deployUtil.nodeCleanup()
- if not isHostReachable(host=self.engine_server.value(),
- port=enginePort, ssl=sslPort,
- timeout=TIMEOUT_FIND_HOST_SEC):
- if compatPort is None:
- # Try one more time with SSL=False
- if not isHostReachable(host=self.engine_server.value(),
- port=enginePort, ssl=False,
- timeout=TIMEOUT_FIND_HOST_SEC):
- msgConn = "Can't connect to @ENGINENAME@ in the " \
- "specific port %s" % enginePort
-
- ButtonChoiceWindow(self.ncs.screen, "@ENGINENAME@",
- msgConn, buttons=['Ok'])
- return False
- else:
- msgConn = "Can't connect to @ENGINENAME@ port %s," \
- " trying compatible port %s" % \
- (enginePort, compatPort)
-
- ButtonChoiceWindow(self.ncs.screen, "@ENGINENAME@",
- msgConn, buttons=['Ok'])
-
- if not isHostReachable(host=self.engine_server.value(),
- port=compatPort, ssl=sslPort,
- timeout=TIMEOUT_FIND_HOST_SEC):
- msgConn = "Can't connect to @ENGINENAME@ using" \
- " compatible port %s" % compatPort
- ButtonChoiceWindow(self.ncs.screen, "@ENGINENAME@",
- msgConn, buttons=['Ok'])
- return False
- else:
- # compatible port found
- enginePort = compatPort
-
- if self.verify_engine_cert.selected():
- if deployUtil.getRhevmCert(self.engine_server.value(),
- enginePort):
- _, _, path = deployUtil.certPaths('')
- fp = deployUtil.generateFingerPrint(path)
- approval = ButtonChoiceWindow(self.ncs.screen,
- "Certificate Fingerprint:",
- fp, buttons=['Approve',
- 'Reject'])
- if 'reject' == approval:
- ButtonChoiceWindow(self.ncs.screen,
- "Fingerprint rejected",
- "@ENGINENAME@ Configuration Failed",
- buttons=['Ok'])
- return False
- else:
- ovirt_store_config(path)
- self.ncs.reset_screen_colors()
- else:
- ButtonChoiceWindow(
- self.ncs.screen, "@ENGINENAME@ Configuration",
- "Failed downloading @ENGINENAME@ certificate",
- buttons=['Ok'])
- self.ncs.reset_screen_colors()
- return False
- # Stopping vdsm-reg may fail but its ok - its in the case when the
- # menus are run after installation
- deployUtil._logExec([constants.EXT_SERVICE, 'vdsm-reg', 'stop'])
- if write_vdsm_config(self.engine_server.value(), enginePort):
- deployUtil._logExec([constants.EXT_SERVICE, 'vdsm-reg',
- 'start'])
- ButtonChoiceWindow(
- self.ncs.screen, "@ENGINENAME@ Configuration",
- "@ENGINENAME@ Configuration Successfully Updated",
- buttons=['Ok'])
- self.ncs.reset_screen_colors()
- retWriteConf = True
- else:
- ButtonChoiceWindow(
- self.ncs.screen, "@ENGINENAME@ Configuration",
- "@ENGINENAME@ Configuration Failed", buttons=['Ok'])
- self.ncs.reset_screen_colors()
- retWriteConf = False
-
- return retWriteConf
-
- def validEngineServerCallback(self):
- if not is_valid_host_or_ip(self.engine_server.value()):
- self.ncs.screen.setColor("BUTTON", "black", "red")
- self.ncs.screen.setColor("ACTBUTTON", "blue", "white")
- ButtonChoiceWindow(
- self.ncs.screen, "Configuration Check",
- "Invalid @ENGINENAME@ Hostname or Address", buttons=['Ok'])
- self.ncs.reset_screen_colors()
-
- def validEngineServerPortCallback(self):
- if not is_valid_port(self.engine_server_port.value()):
- self.ncs.screen.setColor("BUTTON", "black", "red")
- self.ncs.screen.setColor("ACTBUTTON", "blue", "white")
- ButtonChoiceWindow(
- self.ncs.screen, "Configuration Check",
- "Invalid @ENGINENAME@ Server Port", buttons=['Ok'])
- self.ncs.reset_screen_colors()
-
-
-def get_plugin(ncs):
- return Plugin(ncs)
--
To view, visit http://gerrit.ovirt.org/26411
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I255b7e4c1c336ceed3b9082ba6228fbc5a5795f8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland(a)redhat.com>
10 years, 1 month
Change in vdsm[master]: Allow moving of sparse images to a block domains
by tnisan@redhat.com
Tal Nisan has uploaded a new change for review.
Change subject: Allow moving of sparse images to a block domains
......................................................................
Allow moving of sparse images to a block domains
When attempting to move a sparse image from a file domain to a block domain
the destination image is created as sparse and is not supported on block
domains, this patch introduces a change that creates a the images as
preallocated on domains that do not support sparseness
Change-Id: Id95d700cf6acb46464d6c5d063966f9331a15028
Signed-off-by: Tal Nisan <tnisan(a)redhat.com>
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1063996
---
M vdsm/storage/image.py
1 file changed, 6 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/78/25778/1
diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py
index b08ecca..341c312 100644
--- a/vdsm/storage/image.py
+++ b/vdsm/storage/image.py
@@ -358,11 +358,13 @@
# we create the target as a sparse volume (since it will be
# soon filled with the data coming from the copy) and then
# we change its metadata back to the original value.
- if (volParams['prealloc'] == volume.PREALLOCATED_VOL
- and destDom.supportsSparseness):
- tmpVolPreallocation = volume.SPARSE_VOL
+ if (destDom.supportsSparseness):
+ if (volParams['prealloc'] == volume.PREALLOCATED_VOL):
+ tmpVolPreallocation = volume.SPARSE_VOL
+ else:
+ tmpVolPreallocation = volParams['prealloc']
else:
- tmpVolPreallocation = volParams['prealloc']
+ tmpVolPreallocation = volume.PREALLOCATED_VOL
destDom.createVolume(imgUUID=imgUUID,
size=volParams['size'],
--
To view, visit http://gerrit.ovirt.org/25778
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id95d700cf6acb46464d6c5d063966f9331a15028
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Tal Nisan <tnisan(a)redhat.com>
10 years, 1 month