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: Refuse to cancel post-copy migrations
......................................................................
virt: Refuse to cancel post-copy migrations
A VM in post-copy migration is split between the source and the
destination, with inconsistent memory state on both the ends of the
migration. Stopping the migration in that phase is not a good idea, it
loses the VM and leaves it in the pause state on the source and may lead
to data loss.
Since it's not possible to stop a post-copy migration safely and the
migration is guaranteed to finish sooner or later, we prevent its
cancellation with this patch.
Change-Id: I670ab48ed3fe69582646675d8b683bcdb3cfa038
Signed-off-by: Milan Zamazal <mzamazal(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 25 insertions(+), 17 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/54/63554/10
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index b5a92cb..11cacc9 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -274,6 +274,7 @@
self._guestEventTime = 0
self._guestCpuRunning = False
self._guestCpuLock = threading.Lock()
+ self._post_copy_lock = threading.Lock()
self._startTime = time.time() - \
float(self.conf.pop('elapsedTimeOffset', 0))
@@ -1447,20 +1448,26 @@
return self._migrationSourceThread.getStat()
def migrateCancel(self):
- self._acquireCpuLockWithTimeout()
- try:
- self._migrationSourceThread.stop()
- self._migrationSourceThread.status['status']['message'] = \
- 'Migration process cancelled'
- return self._migrationSourceThread.status
- except libvirt.libvirtError as e:
- if e.get_error_code() == libvirt.VIR_ERR_OPERATION_INVALID:
+ with self._post_copy_lock:
+ if self.post_copy:
+ return response.error(
+ 'migCancelErr',
+ message=("Can't cancel migration in post-copy mode")
+ )
+ self._acquireCpuLockWithTimeout()
+ try:
+ self._migrationSourceThread.stop()
+ self._migrationSourceThread.status['status']['message'] = \
+ 'Migration process cancelled'
+ return self._migrationSourceThread.status
+ except libvirt.libvirtError as e:
+ if e.get_error_code() == libvirt.VIR_ERR_OPERATION_INVALID:
+ return response.error('migCancelErr')
+ raise
+ except virdomain.NotConnectedError:
return response.error('migCancelErr')
- raise
- except virdomain.NotConnectedError:
- return response.error('migCancelErr')
- finally:
- self._guestCpuLock.release()
+ finally:
+ self._guestCpuLock.release()
def _getSerialConsole(self):
"""
@@ -1512,10 +1519,11 @@
corresponding libvirt event.
"""
self.log.info('Switching to post-copy migration')
- result = self._dom.migrateStartPostCopy(0)
- success = result >= 0
- if success:
- self._post_copy = True
+ with self._post_copy_lock:
+ result = self._dom.migrateStartPostCopy(0)
+ success = result >= 0
+ if success:
+ self._post_copy = True
return success
def _customDevices(self):
--
To view, visit https://gerrit.ovirt.org/63554
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I670ab48ed3fe69582646675d8b683bcdb3cfa038
Gerrit-PatchSet: 10
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>
Milan Zamazal has uploaded a new change for review.
Change subject: virt: Use a variable for self._vm in MonitorThread action handling
......................................................................
virt: Use a variable for self._vm in MonitorThread action handling
This is a reformatting patch to prevent further line breaking in a
followup patch.
Change-Id: I3e41f8b3ef27319c51e18ad2c75bbb3c61b61c76
Signed-off-by: Milan Zamazal <mzamazal(a)redhat.com>
---
M vdsm/virt/migration.py
1 file changed, 6 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/53/63553/9
diff --git a/vdsm/virt/migration.py b/vdsm/virt/migration.py
index 4633d47..6cd88f4 100644
--- a/vdsm/virt/migration.py
+++ b/vdsm/virt/migration.py
@@ -783,19 +783,19 @@
def _execute_action_with_params(self, action_with_params):
action = str(action_with_params['name'])
+ vm = self._vm
if action == CONVERGENCE_SCHEDULE_SET_DOWNTIME:
downtime = int(action_with_params['params'][0])
- self._vm.log.debug('Setting downtime to %d',
- downtime)
- self._vm._dom.migrateSetMaxDowntime(downtime, 0)
+ vm.log.debug('Setting downtime to %d', downtime)
+ vm._dom.migrateSetMaxDowntime(downtime, 0)
elif action == CONVERGENCE_SCHEDULE_POST_COPY:
if not self._vm.switch_migration_to_post_copy():
# Do nothing for now; the next action will be invoked after a
# while
- self._vm.log.warn('Failed to switch to post-copy migration')
+ vm.log.warn('Failed to switch to post-copy migration')
elif action == CONVERGENCE_SCHEDULE_SET_ABORT:
- self._vm.log.warn('Aborting migration')
- self._vm._dom.abortJob()
+ vm.log.warn('Aborting migration')
+ vm._dom.abortJob()
self.stop()
--
To view, visit https://gerrit.ovirt.org/63553
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e41f8b3ef27319c51e18ad2c75bbb3c61b61c76
Gerrit-PatchSet: 9
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: Stop guest agent before switching to post-copy
......................................................................
virt: Stop guest agent before switching to post-copy
Post-copy migration pauses the VM on the source. We don't want to get
spurious log messages from the guest agent about not being able to talk
to the VM or being disconnected from the communication socket. So we
stop the guest agent before switching to post-copy mode.
If switching to post-copy fails (which should rarely happen), we start
the agent again. Starting the agent may fail, e.g. in case the VM got
destroyed in the meantime. So we catch the contingent exception.
Change-Id: Ibd855ee36847b293009ac35d8d03b01521aaace8
Signed-off-by: Milan Zamazal <mzamazal(a)redhat.com>
Bug-Url: https://bugzilla.redhat.com/1354343
---
M vdsm/virt/migration.py
1 file changed, 7 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/45/64145/7
diff --git a/vdsm/virt/migration.py b/vdsm/virt/migration.py
index 2c73375..522a4fc 100644
--- a/vdsm/virt/migration.py
+++ b/vdsm/virt/migration.py
@@ -807,6 +807,7 @@
vm._dom.migrateSetMaxDowntime(downtime, 0)
elif action == CONVERGENCE_SCHEDULE_POST_COPY:
vm.log.info('Switching to post-copy migration')
+ vm.guestAgent.stop()
ret = vm.switch_migration_to_post_copy()
if ret >= 0:
self._post_copy_initiated = True
@@ -814,6 +815,12 @@
# Do nothing for now; the next action will be invoked after
# a while
vm.log.warn('Failed to switch to post-copy migration')
+ try:
+ vm.guestAgent.start()
+ except:
+ self.log.exception("Failed to start guest agent after "
+ "unsuccessful switch to post-copy "
+ "migration")
elif action == CONVERGENCE_SCHEDULE_SET_ABORT:
vm.log.warn('Aborting migration')
vm._dom.abortJob()
--
To view, visit https://gerrit.ovirt.org/64145
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibd855ee36847b293009ac35d8d03b01521aaace8
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: Milan Zamazal <mzamazal(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>