Dan Kenigsberg has uploaded a new change for review.
Change subject: spbackends: simplify over-general evaluation
......................................................................
spbackends: simplify over-general evaluation
The removed code is too clever for the use case of only two values.
Change-Id: I775c4a6003a03c6b65bee3abc8559a88e3eaec01
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm/storage/spbackends.py
1 file changed, 5 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/53/41253/1
diff --git a/vdsm/storage/spbackends.py b/vdsm/storage/spbackends.py
index 953e01e..f6ce02b 100644
--- a/vdsm/storage/spbackends.py
+++ b/vdsm/storage/spbackends.py
@@ -229,8 +229,11 @@
def setSpmStatus(self, lVer=None, spmId=None):
self.invalidateMetadata()
- metaParams = dict(filter(lambda kv: kv[1] is not None,
- ((PMDK_LVER, lVer), (PMDK_SPM_ID, spmId))))
+ metaParams = {}
+ if lVer is not None:
+ metaParams[PMDK_LVER] = lVer
+ if spmId is not None:
+ metaParams[PMDK_SPM_ID] = spmId
self._metadata.update(metaParams)
@unsecured
--
To view, visit https://gerrit.ovirt.org/41253
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I775c4a6003a03c6b65bee3abc8559a88e3eaec01
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
Piotr Kliczewski has uploaded a new change for review.
Change subject: Method not found should return proper code
......................................................................
Method not found should return proper code
When a method is not found we should return -32601 code.
Change-Id: I9b3e1360303bca7ae3c30846ad46fec1fadac7fb
Signed-off-by: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
---
M lib/vdsm/rpc/Bridge.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/20/63120/1
diff --git a/lib/vdsm/rpc/Bridge.py b/lib/vdsm/rpc/Bridge.py
index bd180e0..0bd1aaa 100644
--- a/lib/vdsm/rpc/Bridge.py
+++ b/lib/vdsm/rpc/Bridge.py
@@ -110,7 +110,7 @@
try:
className, methodName = method.split('.', 1)
self._schema.get_method(vdsmapi.MethodRep(className, methodName))
- except (KeyError, ValueError):
+ except (vdsmapi.MethodNotFound, ValueError):
raise yajsonrpc.JsonRpcMethodNotFoundError(method)
return partial(self._dynamicMethod, className, methodName)
--
To view, visit https://gerrit.ovirt.org/63120
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9b3e1360303bca7ae3c30846ad46fec1fadac7fb
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Tomas Golembiovsky has uploaded a new change for review.
Change subject: vdsm: log proper tag for messages comming from vdsm-logrotate
......................................................................
vdsm: log proper tag for messages comming from vdsm-logrotate
The log messages comming from vdsm-logrotate were improperly tagged as
'logrotate'. To avoid confusion with real logrotate we should properly
mark our messages as vdsm-logrotate.
Change-Id: I75e1eae3e75928034edaa24bbcd6fae44920c22d
Signed-off-by: Tomáš Golembiovský <tgolembi(a)redhat.com>
---
M vdsm/vdsm-logrotate
1 file changed, 3 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/04/65604/1
diff --git a/vdsm/vdsm-logrotate b/vdsm/vdsm-logrotate
index e44e079..0c84ca3 100755
--- a/vdsm/vdsm-logrotate
+++ b/vdsm/vdsm-logrotate
@@ -12,14 +12,14 @@
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
- /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
+ /usr/bin/logger -t vdsm-logrotate "ALERT logrotate exited abnormally with [$EXITVALUE]"
fi
if [ -d /var/log/core ] ; then
/usr/bin/find /var/log/core -type f -name '*xz' -mtime +7 -exec /bin/rm -f '{}' \;
RET=$?
if [ $RET != 0 ]; then
- /usr/bin/logger -t logrotate "ALERT clean old core files exited abnormally with [$RET]"
+ /usr/bin/logger -t vdsm-logrotate "ALERT clean old core files exited abnormally with [$RET]"
EXITVALUE=$RET
fi
fi
@@ -28,7 +28,7 @@
/usr/bin/find /var/log/vdsm/import -type f -mtime +30 -exec /bin/rm -f '{}' \;
RET=$?
if [ $RET != 0 ]; then
- /usr/bin/logger -t logrotate "ALERT clean of old import log files exited abnormally with [$RET]"
+ /usr/bin/logger -t vdsm-logrotate "ALERT clean of old import log files exited abnormally with [$RET]"
EXITVALUE=$RET
fi
fi
--
To view, visit https://gerrit.ovirt.org/65604
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I75e1eae3e75928034edaa24bbcd6fae44920c22d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Tomas Golembiovsky <tgolembi(a)redhat.com>
Tomas Golembiovsky has uploaded a new change for review.
Change subject: vdsm: report correct exit value in vdsm-logrotate
......................................................................
vdsm: report correct exit value in vdsm-logrotate
The exit code was reported improperly. If all but the last command had
failed we would still return 0. Now we are reporting exit code of last
failed command or 0 when all exited successfully.
Change-Id: I29df6cac36c64be2bf20337ab096ec471d864ca5
Signed-off-by: Tomáš Golembiovský <tgolembi(a)redhat.com>
---
M vdsm/vdsm-logrotate
1 file changed, 8 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/03/65603/1
diff --git a/vdsm/vdsm-logrotate b/vdsm/vdsm-logrotate
index a29cbe5..e44e079 100755
--- a/vdsm/vdsm-logrotate
+++ b/vdsm/vdsm-logrotate
@@ -17,17 +17,19 @@
if [ -d /var/log/core ] ; then
/usr/bin/find /var/log/core -type f -name '*xz' -mtime +7 -exec /bin/rm -f '{}' \;
- EXITVALUE=$?
- if [ $EXITVALUE != 0 ]; then
- /usr/bin/logger -t logrotate "ALERT clean old core files exited abnormally with [$EXITVALUE]"
+ RET=$?
+ if [ $RET != 0 ]; then
+ /usr/bin/logger -t logrotate "ALERT clean old core files exited abnormally with [$RET]"
+ EXITVALUE=$RET
fi
fi
if [ -d /var/log/vdsm/import ] ; then
/usr/bin/find /var/log/vdsm/import -type f -mtime +30 -exec /bin/rm -f '{}' \;
- EXITVALUE=$?
- if [ $EXITVALUE != 0 ]; then
- /usr/bin/logger -t logrotate "ALERT clean of old import log files exited abnormally with [$EXITVALUE]"
+ RET=$?
+ if [ $RET != 0 ]; then
+ /usr/bin/logger -t logrotate "ALERT clean of old import log files exited abnormally with [$RET]"
+ EXITVALUE=$RET
fi
fi
--
To view, visit https://gerrit.ovirt.org/65603
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I29df6cac36c64be2bf20337ab096ec471d864ca5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Tomas Golembiovsky <tgolembi(a)redhat.com>
Milan Zamazal has uploaded a new change for review.
Change subject: virt: Inform Engine about switching to post-copy
......................................................................
virt: Inform Engine about switching to post-copy
Engine must be informed when a migration switches to post-copy mode (to
know where to get further events and stats from). We use status event
for that purpose. We report paused state for VMs in post-copy migration
mode on the source, so we must distinguish between paused state in
post-copy migration and paused state for other reasons. We use
pauseCode for that purpose.
Change-Id: I281ec36a6bd65b816afbdeef79205e6241d4a27c
Signed-off-by: Milan Zamazal <mzamazal(a)redhat.com>
Bug-Url: https://bugzilla.redhat.com/1354343
---
M vdsm/virt/vm.py
1 file changed, 3 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/49/64149/8
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 195453f..abf2d75 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -4200,6 +4200,9 @@
elif detail == libvirt.VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY:
self._in_post_copy = True
self.log.debug("Migration entered post-copy mode")
+ with self._confLock:
+ self.conf['pauseCode'] = 'POSTCOPY'
+ self.send_status_event(pauseCode='POSTCOPY')
elif detail == libvirt.VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY_FAILED:
# This can happen on both the ends of the migration.
# After a failed post-copy migration, the VM remains in a
--
To view, visit https://gerrit.ovirt.org/64149
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I281ec36a6bd65b816afbdeef79205e6241d4a27c
Gerrit-PatchSet: 8
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Milan Zamazal <mzamazal(a)redhat.com>
Gerrit-Reviewer: Arik Hadas <ahadas(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Milan Zamazal <mzamazal(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
Milan Zamazal has uploaded a new change for review.
Change subject: virt: Prevent monitoring of VMs in post-copy
......................................................................
virt: Prevent monitoring of VMs in post-copy
Migrating VMs in post-copy mode on the source end are paused. It makes
no sense to monitor them and we don't want to get error messages in the
log or experience other problems. So we skip VMs in that state in
periodic operations.
We also skip the VMs that just successfully initiated switching to
post-copy mode. Under normal circumstances, they should enter post-copy
mode shortly afterwards, so it's better to skip them immediately.
We still can't guarantee (without excessive locking) that VM doesn't
switch to post-copy (and gets paused), so we handle the corresponding
contingent failure as well.
Note that we still gather stats, since we need to know the migration
progress.
Change-Id: I010d3311ce497081720a871e2a3c715f53dcb299
Signed-off-by: Milan Zamazal <mzamazal(a)redhat.com>
Bug-Url: https://bugzilla.redhat.com/1354343
---
M lib/vdsm/virt/periodic.py
M vdsm/virt/vm.py
2 files changed, 10 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/46/64146/7
diff --git a/lib/vdsm/virt/periodic.py b/lib/vdsm/virt/periodic.py
index 132fe93..959ff1b 100644
--- a/lib/vdsm/virt/periodic.py
+++ b/lib/vdsm/virt/periodic.py
@@ -290,7 +290,8 @@
def required(self):
# Disable everything until the migration destination VM
# is fully started, to avoid false positives log spam.
- return not self._vm.incomingMigrationPending()
+ return (not self._vm.incomingMigrationPending() and
+ not self._vm.post_copy_initiated)
@property
def runnable(self):
@@ -307,6 +308,9 @@
self._vm.log.warning('could not run on %s: domain not connected',
self._vm.id)
except libvirt.libvirtError as e:
+ if self._vm.in_post_copy:
+ # race on entering post-copy, VM paused now
+ return
if e.get_error_code() in (
# race on shutdown/migration completion
libvirt.VIR_ERR_NO_DOMAIN,
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index f806c45..2fb498a 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -323,6 +323,11 @@
def in_post_copy(self):
return self._in_post_copy
+ @property
+ def post_copy_initiated(self):
+ return (self._in_post_copy or
+ self._migrationSourceThread.post_copy_initiated)
+
def _get_lastStatus(self):
# note that we don't use _statusLock here. One of the reasons is the
# non-obvious recursive locking in the following flow:
--
To view, visit https://gerrit.ovirt.org/64146
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I010d3311ce497081720a871e2a3c715f53dcb299
Gerrit-PatchSet: 7
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Milan Zamazal <mzamazal(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
Milan Zamazal has uploaded a new change for review.
Change subject: virt: Start all VM related stuff after switching to post-copy migration
......................................................................
virt: Start all VM related stuff after switching to post-copy migration
On the migration destination, we perform running-VM actions only after
the migration completes. But when the migration switches to post-copy
mode, the VM starts fully running on the destination. So switching to
post-copy should be considered as the actual start of the VM and
appropriate actions should be performed.
This patch implements unblocking the start up actions after switching to
post-copy mode.
The only exception is VM status, which must still signal migration until
the migration completes.
Change-Id: Ic8b17e58f63cbd9db09e4420871a562eaa0b3f3d
Signed-off-by: Milan Zamazal <mzamazal(a)redhat.com>
Bug-Url: https://bugzilla.redhat.com/1354343
---
M vdsm/virt/vm.py
1 file changed, 25 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/51/63551/8
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index e24a90a..ed60354 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -264,6 +264,7 @@
self._migrationSourceThread = migration.SourceThread(self)
self._kvmEnable = self.conf.get('kvmEnable', 'true')
self._incomingMigrationFinished = threading.Event()
+ self._incoming_migration_vm_running = threading.Event()
self.id = self.conf['vmId']
self._volPrepareLock = threading.Lock()
self._initTimePauseCode = None
@@ -540,6 +541,11 @@
if ('migrationDest' in self.conf or 'restoreState' in self.conf) \
and self.lastStatus != vmstatus.DOWN:
self._completeIncomingMigration()
+ if self.lastStatus == vmstatus.MIGRATION_DESTINATION:
+ # Waiting for post-copy migration to finish before we can
+ # change status to UP.
+ # Should we set a timeout here?
+ self._incomingMigrationFinished.wait()
self.lastStatus = vmstatus.UP
if self._initTimePauseCode:
@@ -2921,7 +2927,8 @@
if self._needToWaitForMigrationToComplete():
usedTimeout = self._waitForUnderlyingMigration()
self._attachLibvirtDomainAfterMigration(
- self._incomingMigrationFinished.isSet(), usedTimeout)
+ self._incoming_migration_vm_running.is_set(),
+ usedTimeout)
# else domain connection already established earlier
self._domDependentInit()
del self.conf['migrationDest']
@@ -2973,7 +2980,7 @@
def _waitForUnderlyingMigration(self):
timeout = config.getint('vars', 'migration_destination_timeout')
self.log.debug("Waiting %s seconds for end of migration", timeout)
- self._incomingMigrationFinished.wait(timeout)
+ self._incoming_migration_vm_running.wait(timeout)
return timeout
def _attachLibvirtDomainAfterMigration(self, migrationFinished, timeout):
@@ -2991,7 +2998,7 @@
raise MigrationError("Migration Error - Timed out "
"(did not receive success "
"event)")
- self.log.debug("NOTE: incomingMigrationFinished event has "
+ self.log.debug("NOTE: incoming_migration_vm_running event has "
"not been set and wait timed out after %d "
"seconds. Current VM state: %d, reason %d. "
"Continuing with VM initialization anyway.",
@@ -3920,7 +3927,7 @@
self.log.info('Release VM resources')
self.lastStatus = vmstatus.POWERING_DOWN
# Terminate the VM's creation thread.
- self._incomingMigrationFinished.set()
+ self._incoming_migration_vm_running.set()
self.guestAgent.stop()
if self._dom.connected:
result = self._destroyVm(gracefulAttempts)
@@ -4155,6 +4162,8 @@
pass
else:
hooks.after_vm_pause(domxml, self.conf)
+ elif detail == libvirt.VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY_FAILED:
+ pass # will be handled in a followup patch
elif event == libvirt.VIR_DOMAIN_EVENT_RESUMED:
self._setGuestCpuRunning(True)
@@ -4171,9 +4180,19 @@
pass
else:
hooks.after_vm_cont(domxml, self.conf)
- elif (detail == libvirt.VIR_DOMAIN_EVENT_RESUMED_MIGRATED and
- self.lastStatus == vmstatus.MIGRATION_DESTINATION):
+ elif (self.lastStatus == vmstatus.MIGRATION_DESTINATION and
+ detail == libvirt.VIR_DOMAIN_EVENT_RESUMED_MIGRATED):
+ self._incoming_migration_vm_running.set()
self._incomingMigrationFinished.set()
+ elif (self.lastStatus == vmstatus.MIGRATION_DESTINATION and
+ detail == libvirt.VIR_DOMAIN_EVENT_RESUMED_POSTCOPY):
+ # When we enter post-copy mode, the VM starts actually
+ # running on the destination, so we should unblock the
+ # start up processing here. The only exception is status,
+ # which must still signal incoming migration to not confuse
+ # Engine.
+ self._incoming_migration_vm_running.set()
+ self.log.info("Migration switched to post-copy mode")
def _updateDevicesDomxmlCache(self, xml):
"""
--
To view, visit https://gerrit.ovirt.org/63551
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic8b17e58f63cbd9db09e4420871a562eaa0b3f3d
Gerrit-PatchSet: 8
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Milan Zamazal <mzamazal(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
Milan Zamazal has uploaded a new change for review.
Change subject: virt: Fetch only minimum VM stats during post-copy migration
......................................................................
virt: Fetch only minimum VM stats during post-copy migration
When a migration switches to post-copy mode, the VM starts running on
the destination. Libvirt no longer provides actual stats on the source,
with the exception of progress, which is still available on the source
and only on the source.
This patch stops reporting stats other than progress during post-copy
migration.
Change-Id: Iac3da08b0816e7a9a247969147c17b15518c7624
Signed-off-by: Milan Zamazal <mzamazal(a)redhat.com>
Bug-Url: https://bugzilla.redhat.com/1354343
---
M vdsm/virt/migration.py
M vdsm/virt/vm.py
2 files changed, 21 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/52/63552/8
diff --git a/vdsm/virt/migration.py b/vdsm/virt/migration.py
index 13f2155..63cdf8c 100644
--- a/vdsm/virt/migration.py
+++ b/vdsm/virt/migration.py
@@ -149,6 +149,11 @@
def hibernating(self):
return self._mode == MODE_FILE
+ @property
+ def in_post_copy(self):
+ return (self._monitorThread is not None and
+ self._monitorThread.in_post_copy)
+
def getStat(self):
"""
Get the status of the migration.
@@ -653,6 +658,10 @@
def enabled(self):
return MonitorThread._MIGRATION_MONITOR_INTERVAL > 0
+ @property
+ def in_post_copy(self):
+ return self._in_post_copy
+
@utils.traceback()
def run(self):
if self.enabled:
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index e274388..f32d119 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1198,10 +1198,15 @@
if self.lastStatus == vmstatus.DOWN:
stats.update(self._getDownVmStats())
else:
- stats.update(self._getConfigVmStats())
- stats.update(self._getRunningVmStats())
+ if self.isMigrating() and self._migrationSourceThread.in_post_copy:
+ # Stats are on the destination during post-copy migration,
+ # except for migration progress, which is always on the source.
+ stats['migrationProgress'] = self._get_vm_migration_progress()
+ else:
+ stats.update(self._getConfigVmStats())
+ stats.update(self._getRunningVmStats())
+ stats.update(self._getGuestStats())
stats['status'] = self._getVmStatus()
- stats.update(self._getGuestStats())
return stats
def _getDownVmStats(self):
@@ -1255,7 +1260,7 @@
if 'pauseCode' in self.conf:
stats['pauseCode'] = self.conf['pauseCode']
if self.isMigrating():
- stats['migrationProgress'] = self.migrateStatus()['progress']
+ stats['migrationProgress'] = self._get_vm_migration_progress()
try:
vm_sample = sampling.stats_cache.get(self.id)
@@ -1346,6 +1351,9 @@
else:
return self.lastStatus
+ def _get_vm_migration_progress(self):
+ return self.migrateStatus()['progress']
+
def _getGraphicsStats(self):
def getInfo(dev):
return {
--
To view, visit https://gerrit.ovirt.org/63552
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iac3da08b0816e7a9a247969147c17b15518c7624
Gerrit-PatchSet: 8
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Milan Zamazal <mzamazal(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Milan Zamazal <mzamazal(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>