Change in vdsm[master]: utils: Add systemd_run command modifier
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: utils: Add systemd_run command modifier
......................................................................
utils: Add systemd_run command modifier
Using new cmdutils.systemd_run, you can modify a command so it will run
as a service, using its own cgroup. This is handy when starting a long
running command that should continue to run after the service starting
it is terminated.
The command will run as systemd service, and can be controlled using
systemctl. For more info see systemd-run(1).
Change-Id: Ic35bdae752228b6716c25f0b9975fc500897a592
Relates-To: https://bugzilla.redhat.com/1201355
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M configure.ac
M lib/vdsm/cmdutils.py
M lib/vdsm/constants.py.in
M tests/Makefile.am
A tests/cmdutilsTests.py
M vdsm/sudoers.vdsm.in
6 files changed, 64 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/39/40239/1
diff --git a/configure.ac b/configure.ac
index 0a30c3e..4da1955 100644
--- a/configure.ac
+++ b/configure.ac
@@ -328,6 +328,7 @@
AC_PATH_PROG([SU_PATH], [su], [/bin/su])
AC_PATH_PROG([SYSCTL_PATH], [sysctl], [/sbin/sysctl])
AC_PATH_PROG([SYSTEMCTL_PATH], [systemctl], [/bin/systemctl])
+AC_PATH_PROG([SYSTEMD_RUN_PATH], [systemd-run], [/usr/bin/systemd-run])
AC_PATH_PROG([TAR_PATH], [tar], [/bin/tar])
AC_PATH_PROG([TC_PATH], [tc], [/sbin/tc])
AC_PATH_PROG([TEE_PATH], [tee], [/usr/bin/tee])
diff --git a/lib/vdsm/cmdutils.py b/lib/vdsm/cmdutils.py
index 393bd88..b03162d 100644
--- a/lib/vdsm/cmdutils.py
+++ b/lib/vdsm/cmdutils.py
@@ -51,3 +51,15 @@
command = [constants.EXT_SUDO, SUDO_NON_INTERACTIVE_FLAG]
command.extend(cmd)
return command
+
+
+def systemd_run(cmd, scope=False, unit=None, slice=None):
+ command = [constants.EXT_SYSTEMD_RUN]
+ if scope:
+ command.append('--scope')
+ if unit:
+ command.append('--unit=%s' % unit)
+ if slice:
+ command.append('--slice=%s' % slice)
+ command.extend(cmd)
+ return command
diff --git a/lib/vdsm/constants.py.in b/lib/vdsm/constants.py.in
index 60c272c..007d1d4 100644
--- a/lib/vdsm/constants.py.in
+++ b/lib/vdsm/constants.py.in
@@ -165,3 +165,4 @@
EXT_CURL_IMG_WRAP = '@LIBEXECDIR@/curl-img-wrap'
EXT_FC_SCAN = '@LIBEXECDIR@/fc-scan'
+EXT_SYSTEMD_RUN = '@SYSTEMD_RUN_PATH@'
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7fa1c09..1b97e31 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -29,6 +29,7 @@
cPopenTests.py \
capsTests.py \
clientifTests.py \
+ cmdutilsTests.py \
concurrentTests.py \
configNetworkTests.py \
cpuProfileTests.py \
diff --git a/tests/cmdutilsTests.py b/tests/cmdutilsTests.py
new file mode 100644
index 0000000..a8c928b
--- /dev/null
+++ b/tests/cmdutilsTests.py
@@ -0,0 +1,47 @@
+#
+# Copyright 2015 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
+#
+
+from vdsm import cmdutils
+from vdsm import constants
+
+from testlib import VdsmTestCase
+
+
+class SystemdRunTests(VdsmTestCase):
+
+ def test_defaults(self):
+ cmd = cmdutils.systemd_run(['a', 'b'])
+ res = [constants.EXT_SYSTEMD_RUN, 'a', 'b']
+ self.assertEqual(cmd, res)
+
+ def test_scope(self):
+ cmd = cmdutils.systemd_run(['a', 'b'], scope=True)
+ res = [constants.EXT_SYSTEMD_RUN, '--scope', 'a', 'b']
+ self.assertEqual(cmd, res)
+
+ def test_unit(self):
+ cmd = cmdutils.systemd_run(['a', 'b'], unit='unit')
+ res = [constants.EXT_SYSTEMD_RUN, '--unit=unit', 'a', 'b']
+ self.assertEqual(cmd, res)
+
+ def test_slice(self):
+ cmd = cmdutils.systemd_run(['a', 'b'], slice='slice')
+ res = [constants.EXT_SYSTEMD_RUN, '--slice=slice', 'a', 'b']
+ self.assertEqual(cmd, res)
diff --git a/vdsm/sudoers.vdsm.in b/vdsm/sudoers.vdsm.in
index da88ff2..dd78b24 100644
--- a/vdsm/sudoers.vdsm.in
+++ b/vdsm/sudoers.vdsm.in
@@ -27,7 +27,8 @@
@MULTIPATH_PATH@, \
@SETSID_PATH@ @IONICE_PATH@ -c ? -n ? @SU_PATH@ vdsm -s /bin/sh -c /usr/libexec/vdsm/spmprotect.sh*, \
@SERVICE_PATH@ vdsmd *, \
- @REBOOT_PATH@ -f
+ @REBOOT_PATH@ -f, \
+ @SYSTEMD_RUN_PATH@
vdsm ALL=(ALL) NOPASSWD: VDSM_LIFECYCLE, VDSM_STORAGE
Defaults:vdsm !requiretty
--
To view, visit https://gerrit.ovirt.org/40239
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic35bdae752228b6716c25f0b9975fc500897a592
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
8 years, 11 months
Change in vdsm[master]: network: No need to call setupNetworks with empty arguments ...
by ibarkan@redhat.com
Ido Barkan has uploaded a new change for review.
Change subject: network: No need to call setupNetworks with empty arguments during network restoration
......................................................................
network: No need to call setupNetworks with empty arguments during network
restoration
Lets not trust setupNetwork implementation so that it is really a no-op when
called with empty input.
Change-Id: I0241e7379f799e65bbeba3e13a288e52e5dbc734
Signed-off-by: Ido Barkan <ibarkan(a)redhat.com>
---
M vdsm/vdsm-restore-net-config
1 file changed, 13 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/14/39214/1
diff --git a/vdsm/vdsm-restore-net-config b/vdsm/vdsm-restore-net-config
index 2fdba11..9bfd7a8 100755
--- a/vdsm/vdsm-restore-net-config
+++ b/vdsm/vdsm-restore-net-config
@@ -58,10 +58,13 @@
removeNetworks[network] = {'remove': True}
for bond in runningConfig.bonds:
removeBonds[bond] = {'remove': True}
- logging.debug('Removing all networks (%s) and bonds (%s) in running '
- 'config.', removeNetworks, removeBonds)
- setupNetworks(removeNetworks, removeBonds, connectivityCheck=False,
- _inRollback=True)
+ if removeNetworks or removeBonds:
+ logging.debug('Removing all networks (%s) and bonds (%s) in running '
+ 'config.', removeNetworks, removeBonds)
+ setupNetworks(removeNetworks, removeBonds, connectivityCheck=False,
+ _inRollback=True)
+ else:
+ logging.debug('runningConfig is empty. Nothing to remove')
# Flush vdsm configurations left-overs from any configurator on the system
# so that changes of configurator and persistence system are smooth.
@@ -75,9 +78,12 @@
persistentConfig = PersistentConfig()
nets, bonds = _filter_nets_bonds(persistentConfig.networks,
persistentConfig.bonds)
- logging.debug('Calling setupNetworks with networks (%s) and bond (%s).',
- nets, bonds)
- setupNetworks(nets, bonds, connectivityCheck=False, _inRollback=True)
+ if nets or bonds:
+ logging.debug('Calling setupNetworks with networks '
+ '(%s) and bond (%s).', nets, bonds)
+ setupNetworks(nets, bonds, connectivityCheck=False, _inRollback=True)
+ else:
+ logging.debug('Nothing to restore')
def _filter_nets_bonds(nets, bonds):
--
To view, visit https://gerrit.ovirt.org/39214
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0241e7379f799e65bbeba3e13a288e52e5dbc734
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ido Barkan <ibarkan(a)redhat.com>
8 years, 11 months
Change in vdsm[master]: rename variables to be consistent in vdsm-restore-net-config
by ibarkan@redhat.com
Ido Barkan has uploaded a new change for review.
Change subject: rename variables to be consistent in vdsm-restore-net-config
......................................................................
rename variables to be consistent in vdsm-restore-net-config
Change-Id: I2fcd57818ecf75a502d56f2e76e7edd0350a656f
Signed-off-by: Ido Barkan <ibarkan(a)redhat.com>
---
M vdsm/vdsm-restore-net-config
1 file changed, 16 insertions(+), 16 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/15/39215/1
diff --git a/vdsm/vdsm-restore-net-config b/vdsm/vdsm-restore-net-config
index 9bfd7a8..dccf32b 100755
--- a/vdsm/vdsm-restore-net-config
+++ b/vdsm/vdsm-restore-net-config
@@ -51,20 +51,20 @@
Builds a setupNetworks command from the persistent configuration to set it
as running configuration.
"""
- runningConfig = RunningConfig()
- removeNetworks = {}
- removeBonds = {}
- for network in runningConfig.networks:
- removeNetworks[network] = {'remove': True}
- for bond in runningConfig.bonds:
- removeBonds[bond] = {'remove': True}
- if removeNetworks or removeBonds:
+ running_config = RunningConfig()
+ remove_networks = {}
+ remove_bonds = {}
+ for network in running_config.networks:
+ remove_networks[network] = {'remove': True}
+ for bond in running_config.bonds:
+ remove_bonds[bond] = {'remove': True}
+ if remove_networks or remove_bonds:
logging.debug('Removing all networks (%s) and bonds (%s) in running '
- 'config.', removeNetworks, removeBonds)
- setupNetworks(removeNetworks, removeBonds, connectivityCheck=False,
+ 'config.', remove_networks, remove_bonds)
+ setupNetworks(remove_networks, remove_bonds, connectivityCheck=False,
_inRollback=True)
else:
- logging.debug('runningConfig is empty. Nothing to remove')
+ logging.debug('running_config is empty. Nothing to remove')
# Flush vdsm configurations left-overs from any configurator on the system
# so that changes of configurator and persistence system are smooth.
@@ -72,12 +72,12 @@
configurator_cls().flush()
# Restore non-VDSM network devices (BZ#1188251)
- configWriter = ifcfg.ConfigWriter()
- configWriter.restorePersistentBackup()
+ config_writer = ifcfg.ConfigWriter()
+ config_writer.restorePersistentBackup()
- persistentConfig = PersistentConfig()
- nets, bonds = _filter_nets_bonds(persistentConfig.networks,
- persistentConfig.bonds)
+ persistent_config = PersistentConfig()
+ nets, bonds = _filter_nets_bonds(persistent_config.networks,
+ persistent_config.bonds)
if nets or bonds:
logging.debug('Calling setupNetworks with networks '
'(%s) and bond (%s).', nets, bonds)
--
To view, visit https://gerrit.ovirt.org/39215
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2fcd57818ecf75a502d56f2e76e7edd0350a656f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ido Barkan <ibarkan(a)redhat.com>
8 years, 11 months
Change in vdsm[master]: storage: remove direct path legacy drive detection
by Martin Polednik
Martin Polednik has uploaded a new change for review.
Change subject: storage: remove direct path legacy drive detection
......................................................................
storage: remove direct path legacy drive detection
The comment in code stated:
Backward compatibility for qa scripts that specify direct paths.
This is beyond legacy and therefore should not be present. Any
script that depends on the code needs to be brought up to date.
Change-Id: Iec3d032095da22c2b182519736c397a97af634d8
Signed-off-by: Martin Polednik <mpolednik(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 0 insertions(+), 17 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/28/40528/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 6741f06..0c8a239 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -400,21 +400,6 @@
drv['truesize'] = 0
drv['apparentsize'] = 0
- def __legacyDrives(self):
- """
- Backward compatibility for qa scripts that specify direct paths.
- """
- legacies = []
- DEVICE_SPEC = ((0, 'hda'), (1, 'hdb'), (2, 'hdc'), (3, 'hdd'))
- for index, linuxName in DEVICE_SPEC:
- path = self.conf.get(linuxName)
- if path:
- legacies.append({'type': hwclass.DISK,
- 'device': 'disk', 'path': path,
- 'iface': 'ide', 'index': index,
- 'truesize': 0})
- return legacies
-
def __removableDrives(self):
removables = [{
'type': hwclass.DISK,
@@ -626,8 +611,6 @@
# Will be better to change the self.conf but this implies an API change
# Remove this when the API parameters will be consistent.
confDrives = self.conf.get('drives', [])
- if not confDrives:
- confDrives.extend(self.__legacyDrives())
confDrives.extend(self.__removableDrives())
for drv in confDrives:
--
To view, visit https://gerrit.ovirt.org/40528
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iec3d032095da22c2b182519736c397a97af634d8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(a)redhat.com>
8 years, 11 months
Change in vdsm[master]: WIP: fix again stats_cache cleaning
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: WIP: fix again stats_cache cleaning
......................................................................
WIP: fix again stats_cache cleaning
Change-Id: I98d388b4684be61936316ef749707e4be418af94
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/98/40398/1
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 3c3efc7..65e9bad 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1590,6 +1590,7 @@
utils.rmFile(self._recoveryFile)
self._guestSockCleanup(self._qemuguestSocketFile)
self._reattachHostDevices()
+ sampling.stats_cache.remove(self.id)
def _isDomainRunning(self):
try:
@@ -3447,7 +3448,6 @@
self.lastStatus = vmstatus.POWERING_DOWN
# Terminate the VM's creation thread.
self._incomingMigrationFinished.set()
- sampling.stats_cache.remove(self.id)
self.guestAgent.stop()
if self._dom:
result = self._destroyVmGraceful()
--
To view, visit https://gerrit.ovirt.org/40398
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I98d388b4684be61936316ef749707e4be418af94
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
8 years, 11 months
Change in vdsm[master]: virt: rename SampleVMs for clarity
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: virt: rename SampleVMs for clarity
......................................................................
virt: rename SampleVMs for clarity
SampleVMs is a bad name. Change it
to VMBulkSampler, which is a bit more explicative.
No changes in logic, only renaming.
Change-Id: Iadf91e0e3b7ffd4d76eff36e4906441496adb71c
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/periodic.py
M vdsm/virt/sampling.py
2 files changed, 4 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/70/40370/1
diff --git a/vdsm/virt/periodic.py b/vdsm/virt/periodic.py
index 8c79d71..33efe16 100644
--- a/vdsm/virt/periodic.py
+++ b/vdsm/virt/periodic.py
@@ -87,10 +87,10 @@
config.getint('vars', 'vm_sample_jobs_interval')),
# libvirt sampling using bulk stats can block, but unresponsive
- # domains are handled inside SampleVMs for performance reasons;
+ # domains are handled inside VMBulkSampler for performance reasons;
# thus, does not need dispatching.
Operation(
- sampling.SampleVMs(
+ sampling.VMBulkSampler(
libvirtconnection.get(cif),
cif.getVMs,
sampling.stats_cache),
diff --git a/vdsm/virt/sampling.py b/vdsm/virt/sampling.py
index 5a205f7..6804406 100644
--- a/vdsm/virt/sampling.py
+++ b/vdsm/virt/sampling.py
@@ -491,7 +491,7 @@
_TIMEOUT = 40.0
-class SampleVMs(object):
+class VMBulkSampler(object):
def __init__(self, conn, get_vms, stats_cache,
stats_flags=0, timeout=_TIMEOUT):
self._conn = conn
@@ -500,7 +500,7 @@
self._stats_flags = stats_flags
self._skip_doms = ExpiringCache(timeout)
self._sampling = Stage()
- self._log = logging.getLogger("sampling.SampleVMs")
+ self._log = logging.getLogger("sampling.VMBulkSampler")
def __call__(self):
timestamp = self._stats_cache.clock()
--
To view, visit https://gerrit.ovirt.org/40370
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iadf91e0e3b7ffd4d76eff36e4906441496adb71c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
8 years, 11 months
Change in vdsm[master]: WIP: virt: avoid periodic operations on DOWN vms
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: WIP: virt: avoid periodic operations on DOWN vms
......................................................................
WIP: virt: avoid periodic operations on DOWN vms
Avoid scary but harmless stacktraces
when VM is down but not yet collected by Engine
(e.g. after migration)
Change-Id: I63ba190b2f2830292ec282c1ec5c8eb8e42f3530
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/periodic.py
1 file changed, 9 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/70/39370/1
diff --git a/vdsm/virt/periodic.py b/vdsm/virt/periodic.py
index 529fd61..92a9f7f 100644
--- a/vdsm/virt/periodic.py
+++ b/vdsm/virt/periodic.py
@@ -33,6 +33,7 @@
from vdsm.utils import monotonic_time
from . import sampling
+from . import vmstatus
from .errors import TimeoutError
@@ -265,7 +266,8 @@
@property
def runnable(self):
- return self._vm.isDomainReadyForCommands()
+ return (self._vm.lastStatus != vmstatus.DOWN and
+ self._vm.isDomainReadyForCommands())
def __call__(self):
for drive in self._vm.getDiskDevices():
@@ -282,7 +284,8 @@
@property
def required(self):
- return self._vm.hasGuestNumaNode
+ return (self._vm.lastStatus != vmstatus.DOWN and
+ self._vm.hasGuestNumaNode)
@property
def runnable(self):
@@ -307,7 +310,8 @@
# though they will do nothing but a few check and exit
# early, as they do if a VM doesn't have Block Jobs to
# monitor (most often true).
- return self._vm.hasVmJobs
+ return (self._vm.lastStatus != vmstatus.DOWN and
+ self._vm.hasVmJobs)
@property
def runnable(self):
@@ -328,7 +332,8 @@
@property
def required(self):
# Avoid queries from storage during recovery process
- return self._vm.isDisksStatsCollectionEnabled()
+ return (self._vm.lastStatus != vmstatus.DOWN and
+ self._vm.isDisksStatsCollectionEnabled())
@property
def runnable(self):
--
To view, visit https://gerrit.ovirt.org/39370
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I63ba190b2f2830292ec282c1ec5c8eb8e42f3530
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
8 years, 11 months
Change in vdsm[master]: periodic: improve isolation in VM dispatching
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: periodic: improve isolation in VM dispatching
......................................................................
periodic: improve isolation in VM dispatching
Make VmDispatcher more robust:
- add try/except block inside the vm dispatching loop, to make sure
that one exception doesn't prevent further dispatching.
This may happen if for any reason runnable() or required() raise.
- catch exceptions to make sure to log vm id, to make troubleshooting
easier.
Change-Id: Id6ed5f1b7c332cdfe23d78571ac135a2c1714ba7
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/periodic.py
1 file changed, 19 insertions(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/39/40339/1
diff --git a/vdsm/virt/periodic.py b/vdsm/virt/periodic.py
index ef3ae37..8c79d71 100644
--- a/vdsm/virt/periodic.py
+++ b/vdsm/virt/periodic.py
@@ -226,20 +226,28 @@
skipped = []
for vm_id, vm_obj in vms.iteritems():
- op = self._create(vm_obj)
+ try:
+ op = self._create(vm_obj, self._timeout)
- if not op.required:
- continue
+ if not op.required:
+ continue
+ # When dealing with blocked domains, we also want to avoid
+ # to pile up jobs that libvirt can't handle and eventually
+ # clog it.
+ # We don't care too much about precise tracking, so it is
+ # still OK if occasional misdetection occours, but we
+ # definitely want to avoid known-bad situation and to
+ # needlessly overload libvirt.
+ if not op.runnable:
+ skipped.append(vm_id)
+ continue
- # When dealing with blocked domains, we also want to avoid
- # to pile up jobs that libvirt can't handle and eventually clog it.
- # We don't care too much about precise tracking, so it is still OK
- # if occasional misdetection occours, but we definitely want to
- # avoid known-bad situation and to needlessly overload libvirt.
- if op.runnable:
- self._executor.dispatch(op, self._timeout)
+ except Exception:
+ # we want to make sure to have VM UUID logged
+ self._log.exception("while dispatching %s to VM '%s'",
+ self._create, vm_id)
else:
- skipped.append(vm_id)
+ self._executor.dispatch(op, self._timeout)
if skipped:
self._log.warning('could not run %s on %s',
--
To view, visit https://gerrit.ovirt.org/40339
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id6ed5f1b7c332cdfe23d78571ac135a2c1714ba7
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
8 years, 11 months
Change in vdsm[master]: periodic: simplify per_vm_operation
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: periodic: simplify per_vm_operation
......................................................................
periodic: simplify per_vm_operation
per_vm_operation was added, as helper, together with
_dispatched_operation, for the sake of code readability.
However, the usage of a separate function and functools.partial
produced the opposite effect.
This patch redoes per_vm_operation as private inner function,
making it closer to its users and coalescing two separate
helpers in one.
This also makes the code shorter, so better in at least one
objective metric.
Change-Id: I27bff3c36b0507eaa77383083e224478d7e3861c
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/periodic.py
1 file changed, 4 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/27/40327/1
diff --git a/vdsm/virt/periodic.py b/vdsm/virt/periodic.py
index fe8bbc8..ef3ae37 100644
--- a/vdsm/virt/periodic.py
+++ b/vdsm/virt/periodic.py
@@ -22,7 +22,6 @@
code to perform periodic maintenance and bookkeeping of the VMs.
"""
-import functools
import logging
import threading
@@ -59,18 +58,16 @@
return interval / 2.
-def _dispatched_operation(get_vms, func, period):
- disp = VmDispatcher(get_vms, _executor, func, _timeout_from(period))
- return Operation(disp, period)
-
-
def start(cif):
global _operations
_scheduler.start()
_executor.start()
- per_vm_operation = functools.partial(_dispatched_operation, cif.getVMs)
+ def per_vm_operation(func, period):
+ disp = VmDispatcher(
+ cif.getVMs, _executor, func, _timeout_from(period))
+ return Operation(disp, period)
_operations = [
# needs dispatching becuse updating the volume stats needs the
--
To view, visit https://gerrit.ovirt.org/40327
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I27bff3c36b0507eaa77383083e224478d7e3861c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
8 years, 11 months
Change in vdsm[master]: migration: split update from getStat
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: migration: split update from getStat
......................................................................
migration: split update from getStat
Currently, migration.SourceThread.getStat() does two different, although
related, things:
- updates the internal status of the SourceThread with data from libvirt
- returns (a reference of the internal mutable) state to the caller
This patch splits the two operations, adding an explicit update()
method, and making sure getStat() is always returning up-to-date
information.
Change-Id: Ia7d357da3d421716640b7ee5336439b5c87fee5e
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/migration.py
1 file changed, 8 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/24/40524/1
diff --git a/vdsm/virt/migration.py b/vdsm/virt/migration.py
index de6d21c..6702608 100644
--- a/vdsm/virt/migration.py
+++ b/vdsm/virt/migration.py
@@ -91,10 +91,11 @@
def hibernating(self):
return self._mode == MODE_FILE
- def getStat(self):
+ def update(self):
"""
- Get the status of the migration.
+ Update the internal status of the migration.
"""
+
if self._monitorThread is not None:
# fetch migration status from the monitor thread
self._status['progress'] = self._monitorThread.progress
@@ -103,6 +104,11 @@
if 'downtime' in stat:
self._status['downtime'] = stat['downtime']
+ def getStat(self):
+ """
+ Get the status of the migration.
+ """
+ self.update()
return self._status
def _setupVdsConnection(self):
--
To view, visit https://gerrit.ovirt.org/40524
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia7d357da3d421716640b7ee5336439b5c87fee5e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
8 years, 11 months