Change in vdsm[master]: hook: before_network_rollback
by phoracek@redhat.com
Petr Horáček has uploaded a new change for review.
Change subject: hook: before_network_rollback
......................................................................
hook: before_network_rollback
When an exception occurs during network setup, rollback is executed
and after_network_setup is never triggered.
This hook point triggers hooks right before rollback (if needed).
Change-Id: I8a5d086b15b72c13d2b390c1310c2279446ac14f
Signed-off-by: Petr Horáček <phoracek(a)redhat.com>
---
M vdsm.spec.in
M vdsm/hooks.py
M vdsm/network/api.py
M vdsm/vdsmd.8.in
M vdsm_hooks/Makefile.am
5 files changed, 27 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/85/45085/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 72e7df6..53e388e 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -962,6 +962,7 @@
%dir %{_libexecdir}/%{vdsm_name}/hooks/after_disk_hotunplug
%dir %{_libexecdir}/%{vdsm_name}/hooks/before_vdsm_start
%dir %{_libexecdir}/%{vdsm_name}/hooks/after_vdsm_stop
+%dir %{_libexecdir}/%{vdsm_name}/hooks/before_network_rollback
%dir %{_libexecdir}/%{vdsm_name}/hooks/before_network_setup
%dir %{_libexecdir}/%{vdsm_name}/hooks/after_network_setup
%dir %{_libexecdir}/%{vdsm_name}/hooks/before_set_num_of_cpus
diff --git a/vdsm/hooks.py b/vdsm/hooks.py
index 5a4d25e..d3f8741 100644
--- a/vdsm/hooks.py
+++ b/vdsm/hooks.py
@@ -351,6 +351,11 @@
raiseError=False, hookType=_JSON_HOOK)
+def before_network_rollback(network_config_dict):
+ return _runHooksDir(network_config_dict, 'before_network_rollback',
+ raiseError=False, hookType=_JSON_HOOK)
+
+
def before_get_vm_stats():
return _runHooksDir({}, 'before_get_vm_stats', raiseError=True,
hookType=_JSON_HOOK)
diff --git a/vdsm/network/api.py b/vdsm/network/api.py
index 5c8bed5..7798497 100755
--- a/vdsm/network/api.py
+++ b/vdsm/network/api.py
@@ -19,6 +19,7 @@
from __future__ import absolute_import
from __future__ import print_function
+from contextlib import contextmanager
from functools import wraps
import errno
import inspect
@@ -865,7 +866,8 @@
kernel_config = netconfpersistence.KernelConfig(_netinfo)
normalized_config = kernel_config.normalize(
netconfpersistence.BaseConfig(networks, bondings))
- with ConfiguratorClass(in_rollback) as configurator:
+ with ConfiguratorClass(in_rollback) as configurator,\
+ _hooks_before_network_rollback(networks, bondings, options):
# Remove edited networks and networks with 'remove' attribute
for network, attrs in networks.items():
if network in _netinfo.networks:
@@ -907,6 +909,16 @@
hooks.after_network_setup(_buildSetupHookDict(networks, bondings, options))
+@contextmanager
+def _hooks_before_network_rollback(networks, bondings, options):
+ try:
+ yield
+ except:
+ hooks.before_network_rollback(
+ _buildSetupHookDict(networks, bondings, options))
+ raise
+
+
def _vlanToInternalRepresentation(vlan):
if vlan is None or vlan == '':
vlan = None
diff --git a/vdsm/vdsmd.8.in b/vdsm/vdsmd.8.in
index 5dcac3f..a42e329 100644
--- a/vdsm/vdsmd.8.in
+++ b/vdsm/vdsmd.8.in
@@ -57,7 +57,7 @@
before_disk_hotplug, after_disk_hotplug,
before_disk_hotunplug, after_disk_hotunplug,
before_vdsm_start, after_vdsm_stop,
- before_network_setup, after_network_setup,
+ before_network_setup, after_network_setup, before_network_rollback,
before_set_num_of_cpus, after_set_num_of_cpus,
before_get_vm_stats, after_get_vm_stats,
before_get_all_vm_stats, after_get_all_vm_stats,
@@ -72,11 +72,10 @@
.SS Hook environment
Each hook script (except before_vdsm_start, after_vdsm_stop,
-before_network_setup and after_network_setup, before_get_vm_stats,
-after_get_vm_stats, before_get_all_vm_stats, after_get_all_vm_stats,
-before_get_caps, after_get_caps,
-before_get_stats, after_get_stats,
-and after_hostdev_list_by_caps) inherit
+before_network_setup and after_network_setup, before_network_rollback,
+before_get_vm_stats, after_get_vm_stats, before_get_all_vm_stats,
+after_get_all_vm_stats, before_get_caps, after_get_caps, before_get_stats,
+after_get_stats, and after_hostdev_list_by_caps) inherit
the environment of the VDSM process, with an additional variable
.B _hook_domxml
which holds the path of libvirt's
@@ -86,8 +85,8 @@
available as the environment variable
.B vmId.
-The before_network_setup and after_network_setup hooks do also include an
-extra environment variable
+The before_network_setup, after_network_setup and before_network_rollback
+hooks do also include an extra environment variable
.B _hook_json
which holds a pointer to a file with the network parameters that vdsm is
setting up (
diff --git a/vdsm_hooks/Makefile.am b/vdsm_hooks/Makefile.am
index 7dc9ff2..5e8d401 100644
--- a/vdsm_hooks/Makefile.am
+++ b/vdsm_hooks/Makefile.am
@@ -115,6 +115,7 @@
after_disk_hotunplug \
before_vdsm_start \
after_vdsm_stop \
+ before_network_rollback \
before_network_setup \
after_network_setup \
before_set_num_of_cpus \
--
To view, visit https://gerrit.ovirt.org/45085
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8a5d086b15b72c13d2b390c1310c2279446ac14f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phoracek(a)redhat.com>
8 years, 6 months
Change in vdsm[master]: net: ovs: remove initial nic ip, dont touch unchanged networks
by phoracek@redhat.com
Petr Horáček has uploaded a new change for review.
Change subject: net: ovs: remove initial nic ip, dont touch unchanged networks
......................................................................
net: ovs: remove initial nic ip, dont touch unchanged networks
According to ifcfg configurator behavior, now we remove inital IP
configuration of nics attached to VDSM network.
Also there is an improvement in IP changes handling: If IP configuration
was not changed, don't recreate it.
Signed-off-by: Petr Horáček <phoracek(a)redhat.com>
Change-Id: Ie9682c75cfb79f75b64cb8cb587fc3ed01cf15c8
---
M vdsm_hooks/ovs/ovs_before_network_setup.py
M vdsm_hooks/ovs/ovs_before_network_setup_ip.py
2 files changed, 53 insertions(+), 18 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/92/46692/1
diff --git a/vdsm_hooks/ovs/ovs_before_network_setup.py b/vdsm_hooks/ovs/ovs_before_network_setup.py
index 6cef711..a8aa707 100755
--- a/vdsm_hooks/ovs/ovs_before_network_setup.py
+++ b/vdsm_hooks/ovs/ovs_before_network_setup.py
@@ -81,7 +81,8 @@
with _rollback(running_config, initial_config, in_rollback):
configure_ovs(commands, libvirt_create, libvirt_remove, running_config)
configure_mtu(running_config)
- configure_ip(nets, initial_config.networks)
+ configure_ip(nets, initial_config.networks, bonds,
+ initial_config.bonds)
hooking.log('Saving running configuration: %s %s' %
(running_config.networks, running_config.bonds))
diff --git a/vdsm_hooks/ovs/ovs_before_network_setup_ip.py b/vdsm_hooks/ovs/ovs_before_network_setup_ip.py
index 90640a4..ba6b6d3 100644
--- a/vdsm_hooks/ovs/ovs_before_network_setup_ip.py
+++ b/vdsm_hooks/ovs/ovs_before_network_setup_ip.py
@@ -17,6 +17,7 @@
#
# Refer to the README and COPYING files for full details of the license
#
+import os
import sys
from vdsm import ipwrapper, sysctl
@@ -27,7 +28,7 @@
# TODO: move required modules into vdsm/lib
sys.path.append('/usr/share/vdsm')
-from network.configurators.dhclient import DhcpClient
+from network.configurators.dhclient import DhcpClient, kill_dhclient
from network.configurators.iproute2 import Iproute2
from network.models import NetDevice, IPv4, IPv6
from network.sourceroute import DynamicSourceRoute
@@ -89,7 +90,7 @@
iproute2._addSourceRoute(net_dev)
-def _remove_ip_config(iface, ipv4, ipv6):
+def _remove_ip_config(iface, ipv4, ipv6, vdsm=True):
net_dev = NetDevice(iface, iproute2, ipv4=ipv4, ipv6=ipv6)
DynamicSourceRoute.addInterfaceTracking(net_dev)
DhcpClient(iface).shutdown()
@@ -99,25 +100,58 @@
ipwrapper.addrFlush(iface)
-def configure_ip(nets, init_nets):
+def _drop_ip_config(iface):
+ """Remove IP configuration of a new nic attached to VDSM"""
+ if os.path.exists(os.path.join('/sys/class/net', iface)):
+ kill_dhclient(iface, family=4) # kill_dhclient flushes IP
+ kill_dhclient(iface, family=6)
+
+
+def configure_ip(nets, init_nets, bonds, init_bonds):
+
+ def _gather_ip_config(attrs):
+ top_dev = net if 'vlan' in attrs else BRIDGE_NAME
+ ipv4 = _get_ipv4_model(attrs)
+ ipv6 = _get_ipv6_model(attrs)
+ port = attrs.get('nic') or attrs.get('bonding')
+ blocking_dhcp = 'blockingdhcp' in attrs
+ return top_dev, ipv4, ipv6, port, blocking_dhcp
+
ip_config_to_set = {}
ip_config_to_remove = {}
- for net, attrs in nets.items():
- if net in init_nets:
- init_attrs = init_nets[net]
- init_top_dev = net if 'vlan' in init_attrs else BRIDGE_NAME
- ipv4 = _get_ipv4_model(init_attrs)
- ipv6 = _get_ipv6_model(init_attrs)
+ for net, attrs in nets.iteritems():
+ if 'remove' in attrs: # if network was removed
+ # remove networks IP config (running dhclient)
+ init_top_dev, ipv4, ipv6, _, _ = _gather_ip_config(init_nets[net])
ip_config_to_remove[init_top_dev] = ipv4, ipv6
- if 'remove' not in attrs:
- top_dev = net if 'vlan' in attrs else BRIDGE_NAME
- ipv4 = _get_ipv4_model(attrs)
- ipv6 = _get_ipv6_model(attrs)
- port = attrs.get('nic') or attrs.get('bonding')
- if ipv4 or ipv6:
- ip_config_to_set[top_dev] = (
- ipv4, ipv6, port, 'blockingdhcp' in attrs)
+ else:
+ top_dev, ipv4, ipv6, port, blocking_dhcp = _gather_ip_config(attrs)
+
+ if net in init_nets: # if network was edited
+ init_top_dev, init_ipv4, init_ipv6, _, _ = \
+ _gather_ip_config(init_nets[net])
+
+ # drop IP of newly attached nics
+ if init_nets[net].get('nic') != attrs.get('nic') is not None:
+ _drop_ip_config(attrs.get('nic'))
+
+ # if IP config is to be changed or net top device was changed,
+ # remove initial configuration and set the new one if any
+ if (ipv4 != init_ipv4 or ipv6 != init_ipv6 or
+ attrs.get('vlan') != init_nets[net].get('vlan')):
+ ip_config_to_remove[init_top_dev] = ipv4, ipv6
+ if ipv4 or ipv6:
+ ip_config_to_set[top_dev] = (ipv4, ipv6, port,
+ blocking_dhcp)
+ else: # if network was added
+ # set networks IP configuration if any
+ if ipv4 or ipv6:
+ ip_config_to_set[top_dev] = (ipv4, ipv6, port,
+ blocking_dhcp)
+ # drop IP of newly attached nics
+ if attrs.get('nic') is not None:
+ _drop_ip_config(attrs.get('nic'))
hooking.log('Remove IP configuration of: %s' % ip_config_to_remove)
hooking.log('Set IP configuration: %s' % ip_config_to_set)
--
To view, visit https://gerrit.ovirt.org/46692
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie9682c75cfb79f75b64cb8cb587fc3ed01cf15c8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phoracek(a)redhat.com>
8 years, 6 months
Change in vdsm[ovirt-3.6]: spec: install bonding-defaults.json with 644 permissions, no...
by osvoboda@redhat.com
Ondřej Svoboda has uploaded a new change for review.
Change subject: spec: install bonding-defaults.json with 644 permissions, not 600
......................................................................
spec: install bonding-defaults.json with 644 permissions, not 600
This way make check succeeds under non-root account for
testIterNetworkHierarchy, testTextualRepr and testValidateBondingOptions
which previously failed to read the file.
Change-Id: I3090cb77c8b6329c4885c6dbd43b04998df20dfe
Signed-off-by: Ondřej Svoboda <osvoboda(a)redhat.com>
Reviewed-on: https://gerrit.ovirt.org/46395
Continuous-Integration: Jenkins CI
Reviewed-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm.spec.in
1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/01/46401/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index f000f63..8772640 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -1006,7 +1006,6 @@
%dir %{_sysconfdir}/pki/%{vdsm_name}/certs
%dir %{_sysconfdir}/pki/%{vdsm_name}/libvirt-spice
%config(noreplace) %{_sysconfdir}/pki/%{vdsm_name}/keys/libvirt_password
-%{_localstatedir}/lib/%{vdsm_name}/bonding-defaults.json
%dir %{_localstatedir}/lib/%{vdsm_name}
%dir %{_localstatedir}/lib/%{vdsm_name}/netconfback
%dir %{_localstatedir}/lib/%{vdsm_name}/persistence
@@ -1018,6 +1017,8 @@
%dir %{_localstatedir}/run/%{vdsm_name}/v2v
%dir %{_localstatedir}/log/%{vdsm_name}
%dir %{_localstatedir}/log/%{vdsm_name}/backup
+%defattr(644, %{vdsm_user}, %{vdsm_group}, -)
+%{_localstatedir}/lib/%{vdsm_name}/bonding-defaults.json
%files python
%defattr(-, root, root, -)
--
To view, visit https://gerrit.ovirt.org/46401
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3090cb77c8b6329c4885c6dbd43b04998df20dfe
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Ondřej Svoboda <osvoboda(a)redhat.com>
8 years, 6 months
Change in vdsm[master]: spec: Require newer libvirt version for el7
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: spec: Require newer libvirt version for el7
......................................................................
spec: Require newer libvirt version for el7
Libvirt 1.2.17 introduced a regression where physical volume size is
always zero. This breaks our extension logic, using:
physical - alloc < drive.watermarkLimit
As a result, we try to extend the drive on each check to next size after
0 (1GiB), spamming the logs with lvm warnings. Finally the vm is paused,
since we never extend the disk.
Libvirt 1.2.17-5 fixed this issue. We require now this version.
The issue is probably effecting also Fedora 23. We will provide a
separate patch for Fedora if needed.
Change-Id: Iea42288e779ba8a63968087d1df27e0f3665e406
Bug-Url: https://bugzilla.redhat.com/1251008
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm.spec.in
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/34/44834/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index d17338d..cd25ee5 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -150,8 +150,8 @@
Requires: libvirt-daemon-driver-qemu
%if 0%{?rhel}
-Requires: libvirt-daemon >= 1.2.8-16.el7_1.2
-Requires: libvirt-python >= 1.2.8-7.el7_1.1
+Requires: libvirt-daemon >= 1.2.17-5.el7
+Requires: libvirt-python >= 1.2.17.el7
%endif # rhel
%if 0%{?fedora} >= 22
--
To view, visit https://gerrit.ovirt.org/44834
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iea42288e779ba8a63968087d1df27e0f3665e406
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
8 years, 6 months
Change in vdsm[master]: nettestlib: add ppc64le TUNSETIFF value
by Martin Polednik
Martin Polednik has uploaded a new change for review.
Change subject: nettestlib: add ppc64le TUNSETIFF value
......................................................................
nettestlib: add ppc64le TUNSETIFF value
ppc64le shares the same TUNSETIFF as ppc64 and shouldn't be treated as
unsupported architecture.
Change-Id: I0d3e907c97f1fa2409fda9fb3f1cb7cc91dd045b
Signed-off-by: Martin Polednik <mpolednik(a)redhat.com>
---
M tests/nettestlib.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/55/46955/1
diff --git a/tests/nettestlib.py b/tests/nettestlib.py
index 4a04552..8bcb3ab 100644
--- a/tests/nettestlib.py
+++ b/tests/nettestlib.py
@@ -101,7 +101,7 @@
_IFF_NO_PI = 0x1000
if cpuinfo.arch() == cpuinfo.Architecture.X86_64:
_TUNSETIFF = 0x400454ca
- elif cpuinfo.arch() == 'ppc64':
+ elif cpuinfo.arch() in cpuinfo.Architecture.POWER:
_TUNSETIFF = 0x800454ca
else:
raise cpuinfo.UnsupportedArchitecture
--
To view, visit https://gerrit.ovirt.org/46955
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0d3e907c97f1fa2409fda9fb3f1cb7cc91dd045b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(a)redhat.com>
8 years, 6 months
Change in vdsm[master]: faqemu: refactor and upate
by Martin Polednik
Martin Polednik has uploaded a new change for review.
Change subject: faqemu: refactor and upate
......................................................................
faqemu: refactor and upate
Faqemu hook wasn't really updated to allow for running of
cross-platform VMs. This patch refactors the logic and adds workarounds
to run VMs of 'opposite' architecture. The VM is still run on host's
arch, but the constraints for selected architecture are still respected.
Change-Id: Icb82b492e33d507e198901f7ecc77531b0680711
Signed-off-by: Martin Polednik <mpolednik(a)redhat.com>
---
M vdsm_hooks/faqemu/before_vm_start.py
1 file changed, 117 insertions(+), 16 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/61/46961/1
diff --git a/vdsm_hooks/faqemu/before_vm_start.py b/vdsm_hooks/faqemu/before_vm_start.py
index 2755092..13a88f4 100644
--- a/vdsm_hooks/faqemu/before_vm_start.py
+++ b/vdsm_hooks/faqemu/before_vm_start.py
@@ -19,31 +19,66 @@
# Refer to the README and COPYING files for full details of the license
#
+from functools import wraps
+
import hooking
+from vdsm import cpuinfo
from vdsm.config import config
-if config.getboolean('vars', 'fake_kvm_support'):
- domxml = hooking.read_domxml()
- domxml.documentElement.setAttribute("type", "qemu")
- graphics = domxml.getElementsByTagName("graphics")[0]
- graphics.removeAttribute("passwdValidTo")
+_WORKAROUNDS = []
- memory = config.get('vars', 'fake_kvm_memory')
- if memory != '0':
- for memtag in ("memory", "currentMemory"):
- memvalue = domxml.getElementsByTagName(memtag)[0]
- while memvalue.firstChild:
- memvalue.removeChild(memvalue.firstChild)
+def register_workaround(arch=None, target_arch=None):
+ def workaround(function):
+ @wraps(function)
+ def wrapped(*args, **kwargs):
+ return function(*args, **kwargs)
- memvalue.appendChild(domxml.createTextNode(memory))
+ if ((not arch or arch == cpuinfo.arch()) and
+ (not target_arch or target_arch == cpuinfo.target_arch())):
+ _WORKAROUNDS.append(wrapped)
- for cputag in domxml.getElementsByTagName("cpu"):
- for modeltag in cputag.getElementsByTagName('model'):
- cputag.removeChild(modeltag)
+ return wrapped
+ return workaround
- for controllertag in domxml.getElementsByTagName("controller"):
+
+@register_workaround()
+def _set_qemu(domxml):
+ domxml.documentElement.setAttribute('type', 'qemu')
+
+
+(a)register_workaround(arch=cpuinfo.Architecture.PPC64LE)
+def _graphics_spice_to_vnc(domxml):
+ graphics = domxml.getElementsByTagName('graphics')[0]
+ graphics.setAttribute('type', 'vnc')
+
+
+(a)register_workaround(arch=cpuinfo.Architecture.PPC64LE,
+ target_arch=cpuinfo.Architecture.X86_64)
+def _video_spice_to_vnc(domxml):
+ videotag = domxml.getElementsByTagName('video')[0]
+ modeltag = videotag.getElementsByTagName('model')[0]
+ modeltag.setAttribute('type', 'vga')
+
+
+@register_workaround()
+def _graphics_remove_passwd(domxml):
+ graphics = domxml.getElementsByTagName('graphics')[0]
+ graphics.removeAttribute('passwdValidTo')
+
+
+@register_workaround()
+def _cpu_remove_model(domxml):
+ cputag = domxml.getElementsByTagName('cpu')[0]
+ modeltag = cputag.getElementsByTagName('model')[0]
+ cputag.removeChild(modeltag)
+
+
+(a)register_workaround(arch=cpuinfo.Architecture.X86_64,
+ target_arch=cpuinfo.Architecture.PPC64LE)
+def _controller_remove_spapr(domxml):
+ for controllertag in domxml.getElementsByTagName('controller'):
for child in controllertag.childNodes:
try:
if child.getAttribute('type') == 'spapr-vio':
@@ -51,4 +86,70 @@
except AttributeError:
continue
+
+(a)register_workaround(arch=cpuinfo.Architecture.PPC64LE)
+def _os_set_machine_type_pseries(domxml):
+ ostag = domxml.getElementsByTagName('os')[0]
+ typetag = ostag.getElementsByTagName('type')[0]
+ typetag.setAttribute('machine', 'pseries')
+
+
+(a)register_workaround(arch=cpuinfo.Architecture.X86_64,
+ target_arch=cpuinfo.Architecture.PPC64LE)
+def _os_set_machine_type_i440fx(domxml):
+ ostag = domxml.getElementsByTagName('os')[0]
+ typetag = ostag.getElementsByTagName('type')[0]
+ typetag.setAttribute('machine', 'pc-i440fx-rhel7.1.0')
+
+
+(a)register_workaround(arch=cpuinfo.Architecture.PPC64LE,
+ target_arch=cpuinfo.Architecture.X86_64)
+def _sysinfo_remove_smbios(domxml):
+ sysinfotag = domxml.getElementsByTagName('sysinfo')[0]
+ sysinfotag.parentNode.removeChild(sysinfotag)
+
+ smbiostag = domxml.getElementsByTagName('smbios')[0]
+ smbiostag.parentNode.removeChild(smbiostag)
+
+
+(a)register_workaround(arch=cpuinfo.Architecture.PPC64LE,
+ target_arch=cpuinfo.Architecture.X86_64)
+def _disk_remove_ide(domxml):
+ for disktag in domxml.getElementsByTagName('disk'):
+ if disktag.getElementsByTagName(
+ 'target')[0].getAttribute('bus') == 'ide':
+ disktag.parentNode.removeChild(disktag)
+
+
+(a)register_workaround(arch=cpuinfo.Architecture.PPC64LE,
+ target_arch=cpuinfo.Architecture.X86_64)
+def _channel_remove_spicevmc(domxml):
+ for channeltag in domxml.getElementsByTagName('channel'):
+ if channeltag.getAttribute('type') == 'spicevmc':
+ channeltag.parentNode.removeChild(channeltag)
+
+
+(a)register_workaround(arch=cpuinfo.Architecture.PPC64LE,
+ target_arch=cpuinfo.Architecture.X86_64)
+def _memory_lower_max(domxml):
+ maxmemorytag = domxml.getElementsByTagName('maxMemory')[0]
+ maxmemorytag.setAttribute('slots', '2')
+ maxmemorytag.firstChild.nodeValue = '1073741824'
+
+
+@register_workaround()
+def _memory_update(domxml):
+ value = config.get('vars', 'fake_kvm_memory')
+ if value != '0':
+ for memtag in ('memory', 'currentMemory'):
+ memvalue = domxml.getElementsByTagName(memtag)[0]
+ while memvalue.firstChild:
+ memvalue.removeChild(memvalue.firstChild)
+
+ memvalue.appendChild(domxml.createTextNode(value))
+
+if config.getboolean('vars', 'fake_kvm_support'):
+ domxml = hooking.read_domxml()
+ for workaround in _WORKAROUNDS:
+ workaround(domxml)
hooking.write_domxml(domxml)
--
To view, visit https://gerrit.ovirt.org/46961
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icb82b492e33d507e198901f7ecc77531b0680711
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(a)redhat.com>
8 years, 6 months
Change in vdsm[master]: net: tests: test tc upper limit using iperf
by ibarkan@redhat.com
Ido Barkan has uploaded a new change for review.
Change subject: net: tests: test tc upper limit using iperf
......................................................................
net: tests: test tc upper limit using iperf
The test uses iperf to verify that the upper limit set by traffic
control is imposed over the generated client.
Change-Id: I9348a09e331195695c16862ef986df3b4abfa991
Signed-off-by: Ido Barkan <ibarkan(a)redhat.com>
---
M tests/tcTests.py
1 file changed, 49 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/49/46449/1
diff --git a/tests/tcTests.py b/tests/tcTests.py
index 4ce6cd4..05d7b62 100644
--- a/tests/tcTests.py
+++ b/tests/tcTests.py
@@ -31,12 +31,16 @@
from testlib import (VdsmTestCase as TestCaseBase, permutations,
expandPermutations)
-from testValidation import ValidateRunningAsRoot
-from nettestlib import Bridge, Dummy, Tap, vlan_device, requires_tc
+from testValidation import ValidateRunningAsRoot, slowtest
+from nettestlib import (Bridge, Dummy, Tap, vlan_device, requires_tc, veth_pair,
+ IperfServer, IperfClient, requires_iperf3,
+ bridge_device, network_namespace)
from vdsm.constants import EXT_TC
from network import tc
from network.configurators import qos
+from vdsm.ipwrapper import addrAdd, linkSet, netns_exec, netns_assign
+from vdsm.utils import running
class TestQdisc(TestCaseBase):
@@ -441,6 +445,49 @@
self.assertEqual(current_tagged_filters_flow_id,
expected_flow_ids)
+ @requires_iperf3
+ @requires_tc
+ @slowtest
+ def test_iperf_upper_limit(self):
+ # Upper limit is not an accurate measure. This is because it converges
+ # over time and depends on current machine hardware (CPU).
+ # Hence, it is hard to make hard assertions on it. The test should run
+ # at least 60 seconds (the longer the better) and the user should
+ # inspect the computed average rate and optionally the additional
+ # traffic data that was collected in client.out in order to be
+ # convinced QOS is working properly.
+ limit_kbps = 1000 # 1 Mbps (in kbps)
+ limit_bps = limit_kbps * 2 ** 10
+ server_ip = '192.0.2.1'
+ client_ip = '192.0.2.10'
+ qos_out = {'ul': {'m2': limit_kbps}, 'ls': {'m2': limit_kbps}}
+ # using a network namespace is essential since otherwise the kernel
+ # short-circuits the traffic and bypasses the veth devices and the
+ # classfull qdisc.
+ with network_namespace('server_ns') as ns, bridge_device() as bridge, \
+ veth_pair() as (server_peer, server_dev), \
+ veth_pair() as (client_dev, client_peer):
+ linkSet(server_peer, ['up'])
+ linkSet(client_peer, ['up'])
+ # iperf server and its veth peer lie in a separate network
+ # namespace
+ netns_assign(server_dev, ns)
+ bridge.addIf(server_peer)
+ bridge.addIf(client_peer)
+ linkSet(client_dev, ['up'])
+ netns_exec(ns, ['ip', 'link', 'set', 'dev', server_dev, 'up'])
+ addrAdd(client_dev, client_ip, 24)
+ netns_exec(ns, ['ip', '-4', 'addr', 'add', 'dev', server_dev,
+ '%s/24' % server_ip])
+ qos.configure_outbound(qos_out, client_peer, None)
+ with running(IperfServer(server_ip, network_ns=ns)),\
+ running(IperfClient(server_ip, client_ip, test_time=60)) \
+ as client:
+ max_rate = max([float(
+ interval['streams'][0]['bits_per_second'])/(2**10)
+ for interval in client.out['intervals']])
+ self.assertTrue(0 < max_rate < limit_kbps * 1.5)
+
def _analise_qos_and_general_assertions(self):
tc_classes = self._analise_classes()
tc_qdiscs = self._analise_qdiscs()
--
To view, visit https://gerrit.ovirt.org/46449
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9348a09e331195695c16862ef986df3b4abfa991
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ido Barkan <ibarkan(a)redhat.com>
8 years, 6 months
Change in vdsm[master]: net: tests: support iperf3 for performance tests
by ibarkan@redhat.com
Ido Barkan has uploaded a new change for review.
Change subject: net: tests: support iperf3 for performance tests
......................................................................
net: tests: support iperf3 for performance tests
Support running iperf3 client server using context managers in an
optional network namespace. This is handy for performance testing on
a single machine. TC qos tests following patches use it.
Change-Id: I15657f8844d131c5444dd680b8de7aa1c4ec2638
Signed-off-by: Ido Barkan <ibarkan(a)redhat.com>
---
M configure.ac
M lib/vdsm/constants.py.in
M tests/nettestlib.py
3 files changed, 92 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/48/46448/1
diff --git a/configure.ac b/configure.ac
index 88817a8..1fee53c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -285,6 +285,7 @@
AC_PATH_PROG([IFUP_PATH], [ifup], [/sbin/ifup])
AC_PATH_PROG([IONICE_PATH], [ionice], [/usr/bin/ionice])
AC_PATH_PROG([IP_PATH], [ip], [/sbin/ip])
+AC_PATH_PROG([IPERF3_PATH], [iperf3], [/usr/bin/iperf3])
AC_PATH_PROG([ISCSIADM_PATH], [iscsiadm], [/sbin/iscsiadm])
AC_PATH_PROG([KILL_PATH], [kill], [/bin/kill])
AC_PATH_PROG([LVM_PATH], [lvm], [/sbin/lvm])
diff --git a/lib/vdsm/constants.py.in b/lib/vdsm/constants.py.in
index c9dff39..d4adac9 100644
--- a/lib/vdsm/constants.py.in
+++ b/lib/vdsm/constants.py.in
@@ -117,6 +117,7 @@
EXT_IFDOWN = '@IFDOWN_PATH@'
EXT_IFUP = '@IFUP_PATH@'
EXT_IONICE = '@IONICE_PATH@'
+EXT_IPERF3 = '@IPERF3_PATH@'
EXT_ISCSIADM = '@ISCSIADM_PATH@'
EXT_TC = '@TC_PATH@'
diff --git a/tests/nettestlib.py b/tests/nettestlib.py
index c923f44..d019778 100644
--- a/tests/nettestlib.py
+++ b/tests/nettestlib.py
@@ -20,6 +20,7 @@
import errno
import fcntl
import functools
+import json
import os
import platform
import signal
@@ -28,13 +29,17 @@
from multiprocessing import Process
from nose.plugins.skip import SkipTest
+import time
-from vdsm.constants import EXT_BRCTL, EXT_TC
-from vdsm.ipwrapper import addrAdd, linkSet, linkAdd, linkDel, IPRoute2Error
+from vdsm.constants import EXT_BRCTL, EXT_TC, EXT_IPERF3
+from vdsm.ipwrapper import addrAdd, linkSet, linkAdd, linkDel, IPRoute2Error, \
+ netns_add, netns_delete
from vdsm.netlink import monitor
-from vdsm.utils import execCmd, random_iface_name
+from vdsm.utils import (execCmd, random_iface_name, pgrep, kill_and_rm_pid,
+ CommandPath)
EXT_IP = "/sbin/ip"
+_IPERF3_BINARY = CommandPath('iperf3', EXT_IPERF3)
class ExecError(RuntimeError):
@@ -237,6 +242,70 @@
raise SkipTest(message)
+class _Iperf(object):
+ @staticmethod
+ def stop():
+ pids = pgrep(_IPERF3_BINARY.name)
+ for pid in pids:
+ kill_and_rm_pid(pid, pid_file=None)
+
+
+class IperfServer(_Iperf):
+ """starts iperf as a daemon"""
+ def __init__(self, host, network_ns=None):
+ """host: the IP address for the server to listen on.
+ network_ns: an optional network namespace for the server to run in.
+ """
+ self._bind_to = host
+ self._net_ns = network_ns
+
+ def start(self):
+ cmd = [EXT_IPERF3, '--server', '--bind', self._bind_to, '--daemon']
+ if self._net_ns is not None:
+ cmd = ['ip', 'netns', 'exec', self._net_ns] + cmd
+ rc, out, err = execCmd(cmd)
+ return rc
+
+
+class IperfClient(_Iperf):
+ def __init__(self, server_ip, bind_to, test_time, threads=1):
+ """the client generate a machine readable json output that is set in
+ _raw_output upon completion, ANd can be read using the 'out' property.
+ server_ip: the ip of the corresponding iperf server
+ bind_to: IP address of the client
+ test_time: in seconds
+ """
+ self._server_ip = server_ip
+ self._bind_to = bind_to
+ self._test_time = test_time
+ self._threads = threads
+ self._raw_output = None
+
+ def start(self):
+ cmd = [EXT_IPERF3, '--client', self._server_ip,
+ '--version4', # only IPv4
+ '--time', str(self._test_time), '--parallel',
+ str(self._threads), '--bind', self._bind_to,
+ '--zerocopy', # use less cpu
+ '--json']
+ rc, self._raw_output, err = execCmd(cmd)
+ if rc == 1 and 'No route to host' in self.error:
+ time.sleep(3)
+ rc, self._raw_output, err = execCmd(cmd)
+ if rc:
+ raise Exception('iperf3 client failed: cmd=%s, rc=%s, out=%s, '
+ 'err=%s' % (' '.join(cmd), rc, self._raw_output,
+ err))
+
+ @property
+ def error(self):
+ return self.out['error']
+
+ @property
+ def out(self):
+ return json.loads(' '.join(self._raw_output))
+
+
@contextmanager
def dummy_device(prefix='dummy_', max_length=11):
dummy_interface = Dummy(prefix, max_length)
@@ -304,3 +373,21 @@
check_tc()
return f(*a, **kw)
return wrapper
+
+
+def check_iperf():
+ try:
+ execCmd([_IPERF3_BINARY.cmd, "--version"])
+ except OSError as e:
+ if e.errno == errno.ENOENT:
+ raise SkipTest("Cannot run %r: %s\nDo you have iperf3 installed?"
+ % (_IPERF3_BINARY.cmd, e))
+ raise
+
+
+def requires_iperf3(f):
+ @functools.wraps(f)
+ def wrapper(*a, **kw):
+ check_iperf()
+ return f(*a, **kw)
+ return wrapper
--
To view, visit https://gerrit.ovirt.org/46448
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I15657f8844d131c5444dd680b8de7aa1c4ec2638
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ido Barkan <ibarkan(a)redhat.com>
8 years, 6 months
Change in vdsm[master]: build: Introduce --enable-gluster configuration
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: build: Introduce --enable-gluster configuration
......................................................................
build: Introduce --enable-gluster configuration
Previously building gluster package and building for RHEV were coupled
together in an ugly way. We disabled gluster package when building for
RHEV, and enabled some gluster apis only when building for RHEV.
We want to get rid of these downstream related options, but we also want
to allow downstream maintainers easy way to configure the package as
needed.
This patch decouples rhev_build and with_gluster options; To build the
vdsm-gluster package, use:
./configure --enable-gluster
To build without vdsm-gluster package, use:
./configure --disable-gluster
When gluster is enabled, supervdsm exposes all gluster apis marked
with @glusterapi decorator. Most of these apis are used when vdsm is
used to control gluster server.
When gluster is disabled, supervdsm exposes only the gluster vdsm apis
marked as with @ovirtapi. These apis are required for consuming gluster
storage.
Change-Id: I84608625e3b004c64b4928e5325d9375fb952878
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M Makefile.am
M configure.ac
M lib/vdsm/constants.py.in
M vdsm.spec.in
M vdsm/gluster/__init__.py
M vdsm/gluster/cli.py
M vdsm/supervdsmServer
7 files changed, 81 insertions(+), 67 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/08/46708/1
diff --git a/Makefile.am b/Makefile.am
index 5508094..13d49d2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -58,6 +58,10 @@
WITH_HOOKS = --define="with_hooks 1"
endif
+if GLUSTER
+WITH_GLUSTER = --define="with_gluster 1"
+endif
+
if RHEV
RHEV_BUILD = --define="rhev_build 1"
endif
@@ -158,7 +162,7 @@
rpm: dist
rpmbuild -ta $(if $(BUILDID),--define="extra_release .$(BUILDID)") \
- $(WITH_HOOKS) $(RHEV_BUILD) $(KOJI_BUILD) $(DIST_ARCHIVES)
+ $(WITH_HOOKS) $(WITH_GLUSTER) $(RHEV_BUILD) $(KOJI_BUILD) $(DIST_ARCHIVES)
dist-hook: gen-VERSION gen-ChangeLog
.PHONY: gen-VERSION gen-ChangeLog
diff --git a/configure.ac b/configure.ac
index feb7e52..da361ef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,6 +56,17 @@
AM_CONDITIONAL([HOOKS], [test "${enable_hooks}" = "yes"])
AC_ARG_ENABLE(
+ [gluster],
+ [AS_HELP_STRING(
+ [--enable-gluster],
+ [build gluster package @<:@default=no@:>@]
+ )],
+ ,
+ [enable_gluster="no"]
+)
+AM_CONDITIONAL([GLUSTER], [test "${enable_gluster}" = "yes"])
+
+AC_ARG_ENABLE(
[rhev],
[AS_HELP_STRING(
[--enable-rhev],
diff --git a/lib/vdsm/constants.py.in b/lib/vdsm/constants.py.in
index e5cff54..542ad3e 100644
--- a/lib/vdsm/constants.py.in
+++ b/lib/vdsm/constants.py.in
@@ -23,7 +23,7 @@
from __future__ import absolute_import
import os
-RHEV_ENABLED = False if '@RHEV_TRUE@' else True
+GLUSTER_ENABLED = False if '@GLUSTER_TRUE@' else True
# VDSM management networks
LEGACY_MANAGEMENT_NETWORKS = ('ovirtmgmt', 'rhevm')
diff --git a/vdsm.spec.in b/vdsm.spec.in
index f93bcd6..9cc3597 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -13,6 +13,9 @@
# Glusterfs package version
%global gluster_version 3.7.1
+# Glusterfs - overridable using rpmbuild --define "with_gluster 1"
+%{!?with_gluster: %global with_gluster 0}
+
# koji build - overridable using rpmbuild --define "fedora_koji_build 1"
%{!?fedora_koji_build: %global fedora_koji_build 0}
@@ -40,11 +43,6 @@
%global _polkitdir %{_datadir}/polkit-1/rules.d
%else
%global _polkitdir %{_localstatedir}/lib/polkit-1/localauthority/10-vendor.d
-%endif
-
-# Gluster should not be shipped with RHEV
-%if ! 0%{?rhev_build}
-%global with_gluster 1
%endif
%if ! 0%{?rhel} || ! 0%{fedora_koji_build}
@@ -594,6 +592,7 @@
autoreconf -if
%endif
%configure %{?with_hooks:--enable-hooks} \
+ %{?with_gluster:--enable-gluster} \
%if 0%{?rhev_build}
--enable-rhev \
--with-smbios-manufacturer='Red Hat' \
diff --git a/vdsm/gluster/__init__.py b/vdsm/gluster/__init__.py
index fa953a1..23599fa 100644
--- a/vdsm/gluster/__init__.py
+++ b/vdsm/gluster/__init__.py
@@ -25,24 +25,24 @@
'gfapi', 'storagedev', 'api')
-def makePublic(func):
- func.superVdsm = True
+def glusterapi(func):
+ func.glusterapi = True
return func
-def makePublicRHEV(func):
- func.superVdsmRHEV = True
+def ovirtapi(func):
+ func.ovirtapi = True
return func
-def listPublicFunctions(rhev=False):
+def listPublicFunctions(gluster_enabled=True):
methods = []
for modName in MODULE_LIST:
try:
module = __import__('gluster.' + modName, fromlist=['gluster'])
for name in dir(module):
func = getattr(module, name)
- if _shouldPublish(func, rhev):
+ if _shouldPublish(func, gluster_enabled):
funcName = 'gluster%s%s' % (name[0].upper(), name[1:])
methods.append((funcName, func))
except ImportError:
@@ -50,11 +50,11 @@
return methods
-def _shouldPublish(func, rhev):
- if rhev:
- return getattr(func, 'superVdsmRHEV', False)
+def _shouldPublish(func, gluster_enabled):
+ if gluster_enabled:
+ return getattr(func, 'glusterapi', False)
else:
- return getattr(func, 'superVdsm', False)
+ return getattr(func, 'ovirtapi', False)
def safeWrite(fileName, content):
diff --git a/vdsm/gluster/cli.py b/vdsm/gluster/cli.py
index 8d399f0..0724b22 100644
--- a/vdsm/gluster/cli.py
+++ b/vdsm/gluster/cli.py
@@ -27,7 +27,7 @@
from vdsm import utils
from vdsm import netinfo
import exception as ge
-from . import makePublic, makePublicRHEV
+from . import glusterapi, ovirtapi
_glusterCommandPath = utils.CommandPath("gluster",
"/usr/sbin/gluster",
@@ -135,7 +135,7 @@
return ''
-@makePublic
+@glusterapi
def hostUUIDGet():
command = _getGlusterSystemCmd() + ["uuid", "get"]
rc, out, err = _execGluster(command)
@@ -265,7 +265,7 @@
return status
-@makePublic
+@glusterapi
def volumeStatus(volumeName, brick=None, option=None):
"""
Get volume status
@@ -472,8 +472,8 @@
return status
-@makePublic
-@makePublicRHEV
+@glusterapi
+@ovirtapi
def volumeInfo(volumeName=None, remoteServer=None):
"""
Returns:
@@ -501,7 +501,7 @@
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
-@makePublic
+@glusterapi
def volumeCreate(volumeName, brickList, replicaCount=0, stripeCount=0,
transportList=[], force=False):
command = _getGlusterVolCmd() + ["create", volumeName]
@@ -526,7 +526,7 @@
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
-@makePublic
+@glusterapi
def volumeStart(volumeName, force=False):
command = _getGlusterVolCmd() + ["start", volumeName]
if force:
@@ -538,7 +538,7 @@
return True
-@makePublic
+@glusterapi
def volumeStop(volumeName, force=False):
command = _getGlusterVolCmd() + ["stop", volumeName]
if force:
@@ -550,7 +550,7 @@
raise ge.GlusterVolumeStopFailedException(rc=e.rc, err=e.err)
-@makePublic
+@glusterapi
def volumeDelete(volumeName):
command = _getGlusterVolCmd() + ["delete", volumeName]
try:
@@ -560,7 +560,7 @@
raise ge.GlusterVolumeDeleteFailedException(rc=e.rc, err=e.err)
-@makePublic
+@glusterapi
def volumeSet(volumeName, option, value):
command = _getGlusterVolCmd() + ["set", volumeName, option, value]
try:
@@ -581,7 +581,7 @@
return optionList
-@makePublic
+@glusterapi
def volumeSetHelpXml():
rc, out, err = _execGluster(_getGlusterVolCmd() + ["set", 'help-xml'])
if rc:
@@ -590,7 +590,7 @@
return _parseVolumeSetHelpXml(out)
-@makePublic
+@glusterapi
def volumeReset(volumeName, option='', force=False):
command = _getGlusterVolCmd() + ['reset', volumeName]
if option:
@@ -604,7 +604,7 @@
raise ge.GlusterVolumeResetFailedException(rc=e.rc, err=e.err)
-@makePublic
+@glusterapi
def volumeAddBrick(volumeName, brickList,
replicaCount=0, stripeCount=0, force=False):
command = _getGlusterVolCmd() + ["add-brick", volumeName]
@@ -622,7 +622,7 @@
raise ge.GlusterVolumeBrickAddFailedException(rc=e.rc, err=e.err)
-@makePublic
+@glusterapi
def volumeRebalanceStart(volumeName, rebalanceType="", force=False):
command = _getGlusterVolCmd() + ["rebalance", volumeName]
if rebalanceType:
@@ -641,7 +641,7 @@
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
-@makePublic
+@glusterapi
def volumeRebalanceStop(volumeName, force=False):
command = _getGlusterVolCmd() + ["rebalance", volumeName, "stop"]
if force:
@@ -658,7 +658,7 @@
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
-@makePublic
+@glusterapi
def _parseVolumeRebalanceRemoveBrickStatus(xmltree, mode):
"""
returns {'hosts': [{'name': NAME,
@@ -714,7 +714,7 @@
return status
-@makePublic
+@glusterapi
def volumeRebalanceStatus(volumeName):
command = _getGlusterVolCmd() + ["rebalance", volumeName, "status"]
try:
@@ -728,7 +728,7 @@
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
-@makePublic
+@glusterapi
def volumeReplaceBrickCommitForce(volumeName, existingBrick, newBrick):
command = _getGlusterVolCmd() + ["replace-brick", volumeName,
existingBrick, newBrick, "commit",
@@ -741,7 +741,7 @@
err=e.err)
-@makePublic
+@glusterapi
def volumeRemoveBrickStart(volumeName, brickList, replicaCount=0):
command = _getGlusterVolCmd() + ["remove-brick", volumeName]
if replicaCount:
@@ -758,7 +758,7 @@
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
-@makePublic
+@glusterapi
def volumeRemoveBrickStop(volumeName, brickList, replicaCount=0):
command = _getGlusterVolCmd() + ["remove-brick", volumeName]
if replicaCount:
@@ -776,7 +776,7 @@
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
-@makePublic
+@glusterapi
def volumeRemoveBrickStatus(volumeName, brickList, replicaCount=0):
command = _getGlusterVolCmd() + ["remove-brick", volumeName]
if replicaCount:
@@ -793,7 +793,7 @@
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
-@makePublic
+@glusterapi
def volumeRemoveBrickCommit(volumeName, brickList, replicaCount=0):
command = _getGlusterVolCmd() + ["remove-brick", volumeName]
if replicaCount:
@@ -807,7 +807,7 @@
err=e.err)
-@makePublic
+@glusterapi
def volumeRemoveBrickForce(volumeName, brickList, replicaCount=0):
command = _getGlusterVolCmd() + ["remove-brick", volumeName]
if replicaCount:
@@ -821,7 +821,7 @@
err=e.err)
-@makePublic
+@glusterapi
def peerProbe(hostName):
command = _getGlusterPeerCmd() + ["probe", hostName]
try:
@@ -831,7 +831,7 @@
raise ge.GlusterHostAddFailedException(rc=e.rc, err=e.err)
-@makePublic
+@glusterapi
def peerDetach(hostName, force=False):
command = _getGlusterPeerCmd() + ["detach", hostName]
if force:
@@ -865,7 +865,7 @@
return hostList
-@makePublic
+@glusterapi
def peerStatus():
"""
Returns:
@@ -884,7 +884,7 @@
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
-@makePublic
+@glusterapi
def volumeProfileStart(volumeName):
command = _getGlusterVolCmd() + ["profile", volumeName, "start"]
try:
@@ -894,7 +894,7 @@
return True
-@makePublic
+@glusterapi
def volumeProfileStop(volumeName):
command = _getGlusterVolCmd() + ["profile", volumeName, "stop"]
try:
@@ -904,7 +904,7 @@
return True
-@makePublic
+@glusterapi
def volumeProfileInfo(volumeName, nfs=False):
"""
Returns:
@@ -1010,7 +1010,7 @@
return tasks
-@makePublic
+@glusterapi
def volumeTasks(volumeName="all"):
command = _getGlusterVolCmd() + ["status", volumeName, "tasks"]
try:
@@ -1023,7 +1023,7 @@
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
-@makePublic
+@glusterapi
def volumeGeoRepSessionStart(volumeName, remoteHost, remoteVolumeName,
remoteUserName=None, force=False):
if remoteUserName:
@@ -1042,7 +1042,7 @@
err=e.err)
-@makePublic
+@glusterapi
def volumeGeoRepSessionStop(volumeName, remoteHost, remoteVolumeName,
remoteUserName=None, force=False):
if remoteUserName:
@@ -1141,7 +1141,7 @@
return status
-@makePublic
+@glusterapi
def volumeGeoRepStatus(volumeName=None, remoteHost=None,
remoteVolumeName=None, remoteUserName=None):
if remoteUserName:
@@ -1165,7 +1165,7 @@
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
-@makePublic
+@glusterapi
def volumeGeoRepSessionPause(volumeName, remoteHost, remoteVolumeName,
remoteUserName=None, force=False):
if remoteUserName:
@@ -1184,7 +1184,7 @@
err=e.err)
-@makePublic
+@glusterapi
def volumeGeoRepSessionResume(volumeName, remoteHost, remoteVolumeName,
remoteUserName=None, force=False):
if remoteUserName:
@@ -1216,7 +1216,7 @@
return {'geoRepConfig': config}
-@makePublic
+@glusterapi
def volumeGeoRepConfig(volumeName, remoteHost,
remoteVolumeName, optionName=None,
optionValue=None,
@@ -1244,7 +1244,7 @@
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
-@makePublic
+@glusterapi
def snapshotCreate(volumeName, snapName,
snapDescription=None,
force=False):
@@ -1266,7 +1266,7 @@
raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
-@makePublic
+@glusterapi
def snapshotDelete(volumeName=None, snapName=None):
command = _getGlusterSnapshotCmd() + ["delete"]
if snapName:
@@ -1282,7 +1282,7 @@
return True
-@makePublic
+@glusterapi
def snapshotActivate(snapName, force=False):
command = _getGlusterSnapshotCmd() + ["activate", snapName]
@@ -1296,7 +1296,7 @@
raise ge.GlusterSnapshotActivateFailedException(rc=e.rc, err=e.err)
-@makePublic
+@glusterapi
def snapshotDeactivate(snapName):
command = _getGlusterSnapshotCmd() + ["deactivate", snapName]
@@ -1326,7 +1326,7 @@
return snapshotRestore
-@makePublic
+@glusterapi
def snapshotRestore(snapName):
command = _getGlusterSnapshotCmd() + ["restore", snapName]
@@ -1371,7 +1371,7 @@
return {'system': systemConfig, 'volume': volumeConfig}
-@makePublic
+@glusterapi
def snapshotConfig(volumeName=None, optionName=None, optionValue=None):
command = _getGlusterSnapshotCmd() + ["config"]
if volumeName:
@@ -1491,7 +1491,7 @@
return volumes
-@makePublic
+@glusterapi
def snapshotInfo(volumeName=None):
command = _getGlusterSnapshotCmd() + ["info"]
if volumeName:
@@ -1509,7 +1509,7 @@
raise ge.GlusterXmlErrorInfoException(err=[etree.tostring(xmltree)])
-@makePublic
+@glusterapi
def executeGsecCreate():
command = _getGlusterSystemCmd() + ["execute", "gsec_create"]
rc, out, err = _execGluster(command)
@@ -1519,7 +1519,7 @@
return True
-@makePublic
+@glusterapi
def executeMountBrokerUserAdd(remoteUserName, remoteVolumeName):
command = _getGlusterSystemCmd() + ["execute", "mountbroker",
"user", remoteUserName,
@@ -1532,7 +1532,7 @@
return True
-@makePublic
+@glusterapi
def executeMountBrokerOpt(optionName, optionValue):
command = _getGlusterSystemCmd() + ["execute", "mountbroker",
"opt", optionName,
@@ -1544,7 +1544,7 @@
return True
-@makePublic
+@glusterapi
def volumeGeoRepSessionCreate(volumeName, remoteHost,
remoteVolumeName,
remoteUserName=None, force=False):
@@ -1564,7 +1564,7 @@
raise ge.GlusterGeoRepSessionCreateFailedException(rc=e.rc, err=e.err)
-@makePublic
+@glusterapi
def volumeGeoRepSessionDelete(volumeName, remoteHost, remoteVolumeName,
remoteUserName=None):
if remoteUserName:
diff --git a/vdsm/supervdsmServer b/vdsm/supervdsmServer
index 9a679ee..62aa7bb 100755
--- a/vdsm/supervdsmServer
+++ b/vdsm/supervdsmServer
@@ -77,7 +77,7 @@
from vdsm.constants import METADATA_GROUP, EXT_CHOWN, \
DISKIMAGE_USER, DISKIMAGE_GROUP, \
P_LIBVIRT_VMCHANNELS, P_OVIRT_VMCONSOLES, \
- VDSM_USER, QEMU_PROCESS_USER, QEMU_PROCESS_GROUP, RHEV_ENABLED
+ VDSM_USER, QEMU_PROCESS_USER, QEMU_PROCESS_GROUP, GLUSTER_ENABLED
from storage.devicemapper import _removeMapping, _getPathsStatus
from vdsm.config import config
import mkimage
@@ -532,7 +532,7 @@
return wrapper
if _glusterEnabled:
- for name, func in listPublicFunctions(RHEV_ENABLED):
+ for name, func in listPublicFunctions(GLUSTER_ENABLED):
setattr(_SuperVdsm, name, logDecorator(bind(func)))
try:
--
To view, visit https://gerrit.ovirt.org/46708
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I84608625e3b004c64b4928e5325d9375fb952878
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
8 years, 6 months
Change in vdsm[master]: gluster: Added VDSM verb to stop gluster related processes
by shtripat@redhat.com
Shubhendu Tripathi has uploaded a new change for review.
Change subject: gluster: Added VDSM verb to stop gluster related processes
......................................................................
gluster: Added VDSM verb to stop gluster related processes
Added a verb which stops the gluster related process like
brick processes, gsyncd process.
This needs to be done as part of a host moving to maintenance
mode. as data should not be available if a host is moved to
maintenence mode for some migration etc.
Change-Id: Id686e098b323eededcf1f89de331a1d524274995
Bug-URL: https://bugzilla.redhat.com/1205724
Signed-off-by: Shubhendu Tripathi <shtripat(a)redhat.com>
---
M client/vdsClientGluster.py
M vdsm/gluster/api.py
M vdsm/gluster/apiwrapper.py
M vdsm/gluster/exception.py
M vdsm/rpc/vdsmapi-gluster-schema.json
5 files changed, 51 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/21/43821/1
diff --git a/client/vdsClientGluster.py b/client/vdsClientGluster.py
index a4bce63..a72d4e3 100644
--- a/client/vdsClientGluster.py
+++ b/client/vdsClientGluster.py
@@ -740,6 +740,11 @@
pp.pprint(status)
return status['status']['code'], status['status']['message']
+ def do_glusterStopProcesses(self, args):
+ status = self.s.glusterStopProcesses()
+ pp.pprint(status)
+ return status['status']['code'], status['status']['message']
+
def getGlusterCmdDict(serv):
return \
@@ -1252,5 +1257,10 @@
serv.do_glusterSnapshotScheduleReset,
('',
'Reset gluster snapshot scheduling'
+ )),
+ 'glusterStopProcesses' : (
+ serv.do_glusterStopProcesses,
+ ('',
+ 'Stop gluster processes'
))
}
diff --git a/vdsm/gluster/api.py b/vdsm/gluster/api.py
index 781ab77..3467412 100644
--- a/vdsm/gluster/api.py
+++ b/vdsm/gluster/api.py
@@ -52,6 +52,12 @@
"/usr/sbin/snap_scheduler.py",
)
+_stopAllProcessesPath = utils.CommandPath(
+ "stop-all-gluster-processes.sh",
+ "/usr/share/glusterfs/scripts/stop-all-gluster-processes.sh",
+)
+
+
GLUSTER_RPM_PACKAGES = (
('glusterfs', ('glusterfs',)),
('glusterfs-fuse', ('glusterfs-fuse',)),
@@ -262,6 +268,15 @@
except (IOError, OSError) as e:
raise ge.GlusterSnapshotScheduleFlagUpdateFailedException(
err=[str(e)])
+ return True
+
+
+@makePublic
+def stopProcesses():
+ command = ["/bin/sh", _stopAllProcessesPath.cmd]
+ rc, out, err = utils.execCmd(command)
+ if rc:
+ raise ge.GlusterStopProcessesFailedException(rc)
return True
@@ -752,6 +767,10 @@
def snapshotScheduleReset(self, options=None):
self.svdsmProxy.glusterSnapshotScheduleFlagUpdate("none")
+ @exportAsVerb
+ def stopProcesses(self):
+ self.svdsmProxy.glusterStopProcesses()
+
def getGlusterMethods(gluster):
l = []
diff --git a/vdsm/gluster/apiwrapper.py b/vdsm/gluster/apiwrapper.py
index 4768a86..13dc859 100644
--- a/vdsm/gluster/apiwrapper.py
+++ b/vdsm/gluster/apiwrapper.py
@@ -86,6 +86,9 @@
return self._gluster.createBrick(name, mountPoint,
devList, fsType, raidParams)
+ def stopProcesses(self):
+ return self._gluster.stopProcesses()
+
class GlusterService(GlusterApiBase):
def __init__(self):
diff --git a/vdsm/gluster/exception.py b/vdsm/gluster/exception.py
index 17ad018..2898d3d 100644
--- a/vdsm/gluster/exception.py
+++ b/vdsm/gluster/exception.py
@@ -594,6 +594,12 @@
message = "Failed to disable snapshot schedule through cli"
+class GlusterStopProcessesFailedException(
+ GlusterVolumeException):
+ code = 4579
+ message = "Failed to stop gluster processes"
+
+
# geo-replication
class GlusterGeoRepException(GlusterException):
code = 4200
diff --git a/vdsm/rpc/vdsmapi-gluster-schema.json b/vdsm/rpc/vdsmapi-gluster-schema.json
index c86f43c..2853851 100644
--- a/vdsm/rpc/vdsmapi-gluster-schema.json
+++ b/vdsm/rpc/vdsmapi-gluster-schema.json
@@ -1299,6 +1299,19 @@
'returns': 'bool'}
##
+# @GlusterHost.stopProcesses:
+#
+# Stops the gluster processes on the host
+#
+# Returns:
+# Success or failure
+#
+# Since: 4.17.0
+##
+{'command': {'class': 'GlusterHost', 'name': 'stopProcesses'},
+ 'returns': 'bool'}
+
+##
# @GlusterVolumeStatsInfo:
#
# Gluster Volumes disk usage statistics
--
To view, visit https://gerrit.ovirt.org/43821
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id686e098b323eededcf1f89de331a1d524274995
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Shubhendu Tripathi <shtripat(a)redhat.com>
8 years, 6 months