Change in vdsm[ovirt-3.3]: BindingXMLRPC bugfix: Fix netinfo:getIfaceByIP unit test
by amuller@redhat.com
Assaf Muller has uploaded a new change for review.
Change subject: BindingXMLRPC bugfix: Fix netinfo:getIfaceByIP unit test
......................................................................
BindingXMLRPC bugfix: Fix netinfo:getIfaceByIP unit test
Change-Id: Iee4757958ea5554043c6dc7169a8df05b1887687
Signed-off-by: Assaf Muller <amuller(a)redhat.com>
---
M lib/vdsm/netinfo.py
M tests/netinfoTests.py
2 files changed, 9 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/68/22968/1
diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py
index 790c099..2f54413 100644
--- a/lib/vdsm/netinfo.py
+++ b/lib/vdsm/netinfo.py
@@ -599,7 +599,6 @@
def getIfaceByIP(ip):
for info in ethtool.get_interfaces_info(ethtool.get_active_devices()):
-
for ipv4addr in info.get_ipv4_addresses():
if ip == ipv4addr.address or ip == IPv4toMapped(ipv4addr.address):
return info.device
diff --git a/tests/netinfoTests.py b/tests/netinfoTests.py
index 18e71c3..fb8c584 100644
--- a/tests/netinfoTests.py
+++ b/tests/netinfoTests.py
@@ -98,10 +98,15 @@
def testGetIfaceByIP(self):
for dev in ethtool.get_interfaces_info(ethtool.get_active_devices()):
- ipaddrs = map(
- lambda etherinfo_ipv6addr: etherinfo_ipv6addr.address,
- dev.get_ipv6_addresses())
- ipaddrs.append(dev.ipv4_address)
+ # Link-local IPv6 addresses are generated from the MAC address,
+ # which is shared between a nic and its bridge. Since We don't
+ # support having the same IP address on two different NICs, and
+ # link-local IPv6 addresses aren't interesting for 'getDeviceByIP'
+ # then ignore them in the test
+ ipaddrs = [ipv6.address for ipv6 in dev.get_ipv6_addresses()
+ if ipv6.scope != 'link']
+ if dev.ipv4_address is not None:
+ ipaddrs.append(dev.ipv4_address)
for ip in ipaddrs:
self.assertEqual(dev.device, netinfo.getIfaceByIP(ip))
--
To view, visit http://gerrit.ovirt.org/22968
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iee4757958ea5554043c6dc7169a8df05b1887687
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.3
Gerrit-Owner: Assaf Muller <amuller(a)redhat.com>
10 years, 4 months
Change in vdsm[master]: Adjust width for usage_command in vdsm-tool
by lilei@linux.vnet.ibm.com
Lei Li has uploaded a new change for review.
Change subject: Adjust width for usage_command in vdsm-tool
......................................................................
Adjust width for usage_command in vdsm-tool
The default value of width is 70 characters. It may not
be long enough for most of the usage_command comments.
So adjust it to add flexibility.
Change-Id: I800384e77452a76f651b73205b3335905274077c
Signed-off-by: Lei Li <lilei(a)linux.vnet.ibm.com>
---
M vdsm-tool/vdsm-tool
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/48/4648/1
--
To view, visit http://gerrit.ovirt.org/4648
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I800384e77452a76f651b73205b3335905274077c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Lei Li <lilei(a)linux.vnet.ibm.com>
10 years, 4 months
Change in vdsm[master]: Reorganized host network APIs in API bridge
by iheim@redhat.com
Itamar Heim has abandoned this change.
Change subject: Reorganized host network APIs in API bridge
......................................................................
Abandoned
no comment otherwise - abandoning
--
To view, visit http://gerrit.ovirt.org/2663
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: abandon
Gerrit-Change-Id: I64771991c3db09247f7689e6b5ddffa8adbf6745
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Lei Li <lilei(a)linux.vnet.ibm.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Itamar Heim <iheim(a)redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>
Gerrit-Reviewer: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
10 years, 4 months
Change in vdsm[master]: Add functions getNetworkList and getNetworkInfo to API
by iheim@redhat.com
Itamar Heim has posted comments on this change.
Change subject: Add functions getNetworkList and getNetworkInfo to API
......................................................................
Patch Set 4:
ping
--
To view, visit http://gerrit.ovirt.org/2664
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I6689b31541fc98ff7a7951eedbb99270c60a0738
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Lei Li <lilei(a)linux.vnet.ibm.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Assaf Muller <amuller(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Itamar Heim <iheim(a)redhat.com>
Gerrit-Reviewer: Lei Li <lilei(a)linux.vnet.ibm.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: No
10 years, 4 months
Change in vdsm[master]: [wip] Implement extendVolume in fileSD/Volume.
by iheim@redhat.com
Itamar Heim has abandoned this change.
Change subject: [wip] Implement extendVolume in fileSD/Volume.
......................................................................
Abandoned
--
To view, visit http://gerrit.ovirt.org/12713
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: abandon
Gerrit-Change-Id: I15d73fd9e7727d9112db05ab892771b37d81152e
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Richard Marston <mail(a)richardmarston.net>
Gerrit-Reviewer: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Itamar Heim <iheim(a)redhat.com>
Gerrit-Reviewer: Richard Marston <mail(a)richardmarston.net>
Gerrit-Reviewer: Richard Marston <richardhefty(a)gmail.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
10 years, 4 months
Change in vdsm[master]: package: allow redefine user and group as configure options
by iheim@redhat.com
Itamar Heim has posted comments on this change.
Change subject: package: allow redefine user and group as configure options
......................................................................
Patch Set 2:
ping
--
To view, visit http://gerrit.ovirt.org/18703
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I6033f2450551600ec172523ab038fdf157176a8f
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Alexey Shabalin <a.shabalin(a)gmail.com>
Gerrit-Reviewer: Alon Bar-Lev <alonbl(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Itamar Heim <iheim(a)redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: No
10 years, 4 months
Change in vdsm[master]: hooks: Security groups support for OVS
by mkolesni@redhat.com
Mike Kolesnik has uploaded a new change for review.
Change subject: hooks: Security groups support for OVS
......................................................................
hooks: Security groups support for OVS
OpenStack Networking for OVS currently can't handle security groups on
the OVS bridge itself, so a hybrid approach is used where the tap device
is connected to a Linux bridge (on which the security groups can be
implemented), and it is connected in turn to the OVS bridge using a
"patch cable" made of a VETH pair.
Change-Id: I77e219cce9c572ebef6a8584847f517abbda224d
Signed-off-by: Mike Kolesnik <mkolesni(a)redhat.com>
---
M configure.ac
M debian/vdsm-hook-openstacknet.install
M lib/vdsm/constants.py.in
M vdsm.spec.in
M vdsm_hooks/openstacknet/Makefile.am
A vdsm_hooks/openstacknet/after_device_destroy.py
M vdsm_hooks/openstacknet/before_device_create.py
M vdsm_hooks/openstacknet/openstacknet_utils.py
M vdsm_hooks/openstacknet/sudoers.in
9 files changed, 190 insertions(+), 14 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/85/22585/1
diff --git a/configure.ac b/configure.ac
index bd44d83..2bc66f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -225,6 +225,7 @@
AC_PATH_PROG([NICE_PATH], [nice], [/bin/nice])
AC_PATH_PROG([NTPQ_PATH], [ntpq], [/usr/sbin/ntpq])
AC_PATH_PROG([OPENSSL_PATH], [openssl], [/usr/bin/openssl])
+AC_PATH_PROG([OVS_VSCTL_PATH], [ovs-vsctl], [/usr/bin/ovs-vsctl])
AC_PATH_PROG([PERSIST_PATH], [persist], [/usr/sbin/persist])
AC_PATH_PROG([PGREP_PATH], [pgrep], [/usr/bin/pgrep])
AC_PATH_PROG([QEMUIMG_PATH], [qemu-img], [/usr/bin/qemu-img])
diff --git a/debian/vdsm-hook-openstacknet.install b/debian/vdsm-hook-openstacknet.install
index b13a151..8de9b50 100644
--- a/debian/vdsm-hook-openstacknet.install
+++ b/debian/vdsm-hook-openstacknet.install
@@ -1,10 +1,14 @@
etc/sudoers.d/50_vdsm_hook_openstacknet
usr/libexec/vdsm/hooks/after_device_create/50_openstacknet
usr/libexec/vdsm/hooks/after_device_create/openstacknet_utils.py
+usr/libexec/vdsm/hooks/after_device_destroy/50_openstacknet
+usr/libexec/vdsm/hooks/after_device_destroy/openstacknet_utils.py
usr/libexec/vdsm/hooks/after_device_migrate_destination/50_openstacknet
usr/libexec/vdsm/hooks/after_device_migrate_destination/openstacknet_utils.py
usr/libexec/vdsm/hooks/after_nic_hotplug/50_openstacknet
usr/libexec/vdsm/hooks/after_nic_hotplug/openstacknet_utils.py
+usr/libexec/vdsm/hooks/after_nic_hotunplug/50_openstacknet
+usr/libexec/vdsm/hooks/after_nic_hotunplug/openstacknet_utils.py
usr/libexec/vdsm/hooks/before_device_create/50_openstacknet
usr/libexec/vdsm/hooks/before_device_create/openstacknet_utils.py
usr/libexec/vdsm/hooks/before_nic_hotplug/50_openstacknet
diff --git a/lib/vdsm/constants.py.in b/lib/vdsm/constants.py.in
index 9be68c2..9cd9657 100644
--- a/lib/vdsm/constants.py.in
+++ b/lib/vdsm/constants.py.in
@@ -102,6 +102,7 @@
EXT_IFDOWN = '@IFDOWN_PATH@'
EXT_IFUP = '@IFUP_PATH@'
EXT_IONICE = '@IONICE_PATH@'
+EXT_IP = '@IP_PATH@'
EXT_ISCSIADM = '@ISCSIADM_PATH@'
EXT_TC = '@TC_PATH@'
@@ -119,6 +120,8 @@
EXT_NICE = '@NICE_PATH@'
+EXT_OVS_VSCTL = '@OVS_VSCTL_PATH@'
+
EXT_PERSIST = '@PERSIST_PATH@'
EXT_PGREP = '@PGREP_PATH@'
EXT_PYTHON = '@PYTHON@'
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 6a5e49e..d7e78c2 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -1144,10 +1144,14 @@
%{_sysconfdir}/sudoers.d/50_vdsm_hook_openstacknet
%{_libexecdir}/%{vdsm_name}/hooks/after_device_create/50_openstacknet
%{_libexecdir}/%{vdsm_name}/hooks/after_device_create/openstacknet_utils.py*
+%{_libexecdir}/%{vdsm_name}/hooks/after_device_destroy/50_openstacknet
+%{_libexecdir}/%{vdsm_name}/hooks/after_device_destroy/openstacknet_utils.py*
%{_libexecdir}/%{vdsm_name}/hooks/after_device_migrate_destination/50_openstacknet
%{_libexecdir}/%{vdsm_name}/hooks/after_device_migrate_destination/openstacknet_utils.py*
%{_libexecdir}/%{vdsm_name}/hooks/after_nic_hotplug/50_openstacknet
%{_libexecdir}/%{vdsm_name}/hooks/after_nic_hotplug/openstacknet_utils.py*
+%{_libexecdir}/%{vdsm_name}/hooks/after_nic_hotunplug/50_openstacknet
+%{_libexecdir}/%{vdsm_name}/hooks/after_nic_hotunplug/openstacknet_utils.py*
%{_libexecdir}/%{vdsm_name}/hooks/before_device_create/50_openstacknet
%{_libexecdir}/%{vdsm_name}/hooks/before_device_create/openstacknet_utils.py*
%{_libexecdir}/%{vdsm_name}/hooks/before_nic_hotplug/50_openstacknet
diff --git a/vdsm_hooks/openstacknet/Makefile.am b/vdsm_hooks/openstacknet/Makefile.am
index a05e821..2baab05 100644
--- a/vdsm_hooks/openstacknet/Makefile.am
+++ b/vdsm_hooks/openstacknet/Makefile.am
@@ -30,6 +30,7 @@
EXTRA_DIST = \
after_device_create.py \
+ after_device_destroy.py \
before_device_create.py \
$(constsfile) \
sudoers.in
@@ -41,12 +42,18 @@
$(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/after_device_create
$(INSTALL_SCRIPT) $(srcdir)/after_device_create.py \
$(DESTDIR)$(vdsmhooksdir)/after_device_create/50_openstacknet
+ $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/after_device_destroy
+ $(INSTALL_SCRIPT) $(srcdir)/after_device_destroy.py \
+ $(DESTDIR)$(vdsmhooksdir)/after_device_destroy/50_openstacknet
$(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/after_device_migrate_destination
$(INSTALL_SCRIPT) $(srcdir)/after_device_create.py \
$(DESTDIR)$(vdsmhooksdir)/after_device_migrate_destination/50_openstacknet
$(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/after_nic_hotplug
$(INSTALL_SCRIPT) $(srcdir)/after_device_create.py \
$(DESTDIR)$(vdsmhooksdir)/after_nic_hotplug/50_openstacknet
+ $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/after_nic_hotunplug
+ $(INSTALL_SCRIPT) $(srcdir)/after_device_destroy.py \
+ $(DESTDIR)$(vdsmhooksdir)/after_nic_hotunplug/50_openstacknet
$(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_device_create
$(INSTALL_SCRIPT) $(srcdir)/before_device_create.py \
$(DESTDIR)$(vdsmhooksdir)/before_device_create/50_openstacknet
@@ -56,8 +63,10 @@
uninstall-local: uninstall-data-consts uninstall-data-sudoers
$(RM) $(DESTDIR)$(vdsmhooksdir)/after_device_create/50_openstacknet
+ $(RM) $(DESTDIR)$(vdsmhooksdir)/after_device_destroy/50_openstacknet
$(RM) $(DESTDIR)$(vdsmhooksdir)/after_device_migrate_destination/50_openstacknet
$(RM) $(DESTDIR)$(vdsmhooksdir)/after_nic_hotplug/50_openstacknet
+ $(RM) $(DESTDIR)$(vdsmhooksdir)/after_nic_hotunplug/50_openstacknet
$(RM) $(DESTDIR)$(vdsmhooksdir)/before_device_create/50_openstacknet
$(RM) $(DESTDIR)$(vdsmhooksdir)/before_nic_hotplug/50_openstacknet
@@ -65,12 +74,18 @@
$(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/after_device_create
$(INSTALL_SCRIPT) $(srcdir)/$(constsfile) \
$(DESTDIR)$(vdsmhooksdir)/after_device_create/$(constsfile)
+ $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/after_device_destroy
+ $(INSTALL_SCRIPT) $(srcdir)/$(constsfile) \
+ $(DESTDIR)$(vdsmhooksdir)/after_device_destroy/$(constsfile)
$(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/after_device_migrate_destination
$(INSTALL_SCRIPT) $(srcdir)/$(constsfile) \
$(DESTDIR)$(vdsmhooksdir)/after_device_migrate_destination/$(constsfile)
$(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/after_nic_hotplug
$(INSTALL_SCRIPT) $(srcdir)/$(constsfile) \
$(DESTDIR)$(vdsmhooksdir)/after_nic_hotplug/$(constsfile)
+ $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/after_nic_hotunplug
+ $(INSTALL_SCRIPT) $(srcdir)/$(constsfile) \
+ $(DESTDIR)$(vdsmhooksdir)/after_nic_hotunplug/$(constsfile)
$(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_device_create
$(INSTALL_SCRIPT) $(srcdir)/$(constsfile) \
$(DESTDIR)$(vdsmhooksdir)/before_device_create/$(constsfile)
@@ -80,8 +95,10 @@
uninstall-data-consts:
$(RM) $(DESTDIR)$(vdsmhooksdir)/after_device_create/$(constsfile)
+ $(RM) $(DESTDIR)$(vdsmhooksdir)/after_device_destroy/$(constsfile)
$(RM) $(DESTDIR)$(vdsmhooksdir)/after_device_migrate_destination/$(constsfile)
$(RM) $(DESTDIR)$(vdsmhooksdir)/after_nic_hotplug/$(constsfile)
+ $(RM) $(DESTDIR)$(vdsmhooksdir)/after_nic_hotunplug/$(constsfile)
$(RM) $(DESTDIR)$(vdsmhooksdir)/before_device_create/$(constsfile)
$(RM) $(DESTDIR)$(vdsmhooksdir)/before_nic_hotplug/$(constsfile)
diff --git a/vdsm_hooks/openstacknet/after_device_destroy.py b/vdsm_hooks/openstacknet/after_device_destroy.py
new file mode 100755
index 0000000..e43d243
--- /dev/null
+++ b/vdsm_hooks/openstacknet/after_device_destroy.py
@@ -0,0 +1,66 @@
+#!/usr/bin/python
+
+'''
+OpenStack Network Hook (Post device destruction)
+================================================
+The hook receives a port_id for a virtual NIC that needs to be disconnected
+from the hybrid OVS/Linux Bridge which is used to allow security groups in OVS.
+
+Syntax:
+ { 'provider_type': 'OPENSTACK_NETWORK', 'vnic_id': 'port_id' }
+Where:
+ port_id should be replaced with the port id of the virtual NIC to be
+ disconnected from the hybrid bridge.'''
+
+import os
+import sys
+import traceback
+
+import hooking
+from openstacknet_utils import INTEGRATION_BRIDGE
+from openstacknet_utils import OPENSTACK_NET_PROVIDER_TYPE
+from openstacknet_utils import PLUGIN_TYPE_KEY
+from openstacknet_utils import PROVIDER_TYPE_KEY
+from openstacknet_utils import PT_OVS
+from openstacknet_utils import VNIC_ID_KEY
+from openstacknet_utils import checkDeviceExists
+from openstacknet_utils import devName
+from openstacknet_utils import executeOrExit
+from vdsm.constants import EXT_BRCTL
+from vdsm.constants import EXT_IP
+from vdsm.constants import EXT_OVS_VSCTL
+
+
+def disconnectVnic(portId):
+ brName = devName("qbr", portId)
+ vethBr = devName("qvb", portId)
+ vethOvs = devName("qvo", portId)
+
+ if checkDeviceExists(brName):
+ executeOrExit([EXT_BRCTL, 'delif', brName, vethBr])
+ executeOrExit([EXT_IP, 'link', 'set', brName, 'down'])
+ executeOrExit([EXT_BRCTL, 'delbr', brName])
+ executeOrExit([EXT_OVS_VSCTL, 'del-port', INTEGRATION_BRIDGE, vethOvs])
+ executeOrExit([EXT_IP, 'link', 'delete', vethOvs])
+
+
+def main():
+ if PROVIDER_TYPE_KEY not in os.environ:
+ return
+
+ providerType = os.environ[PROVIDER_TYPE_KEY]
+ pluginType = os.environ[PLUGIN_TYPE_KEY]
+ if (providerType == OPENSTACK_NET_PROVIDER_TYPE and
+ pluginType == PT_OVS):
+ vNicId = os.environ[VNIC_ID_KEY]
+ sys.stderr.write('Removing vNIC %s from %s for provider type %s'
+ % (vNicId, INTEGRATION_BRIDGE, providerType))
+ disconnectVnic(vNicId)
+
+
+if __name__ == '__main__':
+ try:
+ main()
+ except:
+ hooking.exit_hook('openstacknet hook: [unexpected error]: %s\n' %
+ traceback.format_exc())
diff --git a/vdsm_hooks/openstacknet/before_device_create.py b/vdsm_hooks/openstacknet/before_device_create.py
index 09c7a19..78d4ff1 100755
--- a/vdsm_hooks/openstacknet/before_device_create.py
+++ b/vdsm_hooks/openstacknet/before_device_create.py
@@ -29,17 +29,25 @@
import hooking
from openstacknet_utils import DUMMY_BRIDGE
+from openstacknet_utils import INTEGRATION_BRIDGE
from openstacknet_utils import OPENSTACK_NET_PROVIDER_TYPE
from openstacknet_utils import PLUGIN_TYPE_KEY
from openstacknet_utils import PROVIDER_TYPE_KEY
from openstacknet_utils import PT_BRIDGE
from openstacknet_utils import PT_OVS
+from openstacknet_utils import SECURITY_GROUPS_KEY
from openstacknet_utils import VNIC_ID_KEY
+from openstacknet_utils import checkDeviceExists
from openstacknet_utils import devName
+from openstacknet_utils import executeOrExit
+from vdsm.constants import EXT_BRCTL
+from vdsm.constants import EXT_IP
+from vdsm.constants import EXT_OVS_VSCTL
HELP_ARG = "-h"
TEST_ARG = "-t"
OVS_ARG = "-o"
+SECGROUPS_ARG = "-s"
HELP_TEXT = """usage: %(prog)s [%(help)s] [%(test)s [%(ovs)s]]
OpenStack Network Hook.
@@ -48,23 +56,67 @@
%(help)s show this help message and exit
%(test)s run a dry test for the hook
%(ovs)s run the test with OVS
-""" % {'help': HELP_ARG, 'test': TEST_ARG, 'ovs': OVS_ARG, 'prog': sys.argv[0]}
+ %(secgroups)s run the test with security groups
+""" % {'help': HELP_ARG,
+ 'test': TEST_ARG,
+ 'ovs': OVS_ARG,
+ 'secgroups': SECGROUPS_ARG,
+ 'prog': sys.argv[0]}
-# Default integration bridge name
-INTEGRATION_BRIDGE = 'br-int'
-
-
-def addLinuxBridgeVnic(domxml, iface, portId):
+def defineLinuxBridge(domxml, iface, portId, brName):
target = domxml.createElement('target')
target.setAttribute('dev', devName('tap', portId))
iface.appendChild(target)
source = iface.getElementsByTagName('source')[0]
- source.setAttribute('bridge', DUMMY_BRIDGE)
+ source.setAttribute('bridge', brName)
-def addOvsVnic(domxml, iface, portId):
+def addLinuxBridgeVnic(domxml, iface, portId):
+ defineLinuxBridge(domxml, iface, portId, DUMMY_BRIDGE)
+
+
+def addOvsVnic(domxml, iface, portId, hasSecurityGroups):
+ if hasSecurityGroups:
+ addOvsHybridVnic(domxml, iface, portId)
+ else:
+ addOvsDirectVnic(domxml, iface, portId)
+
+
+def addOvsHybridVnic(domxml, iface, portId):
+ brName = devName("qbr", portId)
+
+ if not checkDeviceExists(brName):
+ executeOrExit([EXT_BRCTL, 'addbr', brName])
+ executeOrExit([EXT_BRCTL, 'setfd', brName, '0'])
+ executeOrExit([EXT_BRCTL, 'stp', brName, 'off'])
+
+ vethBr = devName("qvb", portId)
+ vethOvs = devName("qvo", portId)
+
+ if not checkDeviceExists(vethOvs):
+ executeOrExit([EXT_IP, 'link', 'add', vethBr, 'type', 'veth', 'peer',
+ 'name', vethOvs])
+ for dev in [vethBr, vethOvs]:
+ executeOrExit([EXT_IP, 'link', 'set', dev, 'up'])
+ executeOrExit([EXT_IP, 'link', 'set', dev, 'promisc', 'on'])
+
+ executeOrExit([EXT_IP, 'link', 'set', brName, 'up'])
+ executeOrExit([EXT_BRCTL, 'addif', brName, vethBr])
+
+ mac = iface.getElementsByTagName('mac')[0].getAttribute('address')
+ executeOrExit([EXT_OVS_VSCTL, '--', '--may-exist', 'add-port',
+ INTEGRATION_BRIDGE, vethOvs,
+ '--', 'set', 'Interface', vethOvs,
+ 'external-ids:iface-id=%s' % portId,
+ 'external-ids:iface-status=active',
+ 'external-ids:attached-mac=%s' % mac])
+
+ defineLinuxBridge(domxml, iface, portId, brName)
+
+
+def addOvsDirectVnic(domxml, iface, portId):
source = iface.getElementsByTagName('source')[0]
source.setAttribute('bridge', INTEGRATION_BRIDGE)
@@ -76,12 +128,12 @@
iface.appendChild(virtualPort)
-def addOpenstackVnic(domxml, pluginType, portId):
+def addOpenstackVnic(domxml, pluginType, portId, hasSecurityGroups):
iface = domxml.getElementsByTagName('interface')[0]
if pluginType == PT_BRIDGE:
addLinuxBridgeVnic(domxml, iface, portId)
elif pluginType == PT_OVS:
- addOvsVnic(domxml, iface, portId)
+ addOvsVnic(domxml, iface, portId, hasSecurityGroups)
else:
hooking.exit_hook("Unknown plugin type: %s" % pluginType)
@@ -95,13 +147,23 @@
domxml = hooking.read_domxml()
vNicId = os.environ[VNIC_ID_KEY]
pluginType = os.environ[PLUGIN_TYPE_KEY]
+ hasSecurityGroups = SECURITY_GROUPS_KEY in os.environ
sys.stderr.write('Adding vNIC %s for provider type %s and plugin %s'
% (vNicId, providerType, pluginType))
- addOpenstackVnic(domxml, pluginType, vNicId)
+ addOpenstackVnic(domxml, pluginType, vNicId, hasSecurityGroups)
hooking.write_domxml(domxml)
-def test(ovs):
+def mockExecuteOrExit(command, expectSuccess=True):
+ print "Mocking successful execution of: %s" % " ".join(map(str, command))
+ return (0, '', '')
+
+
+def mockDeviceExists(dev):
+ return False
+
+
+def test(ovs, withSecurityGroups):
domxml = minidom.parseString("""<?xml version="1.0" encoding="utf-8"?>
<interface type="bridge">
<mac address="00:1a:4a:16:01:51"/>
@@ -114,7 +176,12 @@
else:
pluginType = PT_BRIDGE
- addOpenstackVnic(domxml, pluginType, 'test_port_id')
+ globals()['executeOrExit'] = mockExecuteOrExit
+ globals()['checkDeviceExists'] = mockDeviceExists
+ addOpenstackVnic(domxml,
+ pluginType,
+ 'test_port_id',
+ withSecurityGroups)
print domxml.toxml(encoding='utf-8')
@@ -125,7 +192,8 @@
try:
if TEST_ARG in sys.argv:
useOvs = OVS_ARG in sys.argv
- test(useOvs)
+ useSecGroups = SECGROUPS_ARG in sys.argv
+ test(useOvs, useSecGroups)
else:
main()
except:
diff --git a/vdsm_hooks/openstacknet/openstacknet_utils.py b/vdsm_hooks/openstacknet/openstacknet_utils.py
index a00d7ee..431c952 100644
--- a/vdsm_hooks/openstacknet/openstacknet_utils.py
+++ b/vdsm_hooks/openstacknet/openstacknet_utils.py
@@ -1,6 +1,7 @@
#!/usr/bin/python
import hooking
+from vdsm.constants import EXT_IP
from vdsm.netinfo import DUMMY_BRIDGE
# Constants for hook's API
@@ -8,8 +9,12 @@
OPENSTACK_NET_PROVIDER_TYPE = 'OPENSTACK_NETWORK'
VNIC_ID_KEY = 'vnic_id'
PLUGIN_TYPE_KEY = 'plugin_type'
+SECURITY_GROUPS_KEY = 'security_groups'
PT_BRIDGE = 'LINUX_BRIDGE'
PT_OVS = 'OPEN_VSWITCH'
+
+# Default integration bridge name to use for OVS
+INTEGRATION_BRIDGE = 'br-int'
# The maximum device name length in Linux
DEV_MAX_LENGTH = 14
@@ -28,3 +33,9 @@
def devName(prefix, name):
return (prefix + str(name))[:DEV_MAX_LENGTH]
+
+
+def checkDeviceExists(dev):
+ command = [EXT_IP, 'link', 'show', 'dev', dev]
+ retcode, out, err = hooking.execCmd(command, sudo=True, raw=True)
+ return retcode == 0
diff --git a/vdsm_hooks/openstacknet/sudoers.in b/vdsm_hooks/openstacknet/sudoers.in
index 37939a5..03a891a 100644
--- a/vdsm_hooks/openstacknet/sudoers.in
+++ b/vdsm_hooks/openstacknet/sudoers.in
@@ -1 +1,3 @@
vdsm ALL=(ALL) NOPASSWD: @BRCTL_PATH@
+vdsm ALL=(ALL) NOPASSWD: @IP_PATH@
+vdsm ALL=(ALL) NOPASSWD: @OVS_VSCTL_PATH@
--
To view, visit http://gerrit.ovirt.org/22585
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I77e219cce9c572ebef6a8584847f517abbda224d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mike Kolesnik <mkolesni(a)redhat.com>
10 years, 4 months
Change in vdsm[master]: vdsm: Log unhandled exception for API fence node.
by Maor Lipchuk
Maor Lipchuk has uploaded a new change for review.
Change subject: vdsm: Log unhandled exception for API fence node.
......................................................................
vdsm: Log unhandled exception for API fence node.
Adding a traceback log when openning a new thread in the Global class,
so it will not die silently when fails.
Change-Id: Ib9c618bd52f276d23c7f90742f690d20f45a6639
Signed-off-by: Maor Lipchuk <mlipchuk(a)redhat.com>
---
M vdsm/API.py
1 file changed, 1 insertion(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/13/22813/1
diff --git a/vdsm/API.py b/vdsm/API.py
index 5349cbf..b237049 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -1077,6 +1077,7 @@
agent is one of (rsa, ilo, drac5, ipmilan, etc)
action can be one of (status, on, off, reboot)."""
+ @utils.traceback(on=self.log.name)
def waitForPid(p, inp):
""" Wait until p.pid exits. Kill it if vdsm exists before. """
try:
--
To view, visit http://gerrit.ovirt.org/22813
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib9c618bd52f276d23c7f90742f690d20f45a6639
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Maor Lipchuk <mlipchuk(a)redhat.com>
10 years, 4 months
Change in vdsm[master]: clientIF: Decouple HSM and clientIF
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: clientIF: Decouple HSM and clientIF
......................................................................
clientIF: Decouple HSM and clientIF
clientIF.irs is currently created in clientIF.__init__, coupling
clientIF and HSM and creating confusion about irs availability during
initialization. There is a small window where irs is constructed but
not set yet. This state is invalid; we have only two states, irs
enabled or not, and we don't support moving from one state to the other.
This patch separates irs creation from clientIF creation. clientIF is
created now with either a fully constructed irs object or None,
eliminating the confusing unwanted state.
This change also makes it easier to test clientIF, allowing creating of
clientIF with fake irs instance.
Change-Id: I09aba3638d0dcf5aef73864dd0fe8eae1ced70b2
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/clientIF.py
M vdsm/vdsm
2 files changed, 22 insertions(+), 20 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/77/21877/1
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index 0b67e45..4ff570c 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -25,8 +25,6 @@
from xml.dom import minidom
import uuid
-from storage.dispatcher import Dispatcher
-from storage.hsm import HSM
import alignmentScan
from vdsm.config import config
import ksm
@@ -61,21 +59,25 @@
_instance = None
_instanceLock = threading.Lock()
- def __init__(self, log):
+ def __init__(self, irs, log):
"""
Initialize the (single) clientIF instance
+ :param irs: a Dispatcher object to be used as this object's irs.
+ :type irs: :class:`storage.dispatcher.Dispatcher`
:param log: a log object to be used for this object's logging.
:type log: :class:`logging.Logger`
"""
self.vmContainerLock = threading.Lock()
self._networkSemaphore = threading.Semaphore()
self._shutdownSemaphore = threading.Semaphore()
+ self.irs = irs
+ if self.irs:
+ self.irs.registerDomainStateChangeCallback(self.contEIOVms)
self.log = log
self._recovery = True
self.channelListener = Listener(self.log)
self._generationID = str(uuid.uuid4())
- self._initIRS()
self.mom = None
if _glusterEnabled:
self.gluster = gapi.GlusterApi(self, log)
@@ -130,14 +132,14 @@
vmObj.cont()
@classmethod
- def getInstance(cls, log=None):
+ def getInstance(cls, irs=None, log=None):
with cls._instanceLock:
if cls._instance is None:
if log is None:
raise Exception("Logging facility is required to create "
"the single clientIF instance")
else:
- cls._instance = clientIF(log)
+ cls._instance = clientIF(irs, log)
return cls._instance
def _loadBindingXMLRPC(self):
@@ -246,16 +248,6 @@
binding.start()
while self._enabled:
time.sleep(3)
-
- def _initIRS(self):
- self.irs = None
- if config.getboolean('irs', 'irs_enable'):
- try:
- self.irs = Dispatcher(HSM())
- except:
- self.log.error("Error initializing IRS", exc_info=True)
- else:
- self.irs.registerDomainStateChangeCallback(self.contEIOVms)
def _getUUIDSpecPath(self, uuid):
try:
diff --git a/vdsm/vdsm b/vdsm/vdsm
index 4ef9370..51e6aaa 100755
--- a/vdsm/vdsm
+++ b/vdsm/vdsm
@@ -24,6 +24,9 @@
from vdsm import constants
from vdsm.config import config
+from storage.dispatcher import Dispatcher
+from storage.hsm import HSM
+
import zombiereaper
import dsaversion
if sys.version_info[0] == 2:
@@ -42,6 +45,7 @@
def serve_clients(log):
cif = None
+ irs = None
def sigtermHandler(signum, frame):
if cif:
@@ -49,17 +53,23 @@
cif.prepareForShutdown()
def sigusr1Handler(signum, frame):
- if cif and cif.irs:
+ if irs:
log.debug("Received signal %s" % signum)
- cif.irs.spmStop(
- cif.irs.getConnectedStoragePoolsList()['poollist'][0])
+ irs.spmStop(
+ irs.getConnectedStoragePoolsList()['poollist'][0])
signal.signal(signal.SIGTERM, sigtermHandler)
signal.signal(signal.SIGUSR1, sigusr1Handler)
zombiereaper.registerSignalHandler()
+ if config.getboolean('irs', 'irs_enable'):
+ try:
+ irs = Dispatcher(HSM())
+ except:
+ log.error("Error initializing IRS", exc_info=True)
+
from clientIF import clientIF # must import after config is read
- cif = clientIF.getInstance(log)
+ cif = clientIF.getInstance(irs, log)
cif.serve()
--
To view, visit http://gerrit.ovirt.org/21877
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I09aba3638d0dcf5aef73864dd0fe8eae1ced70b2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
10 years, 4 months
Change in vdsm[master]: hooks: Extract devName function for openstacknet
by mkolesni@redhat.com
Mike Kolesnik has uploaded a new change for review.
Change subject: hooks: Extract devName function for openstacknet
......................................................................
hooks: Extract devName function for openstacknet
Extracted function to calculate the device name used for OpenStack
Networking devices.
Change-Id: I8ece3bb16ac5b9bb8b28c26f2e96d2d74defd4dc
Signed-off-by: Mike Kolesnik <mkolesni(a)redhat.com>
---
M vdsm_hooks/openstacknet/after_device_create.py
M vdsm_hooks/openstacknet/before_device_create.py
M vdsm_hooks/openstacknet/openstacknet_utils.py
3 files changed, 8 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/84/22584/1
diff --git a/vdsm_hooks/openstacknet/after_device_create.py b/vdsm_hooks/openstacknet/after_device_create.py
index bdd1c22..ce1210d 100755
--- a/vdsm_hooks/openstacknet/after_device_create.py
+++ b/vdsm_hooks/openstacknet/after_device_create.py
@@ -26,20 +26,19 @@
import traceback
import hooking
-from openstacknet_utils import DEV_MAX_LENGTH
from openstacknet_utils import DUMMY_BRIDGE
from openstacknet_utils import OPENSTACK_NET_PROVIDER_TYPE
from openstacknet_utils import PLUGIN_TYPE_KEY
from openstacknet_utils import PROVIDER_TYPE_KEY
from openstacknet_utils import PT_BRIDGE
from openstacknet_utils import VNIC_ID_KEY
+from openstacknet_utils import devName
from openstacknet_utils import executeOrExit
from vdsm.constants import EXT_BRCTL
def disconnectVnic(portId):
- tapName = ('tap' + portId)[:DEV_MAX_LENGTH]
- executeOrExit([EXT_BRCTL, 'delif', DUMMY_BRIDGE, tapName])
+ executeOrExit([EXT_BRCTL, 'delif', DUMMY_BRIDGE, devName('tap', portId)])
def main():
diff --git a/vdsm_hooks/openstacknet/before_device_create.py b/vdsm_hooks/openstacknet/before_device_create.py
index 20cd9f7..09c7a19 100755
--- a/vdsm_hooks/openstacknet/before_device_create.py
+++ b/vdsm_hooks/openstacknet/before_device_create.py
@@ -28,7 +28,6 @@
from xml.dom import minidom
import hooking
-from openstacknet_utils import DEV_MAX_LENGTH
from openstacknet_utils import DUMMY_BRIDGE
from openstacknet_utils import OPENSTACK_NET_PROVIDER_TYPE
from openstacknet_utils import PLUGIN_TYPE_KEY
@@ -36,6 +35,7 @@
from openstacknet_utils import PT_BRIDGE
from openstacknet_utils import PT_OVS
from openstacknet_utils import VNIC_ID_KEY
+from openstacknet_utils import devName
HELP_ARG = "-h"
TEST_ARG = "-t"
@@ -57,8 +57,7 @@
def addLinuxBridgeVnic(domxml, iface, portId):
target = domxml.createElement('target')
- tapName = ('tap' + portId)[:DEV_MAX_LENGTH]
- target.setAttribute('dev', tapName)
+ target.setAttribute('dev', devName('tap', portId))
iface.appendChild(target)
source = iface.getElementsByTagName('source')[0]
diff --git a/vdsm_hooks/openstacknet/openstacknet_utils.py b/vdsm_hooks/openstacknet/openstacknet_utils.py
index 36f6e0f..a00d7ee 100644
--- a/vdsm_hooks/openstacknet/openstacknet_utils.py
+++ b/vdsm_hooks/openstacknet/openstacknet_utils.py
@@ -24,3 +24,7 @@
if commandFailed:
hooking.exit_hook("Failed to execute %s, due to: %s" %
(str(command), err))
+
+
+def devName(prefix, name):
+ return (prefix + str(name))[:DEV_MAX_LENGTH]
--
To view, visit http://gerrit.ovirt.org/22584
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8ece3bb16ac5b9bb8b28c26f2e96d2d74defd4dc
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mike Kolesnik <mkolesni(a)redhat.com>
10 years, 4 months