Change in vdsm[master]: cleanup: remove persist/unpersist calls for legacy node
by Douglas Schilling Landgraf
Douglas Schilling Landgraf has uploaded a new change for review.
Change subject: cleanup: remove persist/unpersist calls for legacy node
......................................................................
cleanup: remove persist/unpersist calls for legacy node
This patch removes all related to unpersist and persist
calls exclusive for oVirt Node Legacy. oVirt Node Next doesn't
require such approach.
Change-Id: I1cca0cfa0e2254a5a8af6b3591ffe47689410415
Signed-off-by: Douglas Schilling Landgraf <dougsland(a)redhat.com>
---
M lib/vdsm/network/configurators/ifcfg.py
M lib/vdsm/tool/configfile.py
M lib/vdsm/tool/configurators/certificates.py
M lib/vdsm/tool/configurators/libvirt.py
M lib/vdsm/tool/configurators/multipath.py
M lib/vdsm/tool/configurators/passwd.py
M lib/vdsm/tool/register.py
M lib/vdsm/tool/upgrade.py
M lib/vdsm/tool/validate_ovirt_certs.py.in
M lib/vdsm/utils.py
M tests/toolTests.py
M vdsm.spec.in
M vdsm/Makefile.am
D vdsm/ovirt_functions.sh
M vdsm/vdsm-store-net-config.in
M vdsm_hooks/Makefile.am
M vdsm_hooks/fcoe/fcoe_before_network_setup.py
D vdsm_hooks/persist-vdsm-hooks.in
D vdsm_hooks/unpersist-vdsm-hook
19 files changed, 9 insertions(+), 219 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/15/63715/1
diff --git a/lib/vdsm/network/configurators/ifcfg.py b/lib/vdsm/network/configurators/ifcfg.py
index 2302ae1..0555034 100644
--- a/lib/vdsm/network/configurators/ifcfg.py
+++ b/lib/vdsm/network/configurators/ifcfg.py
@@ -55,9 +55,6 @@
from vdsm.network.netinfo.cache import ifaceUsed
from vdsm.network.netlink import waitfor
-if utils.isOvirtNode():
- from ovirt.node.utils import fs as node_fs
-
from . import Configurator, getEthtoolOpts
from ..errors import ConfigNetworkError, ERR_FAILED_IFUP
from ..models import Nic, Bridge
@@ -297,10 +294,7 @@
@staticmethod
def _removeFile(filename):
"""Remove file (directly or using oVirt node's library)"""
- if utils.isOvirtNode():
- node_fs.Config().delete(filename) # unpersists and shreds the file
- else:
- utils.rmFile(filename)
+ utils.rmFile(filename)
logging.debug("Removed file %s", filename)
def createLibvirtNetwork(self, network, bridged=True, iface=None,
@@ -512,10 +506,6 @@
except:
logging.debug('ignoring restorecon error in case '
'SElinux is disabled', exc_info=True)
-
- # make sure that ifcfg files are always persisted by the node
- if self.unifiedPersistence and utils.isOvirtNode():
- node_fs.Config().persist(fileName)
def _createConfFile(self, conf, name, ipv4, ipv6, mtu, nameservers,
**kwargs):
diff --git a/lib/vdsm/tool/configfile.py b/lib/vdsm/tool/configfile.py
index 0c49b19..bad0759 100644
--- a/lib/vdsm/tool/configfile.py
+++ b/lib/vdsm/tool/configfile.py
@@ -175,9 +175,7 @@
if self._entries:
self._writeEntries(f, oldentries)
- utils.unpersist(self._filename)
os.rename(tname, self._filename)
- utils.persist(self._filename)
if self._oldmod != os.stat(self._filename).st_mode:
os.chmod(self._filename, self._oldmod)
diff --git a/lib/vdsm/tool/configurators/certificates.py b/lib/vdsm/tool/configurators/certificates.py
index 0462b4d..edc96b3 100644
--- a/lib/vdsm/tool/configurators/certificates.py
+++ b/lib/vdsm/tool/configurators/certificates.py
@@ -23,10 +23,8 @@
from vdsm.config import config
from . import YES, NO
-from vdsm.tool.validate_ovirt_certs import validate_ovirt_certs
from vdsm.constants import P_VDSM_EXEC, SYSCONF_PATH
from vdsm.commands import execCmd
-from vdsm.utils import isOvirtNode
PKI_DIR = os.path.join(SYSCONF_PATH, 'pki/vdsm')
CA_FILE = os.path.join(PKI_DIR, 'certs/cacert.pem')
@@ -59,8 +57,6 @@
def configure():
_exec_vdsm_gencerts()
- if isOvirtNode():
- validate_ovirt_certs()
def isconfigured():
diff --git a/lib/vdsm/tool/configurators/libvirt.py b/lib/vdsm/tool/configurators/libvirt.py
index 40d4958..94c5da2 100644
--- a/lib/vdsm/tool/configurators/libvirt.py
+++ b/lib/vdsm/tool/configurators/libvirt.py
@@ -27,12 +27,8 @@
from . import InvalidRun, NO, MAYBE
from . certificates import CA_FILE, CERT_FILE, KEY_FILE
from vdsm.tool.configfile import ConfigFile, ParserWrapper
-from vdsm.tool.validate_ovirt_certs import validate_ovirt_certs
from vdsm import utils
from vdsm import constants
-
-if utils.isOvirtNode():
- from ovirt.node.utils.fs import Config as NodeCfg
requires = frozenset(('certificates',))
@@ -45,12 +41,6 @@
def configure():
- if utils.isOvirtNode():
- if not os.path.exists(constants.P_VDSM_CERT):
- raise InvalidRun(
- "vdsm: Missing certificate, vdsm not registered")
- validate_ovirt_certs()
-
# Remove a previous configuration (if present)
removeConf()
@@ -193,14 +183,11 @@
"""
delete a file if it exists.
"""
- if utils.isOvirtNode():
- NodeCfg().delete(content['path'])
- else:
- try:
- os.unlink(content['path'])
- except OSError as e:
- if e.errno != errno.ENOENT:
- raise
+ try:
+ os.unlink(content['path'])
+ except OSError as e:
+ if e.errno != errno.ENOENT:
+ raise
def _removeSection(path):
diff --git a/lib/vdsm/tool/configurators/multipath.py b/lib/vdsm/tool/configurators/multipath.py
index 00ec558..a402cda 100644
--- a/lib/vdsm/tool/configurators/multipath.py
+++ b/lib/vdsm/tool/configurators/multipath.py
@@ -112,7 +112,6 @@
backup = _CONF_FILE + '.' + time.strftime("%Y%m%d%H%M")
shutil.copyfile(_CONF_FILE, backup)
sys.stdout.write("Backup previous multipath.conf to %r\n" % backup)
- utils.persist(backup)
with tempfile.NamedTemporaryFile(
mode="wb",
@@ -125,15 +124,10 @@
if selinux.is_selinux_enabled():
selinux.restorecon(f.name)
os.chmod(f.name, 0o644)
- # On ovirt node multipath.conf is a bind mount and rename will fail
- # if we do not unpersist first, making this non-atomic.
- utils.unpersist(_CONF_FILE)
os.rename(f.name, _CONF_FILE)
except:
os.unlink(f.name)
raise
-
- utils.persist(_CONF_FILE)
# Flush all unused multipath device maps
commands.execCmd([constants.EXT_MULTIPATH, "-F"])
diff --git a/lib/vdsm/tool/configurators/passwd.py b/lib/vdsm/tool/configurators/passwd.py
index 62830df..b75228e 100644
--- a/lib/vdsm/tool/configurators/passwd.py
+++ b/lib/vdsm/tool/configurators/passwd.py
@@ -51,10 +51,6 @@
rc, _, err = commands.execCmd(script, data=libvirt_password())
if rc != 0:
raise RuntimeError("Set password failed: %s" % (err,))
- if utils.isOvirtNode():
- # It seems that all /etc/libvirt folder is persisted in node,
- # but better to persist the db file explicitly
- utils.persist(_LIBVIRT_SASLDB)
def removeConf():
diff --git a/lib/vdsm/tool/register.py b/lib/vdsm/tool/register.py
index d0ae207..ea74bec 100644
--- a/lib/vdsm/tool/register.py
+++ b/lib/vdsm/tool/register.py
@@ -266,18 +266,11 @@
__VDSM_ID = "/etc/vdsm/vdsm.id"
if self.vdsm_uuid and os.path.exists(__VDSM_ID):
- if utils.isOvirtNode():
- from ovirt.node.utils.fs import Config
- Config().unpersist(__VDSM_ID)
os.unlink(__VDSM_ID)
if not os.path.exists(__VDSM_ID):
with open(__VDSM_ID, 'w') as f:
f.write(self.uuid)
-
- if utils.isOvirtNode():
- from ovirt.node.utils.fs import Config
- Config().persist(__VDSM_ID)
self.logger.info("Host UUID: {u}".format(u=self.uuid))
@@ -294,9 +287,6 @@
if not os.path.exists(self.ca_dir):
os.makedirs(self.ca_dir, 0o755)
self._silent_restorecon(self.ca_dir)
- if utils.isOvirtNode():
- from ovirt.node.utils.fs import Config
- Config().persist(self.ca_dir)
res = self._execute_http_request(self.url_CA,
cert_validation=False)
@@ -328,10 +318,6 @@
self.logger.info("Calculated fingerprint: {f}".format(
f=self.fprint))
- if utils.isOvirtNode():
- from ovirt.node.utils.fs import Config
- Config().persist(self.ca_engine)
-
def download_ssh(self):
"""
Download ssh authorized keys and save it in the node
@@ -345,9 +331,6 @@
if not os.path.exists(_auth_keys_dir):
os.makedirs(_auth_keys_dir, 0o700)
self._silent_restorecon(_auth_keys_dir)
- if utils.isOvirtNode():
- from ovirt.node.utils.fs import Config
- Config().persist(_auth_keys_dir)
os.chown(_auth_keys_dir, _uid, _uid)
res = self._execute_http_request(self.url_ssh_key)
@@ -368,9 +351,6 @@
os.chown(_auth_keys, _uid, _uid)
os.unlink(f.name)
- if utils.isOvirtNode():
- from ovirt.node.utils.fs import Config
- Config().persist(_auth_keys)
def execute_registration(self):
"""
diff --git a/lib/vdsm/tool/upgrade.py b/lib/vdsm/tool/upgrade.py
index 4bc904c..291ef13 100644
--- a/lib/vdsm/tool/upgrade.py
+++ b/lib/vdsm/tool/upgrade.py
@@ -46,7 +46,6 @@
except (OSError, IOError):
_get_upgrade_log().exception("Failed to seal upgrade %s", upgrade.name)
else:
- utils.persist(seal_file)
_get_upgrade_log().debug("Upgrade %s successfully performed",
upgrade.name)
diff --git a/lib/vdsm/tool/validate_ovirt_certs.py.in b/lib/vdsm/tool/validate_ovirt_certs.py.in
index 53726d0..1e6a370 100644
--- a/lib/vdsm/tool/validate_ovirt_certs.py.in
+++ b/lib/vdsm/tool/validate_ovirt_certs.py.in
@@ -25,11 +25,6 @@
from . import expose, ExtraArgsError
from ..commands import execCmd
-try:
- from ovirtnode import ovirtfunctions
-except ImportError:
- pass
-
EX_OPENSSL = '@OPENSSL_PATH@'
@@ -60,8 +55,6 @@
if not is_our_cafile(PATH_CACERT):
for f in os.listdir(PATH_CERT):
if is_our_cafile(PATH_CERT + f):
- ovirtfunctions.ovirt_safe_delete_config(PATH_CACERT)
shutil.copy(PATH_CERT + f, PATH_CACERT)
os.chown(PATH_CACERT, uid, gid)
- ovirtfunctions.ovirt_store_config(PATH_CACERT)
break
diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index 0ff1a3c..5401654 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -597,12 +597,6 @@
zombiereaper.autoReapPID(self._proc.pid)
-@memoized
-def isOvirtNode():
- return (os.path.exists('/etc/rhev-hypervisor-release') or
- bool(glob.glob('/etc/ovirt-node-*-release')))
-
-
def anyFnmatch(name, patterns):
"""Returns True if any element in the patterns iterable fnmatches name."""
return any(fnmatch(name, pattern) for pattern in patterns)
diff --git a/tests/toolTests.py b/tests/toolTests.py
index e14bb53..ab741e2 100644
--- a/tests/toolTests.py
+++ b/tests/toolTests.py
@@ -334,11 +334,6 @@
libvirt,
'FILES',
FakeFiles
- ),
- (
- utils,
- 'isOvirtNode',
- lambda: False
)
])
diff --git a/vdsm.spec.in b/vdsm.spec.in
index b9ec875..4d5caf1 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -957,9 +957,6 @@
%{_sysconfdir}/libvirt/hooks/qemu
%{_libexecdir}/%{vdsm_name}/curl-img-wrap
%{_libexecdir}/%{vdsm_name}/fc-scan
-%{_libexecdir}/%{vdsm_name}/persist-vdsm-hooks
-%{_libexecdir}/%{vdsm_name}/unpersist-vdsm-hook
-%{_libexecdir}/%{vdsm_name}/ovirt_functions.sh
%{_libexecdir}/%{vdsm_name}/vdsm-gencerts.sh
%{_libexecdir}/%{vdsm_name}/vdsmd_init_common.sh
%{_libexecdir}/%{vdsm_name}/vm_migrate_hook.py*
diff --git a/vdsm/Makefile.am b/vdsm/Makefile.am
index 8b535b6..fd38601 100644
--- a/vdsm/Makefile.am
+++ b/vdsm/Makefile.am
@@ -32,9 +32,6 @@
sitecustomize.py \
$(NULL)
-dist_vdsmexec_SCRIPTS = \
- ovirt_functions.sh
-
nodist_vdsmexec_SCRIPTS = \
vdsm-gencerts.sh \
$(NULL)
diff --git a/vdsm/ovirt_functions.sh b/vdsm/ovirt_functions.sh
deleted file mode 100644
index 12f6864..0000000
--- a/vdsm/ovirt_functions.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-#
-# Copyright 2006-2010 Red Hat, Inc. and/or its affiliates.
-#
-# Licensed to you under 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. See the files README and
-# LICENSE_GPL_v2 which accompany this distribution.
-#
-
-isOvirtNode() {
- [ "$(echo /etc/ovirt-node-*-release)" != "/etc/ovirt-node-*-release" ] || \
- [ -f /etc/rhev-hypervisor-release ]
-}
-
-# execute a function if called as a script, e.g.
-# vdsm-bash-functions isOvirtNode
-
-if [ "$(basename -- "$0")" = "vdsm-bash-functions" ]; then
- "$@"
-fi
diff --git a/vdsm/vdsm-store-net-config.in b/vdsm/vdsm-store-net-config.in
index 76822ee..3292f84 100755
--- a/vdsm/vdsm-store-net-config.in
+++ b/vdsm/vdsm-store-net-config.in
@@ -16,33 +16,10 @@
PERSISTENCE=$1
-ifcfg_node_persist() {
- for f in "$NET_CONF_BACK_DIR"/*;
- do
- [ ! -f "$f" ] && continue
- bf=`basename "$f"`
- if [ -f "$NET_CONF_DIR/$bf" ];
- then
- ovirt_store_config "$NET_CONF_DIR/$bf"
- else
- ovirt_safe_delete_config "$NET_CONF_DIR/$bf"
- fi
- rm "$NET_CONF_BACK_DIR/$bf"
- done
-}
-
ifcfg_nonnode_persist() {
# Remove the backed up configuration files thus marking the ones under
# /etc/sysconfig as "safe".
rm -rf "$NET_CONF_BACK_DIR"/*
-}
-
-unified_node_persist() {
- unified_nonnode_persist
-
- # oVirt node ovirt_store_config puts the dir in persistent storage and
- # bind mounts it in the original place. So that's all we really need to do.
- ovirt_store_config "$PERS_CONF_PATH"
}
unified_nonnode_persist() {
@@ -67,21 +44,8 @@
}
-if isOvirtNode
-then
- # for node, persist the changed configuration files
-
- . /usr/libexec/ovirt-functions
-
- if [ "$PERSISTENCE" == "unified" ]; then
- unified_node_persist
- else
- ifcfg_node_persist
- fi
+if [ "$PERSISTENCE" == "unified" ]; then
+ unified_nonnode_persist
else
- if [ "$PERSISTENCE" == "unified" ]; then
- unified_nonnode_persist
- else
- ifcfg_nonnode_persist
- fi
+ ifcfg_nonnode_persist
fi
diff --git a/vdsm_hooks/Makefile.am b/vdsm_hooks/Makefile.am
index 8cbfca1..04728ad 100644
--- a/vdsm_hooks/Makefile.am
+++ b/vdsm_hooks/Makefile.am
@@ -64,18 +64,9 @@
$(NULL)
endif
-dist_vdsmexec_SCRIPTS = \
- unpersist-vdsm-hook
-
-nodist_vdsmexec_SCRIPTS = \
- persist-vdsm-hooks
-
CLEANFILES = \
config.log \
$(nodist_vdsmexec_SCRIPTS)
-
-EXTRA_DIST = \
- persist-vdsm-hooks.in
VDSMHOOKS = \
before_device_create \
diff --git a/vdsm_hooks/fcoe/fcoe_before_network_setup.py b/vdsm_hooks/fcoe/fcoe_before_network_setup.py
index c507c07..e786254 100755
--- a/vdsm_hooks/fcoe/fcoe_before_network_setup.py
+++ b/vdsm_hooks/fcoe/fcoe_before_network_setup.py
@@ -86,7 +86,6 @@
outfile.write(CONFFILE_HEADER + "\n")
for name, value in six.iteritems(config):
outfile.write('%s="%s"\n' % (name, value))
- utils.persist(filename)
def _unconfigure(interface):
@@ -95,7 +94,6 @@
"""
filename = _get_config_name(interface)
if os.path.exists(filename):
- utils.unpersist(filename)
utils.rmFile(filename)
diff --git a/vdsm_hooks/persist-vdsm-hooks.in b/vdsm_hooks/persist-vdsm-hooks.in
deleted file mode 100644
index e7423fb..0000000
--- a/vdsm_hooks/persist-vdsm-hooks.in
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/bash
-#
-# Copyright 2009-2010 Red Hat, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# Description: Persist all VDSM hooks
-#
-
-. @LIBEXECDIR(a)/ovirt_functions.sh
-
-HOOKS_DIR=/usr/libexec/vdsm/hooks
-
-if isOvirtNode
-then
- . /usr/libexec/ovirt-functions
- for hook in "$HOOKS_DIR"/*/*
- do
- if [[ -f "$hook" ]]
- then
- ovirt_store_config "$hook"
- fi
- done
-else
- echo "Host is not RHEV-Hypervisor"
- exit 1
-fi
diff --git a/vdsm_hooks/unpersist-vdsm-hook b/vdsm_hooks/unpersist-vdsm-hook
deleted file mode 100755
index af5af27..0000000
--- a/vdsm_hooks/unpersist-vdsm-hook
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-#
-# Copyright 2009-2010 Red Hat, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# Description: Unpersist VDSM Hook
-# Input: VDSM Hook file full path
-#
-
-HOOKS_DIR=/usr/libexec/vdsm/hooks
-HOOK_TO_UNPERSIST="$1"
-
-if [[ -z "$HOOK_TO_UNPERSIST" ]]; then
- echo "usage: $0 hook_file"
- exit 1
-fi
-
-if [[ -f /etc/rhev-hypervisor-release ]]
-then
- . /usr/libexec/ovirt-functions
- if [[ "$HOOK_TO_UNPERSIST" =~ ^"$HOOKS_DIR" ]]
- then
- # try to unpersist files only
- if [[ -f "$HOOK_TO_UNPERSIST" ]]
- then
- ovirt_safe_delete_config "$HOOK_TO_UNPERSIST"
- fi
- fi
-else
- echo "Host is not RHEV-Hypervisor"
- exit 1
-fi
--
To view, visit https://gerrit.ovirt.org/63715
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1cca0cfa0e2254a5a8af6b3591ffe47689410415
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland(a)redhat.com>
7 years, 4 months
Change in vdsm[master]: spbackends: simplify over-general evaluation
by Dan Kenigsberg
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>
7 years, 5 months
Change in vdsm[master]: Method not found should return proper code
by Piotr Kliczewski
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>
7 years, 5 months
Change in vdsm[master]: vdsm: log proper tag for messages comming from vdsm-logrotate
by Tomas Golembiovsky
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>
7 years, 5 months
Change in vdsm[master]: vdsm: report correct exit value in vdsm-logrotate
by Tomas Golembiovsky
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>
7 years, 5 months
Change in vdsm[master]: spec: bridge-utils are required for tests
by fabiand@redhat.com
Fabian Deutsch has uploaded a new change for review.
Change subject: spec: bridge-utils are required for tests
......................................................................
spec: bridge-utils are required for tests
Change-Id: I115f7e9d01fa74c36ef535f85474ffb16177f429
Signed-off-by: Fabian Deutsch <fabiand(a)fedoraproject.org>
---
M vdsm.spec.in
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/12/62612/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 392b071..c23cde5 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -89,6 +89,7 @@
BuildRequires: rpm-python
BuildRequires: python-blivet
BuildRequires: sanlock-python
+BuildRequires: bridge-utils
%if 0%{?with_openvswitch}
BuildRequires: openvswitch >= 2.0.0
@@ -253,7 +254,6 @@
%endif
Requires: psmisc >= 22.6-15
-Requires: bridge-utils
Requires: sos
Requires: tree
Requires: dosfstools
--
To view, visit https://gerrit.ovirt.org/62612
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I115f7e9d01fa74c36ef535f85474ffb16177f429
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand(a)redhat.com>
7 years, 5 months
Change in vdsm[master]: virt: Inform Engine about switching to post-copy
by mzamazal@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>
7 years, 5 months
Change in vdsm[master]: virt: Prevent monitoring of VMs in post-copy
by mzamazal@redhat.com
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>
7 years, 5 months
Change in vdsm[master]: virt: Start all VM related stuff after switching to post-cop...
by mzamazal@redhat.com
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>
7 years, 5 months
Change in vdsm[master]: virt: Fetch only minimum VM stats during post-copy migration
by mzamazal@redhat.com
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>
7 years, 5 months