Change in vdsm[ovirt-3.2]: Removing vdsm configuration when removing vdsm service
by Federico Simoncelli
Hello Douglas Schilling Landgraf, Yaniv Bronhaim, Dan Kenigsberg,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/13812
to review the following change.
Change subject: Removing vdsm configuration when removing vdsm service
......................................................................
Removing vdsm configuration when removing vdsm service
Before we removed that section only over rhel and we looked for the
wrong string. This patch adds sed command for both dist with the current
string that is written by vdsmd init script.
Change-Id: Ia8f59375e20efa6b5de8483a12a772f5f0ce3749
Bug-Id: https://bugzilla.redhat.com/show_bug.cgi?id=902346
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
Reviewed-on: http://gerrit.ovirt.org/11295
Reviewed-by: Dan Kenigsberg <danken(a)redhat.com>
Reviewed-by: Douglas Schilling Landgraf <dougsland(a)redhat.com>
---
M vdsm.spec.in
1 file changed, 14 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/12/13812/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 4bc4c6e..f8a2924 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -529,17 +529,25 @@
%endif
%preun
+if [ "$1" -eq 0 ]; then
+ start_conf_section="## beginning of configuration section by vdsm"
+ end_conf_section="## end of configuration section by vdsm"
+ by_vdsm="by vdsm"
+
+ /bin/sed -i -e "/${start_conf_section}/,/${end_conf_section}/d" \
+ -e "/${by_vdsm}/d" \
+ %{_sysconfdir}/libvirt/libvirtd.conf \
+ %{_sysconfdir}/libvirt/qemu.conf \
+ %{_sysconfdir}/sysconfig/libvirtd \
+ %{_sysconfdir}/sysctl.conf \
+ %{_sysconfdir}/libvirt/qemu-sanlock.conf
+fi
+
%if 0%{?rhel}
if [ "$1" -eq 0 ]
then
/sbin/service vdsmd stop > /dev/null 2>&1 || :
/sbin/chkconfig --del vdsmd
-
- /bin/sed -i '/# by vdsm$/d' \
- /etc/libvirt/libvirtd.conf \
- /etc/libvirt/qemu.conf \
- /etc/sysconfig/libvirtd \
- /etc/sysctl.conf
/bin/sed -i '/# VDSM section begin/,/# VDSM section end/d' \
/etc/sysctl.conf
--
To view, visit http://gerrit.ovirt.org/13812
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia8f59375e20efa6b5de8483a12a772f5f0ce3749
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.2
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Douglas Schilling Landgraf <dougsland(a)redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
11 years, 1 month
Change in vdsm[ovirt-3.2]: svdsm: fix fuser import in supervdsmServer
by Federico Simoncelli
Hello Yaniv Bronhaim, Dan Kenigsberg,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/13811
to review the following change.
Change subject: svdsm: fix fuser import in supervdsmServer
......................................................................
svdsm: fix fuser import in supervdsmServer
Change-Id: I319a96e1357b5ed47ef5b6bcf3dec0ce678b9748
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
Reviewed-on: http://gerrit.ovirt.org/13804
Reviewed-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
Reviewed-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm/supervdsmServer.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/11/13811/1
diff --git a/vdsm/supervdsmServer.py b/vdsm/supervdsmServer.py
index 3f7ce1c..949a7cc 100755
--- a/vdsm/supervdsmServer.py
+++ b/vdsm/supervdsmServer.py
@@ -26,7 +26,7 @@
import errno
import threading
import re
-import fuser
+from storage import fuser
from time import sleep
import signal
from multiprocessing import Pipe, Process
--
To view, visit http://gerrit.ovirt.org/13811
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I319a96e1357b5ed47ef5b6bcf3dec0ce678b9748
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.2
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
11 years, 1 month
Change in vdsm[ovirt-3.2]: Don't user sudo in fuser
by Federico Simoncelli
Hello Saggi Mizrahi, Antoni Segura Puimedon, Dan Kenigsberg,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/13810
to review the following change.
Change subject: Don't user sudo in fuser
......................................................................
Don't user sudo in fuser
Change-Id: I74842ffda1bc1d5ebb54de5e1933fedd851e745b
Signed-off-by: Saggi Mizrahi <smizrahi(a)redhat.com>
Reviewed-on: http://gerrit.ovirt.org/13779
Reviewed-by: Dan Kenigsberg <danken(a)redhat.com>
Tested-by: Antoni Segura Puimedon <asegurap(a)redhat.com>
---
M vdsm/storage/blockSD.py
M vdsm/storage/fuser.py
M vdsm/sudoers.vdsm.in
M vdsm/supervdsmServer.py
4 files changed, 9 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/10/13810/1
diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py
index e66256d..e22a1e2 100644
--- a/vdsm/storage/blockSD.py
+++ b/vdsm/storage/blockSD.py
@@ -48,7 +48,7 @@
from storage_mailbox import MAILBOX_SIZE
import resourceManager as rm
import mount
-from fuser import fuser
+import supervdsm as svdsm
STORAGE_DOMAIN_TAG = "RHAT_storage_domain"
STORAGE_UNREADY_DOMAIN_TAG = STORAGE_DOMAIN_TAG + "_UNREADY"
@@ -1122,7 +1122,8 @@
masterMount.umount()
except mount.MountError:
# umount failed, try to kill that processes holding mount point
- pids = fuser(masterMount.fs_file, mountPoint=True)
+ svdsmp = svdsm.getProxy()
+ pids = svdsmp.fuser(masterMount.fs_file, mountPoint=True)
# It was unmounted while I was checking no need to do anything
if not masterMount.isMounted():
diff --git a/vdsm/storage/fuser.py b/vdsm/storage/fuser.py
index 135dad6..0f235ee 100644
--- a/vdsm/storage/fuser.py
+++ b/vdsm/storage/fuser.py
@@ -27,7 +27,7 @@
cmd.append("-m")
cmd.append(path)
- (rc, out, err) = misc.execCmd(cmd, raw=True, sudo=True)
+ (rc, out, err) = misc.execCmd(cmd, raw=True, sudo=False)
if rc != 0:
return []
diff --git a/vdsm/sudoers.vdsm.in b/vdsm/sudoers.vdsm.in
index 4fc75f9..70628f8 100644
--- a/vdsm/sudoers.vdsm.in
+++ b/vdsm/sudoers.vdsm.in
@@ -12,7 +12,6 @@
@FSCK_PATH@ -p *, \
@TUNE2FS_PATH@ -j *, \
@MKFS_PATH@ -q -j *, \
- @FUSER_PATH@ -m *, \
@KILL_PATH@, \
@CHOWN_PATH@ @VDSMUSER@\:@QEMUGROUP@ *, \
@CHOWN_PATH@ @METADATAUSER@\:@METADATAGROUP@ *, \
diff --git a/vdsm/supervdsmServer.py b/vdsm/supervdsmServer.py
index 21e7c94..3f7ce1c 100755
--- a/vdsm/supervdsmServer.py
+++ b/vdsm/supervdsmServer.py
@@ -26,6 +26,7 @@
import errno
import threading
import re
+import fuser
from time import sleep
import signal
from multiprocessing import Pipe, Process
@@ -307,6 +308,10 @@
def removeFs(self, path):
return mkimage.removeFs(path)
+ @logDecorator
+ def fuser(self, *args):
+ return fuser.fuser(*args)
+
def __udevReloadRules(self, guid):
if self.__udevOperationReload():
reload = "--reload"
--
To view, visit http://gerrit.ovirt.org/13810
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I74842ffda1bc1d5ebb54de5e1933fedd851e745b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.2
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>
11 years, 1 month
Change in vdsm[ovirt-3.2]: split restore-net-conf away of vdsmd.init service
by Federico Simoncelli
Hello Meni Yakove, Antoni Segura Puimedon, Dan Kenigsberg,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/13813
to review the following change.
Change subject: split restore-net-conf away of vdsmd.init service
......................................................................
split restore-net-conf away of vdsmd.init service
There is no need to revert network configuration when vdsmd is
restarted, only when the host is rebooted after being fenced.
This becomes painfully visisble if vdsm is restarted due to spm
failover, and while at it - rolls back an unrelated network
configuration.
Change-Id: Iabe00320d090b9055c3d619260ed57ee953702f1
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
Reviewed-on: http://gerrit.ovirt.org/10334
Reviewed-by: Antoni Segura Puimedon <asegurap(a)redhat.com>
Tested-by: Meni Yakove <myakove(a)redhat.com>
---
M .gitignore
M vdsm.spec.in
M vdsm/Makefile.am
A vdsm/vdsm-restore-net-config.init.in
A vdsm/vdsm-restore-net-config.service
M vdsm/vdsmd.init.in
6 files changed, 86 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/13/13813/1
diff --git a/.gitignore b/.gitignore
index 49a78ef..e962f08 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,6 +40,7 @@
vdsm/vdsm.rwtab
vdsm/vdsmd.8
vdsm/vdsmd.init
+vdsm/vdsm-restore-net-config.init
vdsm-tool/load_needed_modules.py
vdsm-tool/validate_ovirt_certs.py
vdsm_cli/vdsClient
diff --git a/vdsm.spec.in b/vdsm.spec.in
index f8a2924..7d1b001 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -458,6 +458,8 @@
# Install the SysV init scripts
install -Dm 0755 vdsm/vdsmd.init %{buildroot}%{_initrddir}/vdsmd
install -Dm 0755 vdsm_reg/vdsm-reg.init %{buildroot}%{_initrddir}/vdsm-reg
+install -Dm 0755 vdsm/vdsm-restore-net-config.init \
+ %{buildroot}%{_initrddir}/vdsm-restore-net-config
# This is not commonplace, but we want /var/log/core to be a world-writable
# dropbox for core dumps
@@ -470,6 +472,8 @@
# Install the systemd scripts
install -Dm 0755 vdsm/vdsmd.init %{buildroot}/lib/systemd/systemd-vdsmd
install -Dm 0644 vdsm/vdsmd.service %{buildroot}%{_unitdir}/vdsmd.service
+install -Dm 0644 vdsm/vdsm-restore-net-config.service \
+ %{buildroot}%{_unitdir}/vdsm-restore-net-config.service
install -Dm 0755 vdsm_reg/vdsm-reg.init \
%{buildroot}/lib/systemd/systemd-vdsm-reg
install -Dm 0644 vdsm_reg/vdsm-reg.service \
@@ -519,10 +523,12 @@
%if 0%{?rhel}
if [ "$1" -eq 1 ] ; then
/sbin/chkconfig --add vdsmd
+ /sbin/chkconfig --add vdsm-restore-net-config
fi
%else
if [ "$1" -eq 1 ] ; then
/bin/systemctl enable vdsmd.service >/dev/null 2>&1 || :
+ /bin/systemctl enable vdsm-restore-net-config.service >/dev/null 2>&1 || :
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
exit 0
@@ -548,6 +554,7 @@
then
/sbin/service vdsmd stop > /dev/null 2>&1 || :
/sbin/chkconfig --del vdsmd
+ /sbin/chkconfig --del vdsm-restore-net-config
/bin/sed -i '/# VDSM section begin/,/# VDSM section end/d' \
/etc/sysctl.conf
@@ -567,6 +574,7 @@
%else
if [ "$1" -eq 0 ]; then
/bin/systemctl --no-reload disable vdsmd.service > /dev/null 2>&1 || :
+ /bin/systemctl --no-reload disable vdsm-restore-net-config.service > /dev/null 2>&1 || :
/bin/systemctl stop vdsmd.service > /dev/null 2>&1 || :
fi
exit 0
@@ -630,9 +638,11 @@
%doc COPYING README vdsm/vdsm.conf.sample
%if 0%{?rhel}
%{_initrddir}/vdsmd
+%{_initrddir}/vdsm-restore-net-config
%else
/lib/systemd/systemd-vdsmd
%{_unitdir}/vdsmd.service
+%{_unitdir}/vdsm-restore-net-config.service
%endif
%dir %attr(-, %{vdsm_user}, %{vdsm_group}) @vdsmrepo@
%ghost %dir %attr(-, %{vdsm_user}, %{vdsm_group}) @vdsmrepo@/hsm-tasks
diff --git a/vdsm/Makefile.am b/vdsm/Makefile.am
index 88b3287..224a31f 100644
--- a/vdsm/Makefile.am
+++ b/vdsm/Makefile.am
@@ -89,9 +89,11 @@
mom.conf \
sudoers.vdsm \
vdsm-logrotate.conf \
+ vdsm-restore-net-config.init \
vdsm.conf.sample \
vdsm.rwtab \
- vdsmd.init
+ vdsmd.init \
+ $(NULL)
dist_vdsm_SCRIPTS = \
addNetwork \
@@ -137,6 +139,8 @@
vdsm-libvirt-logrotate \
vdsm-logrotate \
vdsm-logrotate.conf.in \
+ vdsm-restore-net-config.init.in \
+ vdsm-restore-net-config.service \
vdsm.rwtab.in \
vdsm-store-net-config.in \
vdsm-sysctl.conf
diff --git a/vdsm/vdsm-restore-net-config.init.in b/vdsm/vdsm-restore-net-config.init.in
new file mode 100644
index 0000000..83a437a
--- /dev/null
+++ b/vdsm/vdsm-restore-net-config.init.in
@@ -0,0 +1,58 @@
+#!/bin/sh
+#
+# vdsm-restore-net-config: restore network interface configuration
+#
+# chkconfig: 2345 98 01
+# description: roll back the host network configuration to the last \
+# known-good one.
+
+### BEGIN INIT INFO
+# Provides: vdsm-restore-net-config
+# Required-Start: $network
+# Short-Description: restore network configuration files
+# Description: roll back the host network configuration to the last \
+# known-good one.
+#
+### END INIT INFO
+
+sysconfdir="/etc"
+
+# Source function library.
+test ! -r "$sysconfdir"/rc.d/init.d/functions ||
+ . "$sysconfdir"/rc.d/init.d/functions
+
+# usage [val]
+# Display usage string, then exit with VAL (defaults to 2).
+usage() {
+ echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
+ exit ${1-2}
+}
+
+retval=0
+case "$1" in
+ # commands required in all Fedora initscripts
+ start|restart|reload|force-reload|condrestart|try-restart)
+ echo -n $"Running $prog $1: "
+ @VDSMDIR@/vdsm-restore-net-config
+ retval=$?
+ echo
+ ;;
+ stop|status)
+ snapshotdir=`python -c 'from vdsm.netinfo import NET_LOGICALNET_CONF_BACK_DIR as d;print d'`
+ if test -d "$snapshotdir"
+ then
+ echo $"There are uncommitted network configuration changes"
+ else
+ echo $"No pending network configuration changes"
+ fi
+ ;;
+
+ --help)
+ usage 0
+ ;;
+ *)
+ usage
+ ;;
+esac
+
+exit $retval
diff --git a/vdsm/vdsm-restore-net-config.service b/vdsm/vdsm-restore-net-config.service
new file mode 100644
index 0000000..a43da99
--- /dev/null
+++ b/vdsm/vdsm-restore-net-config.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Restore failed Vdsm network configuration on boot
+Requires=libvirtd.service
+Before=vdsmd.service
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/usr/share/vdsm/vdsm-restore-net-config
+
+[Install]
+WantedBy=multi-user.target
diff --git a/vdsm/vdsmd.init.in b/vdsm/vdsmd.init.in
index c8223d3..873b585 100755
--- a/vdsm/vdsmd.init.in
+++ b/vdsm/vdsmd.init.in
@@ -475,7 +475,6 @@
return $ret_val
fi
- @VDSMDIR@/vdsm-restore-net-config
/usr/bin/vdsm-tool load-needed-modules
mk_data_center
mk_core_path
--
To view, visit http://gerrit.ovirt.org/13813
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iabe00320d090b9055c3d619260ed57ee953702f1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.2
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Meni Yakove <myakove(a)redhat.com>
11 years, 1 month
Change in vdsm[master]: Device custom properties: Cache device XML after hotplug
by amuller@redhat.com
Assaf Muller has uploaded a new change for review.
Change subject: Device custom properties: Cache device XML after hotplug
......................................................................
Device custom properties: Cache device XML after hotplug
We now cache new device XML after diskHotplug and nicHotplug,
just like we cache device XML when they are created during
vmCreate.
Change-Id: I1d7a78b6b9cff6484b97d42560092292b38d02c4
Signed-off-by: Assaf Muller <amuller(a)redhat.com>
---
M vdsm/libvirtvm.py
1 file changed, 2 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/02/13802/1
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index 7482dd1..18ca5aa 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -1556,6 +1556,7 @@
nicXml = nic.getXML().toprettyxml(encoding='utf-8')
nicXml = hooks.before_nic_hotplug(nicXml, self.conf,
params=params.get('custom', {}))
+ nic._deviceXML = nicXml
self.log.debug("Hotplug NIC xml: %s", nicXml)
try:
@@ -1800,6 +1801,7 @@
hooks.before_disk_hotplug(driveXml, self.conf,
params=params.get('custom', {}))
+ drive._deviceXML = driveXml
try:
self._dom.attachDevice(driveXml)
except libvirt.libvirtError as e:
--
To view, visit http://gerrit.ovirt.org/13802
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1d7a78b6b9cff6484b97d42560092292b38d02c4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Assaf Muller <amuller(a)redhat.com>
11 years, 1 month