Ido Barkan has uploaded a new change for review.
Change subject: net: fake sriov device hook ......................................................................
net: fake sriov device hook
This hook fakes both getVdsCaps and hostdevListByCaps to make VDSM report devices and capabilities of an SR-IOV capable host.
Change-Id: Ic661e152adf6365962b5d9fd215277b36bc49383 Signed-off-by: Ido Barkan ibarkan@redhat.com --- M configure.ac M contrib/shell_helper M vdsm.spec.in M vdsm_hooks/Makefile.am A vdsm_hooks/fakesriov/Makefile.am A vdsm_hooks/fakesriov/after_get_caps.py A vdsm_hooks/fakesriov/after_hostdev_list_by_caps.py 7 files changed, 185 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/47/47847/1
diff --git a/configure.ac b/configure.ac index 068c4b5..e68f1b4 100644 --- a/configure.ac +++ b/configure.ac @@ -369,6 +369,7 @@ vdsm_hooks/diskunmap/Makefile vdsm_hooks/ethtool_options/Makefile vdsm_hooks/extnet/Makefile + vdsm_hooks/fakesriov/Makefile vdsm_hooks/fakevmstats/Makefile vdsm_hooks/faqemu/Makefile vdsm_hooks/fileinject/Makefile diff --git a/contrib/shell_helper b/contrib/shell_helper index 7dc2984..6b6314a 100755 --- a/contrib/shell_helper +++ b/contrib/shell_helper @@ -10,7 +10,7 @@
_latest_rpms() { local VERSION=$(_latest_version) - find ~/rpmbuild/RPMS/ -iname "*$VERSION*.rpm" | egrep "vdsm-[0-9]|python|cli|xmlrpc|jsonrpc|tests|infra" + find ~/rpmbuild/RPMS/ -iname "*$VERSION*.rpm" | egrep "vdsm-[0-9]|python|cli|xmlrpc|jsonrpc|tests|infra|api" }
vdsm_configure_force() { diff --git a/vdsm.spec.in b/vdsm.spec.in index 3d6b51a..3c49487 100644 --- a/vdsm.spec.in +++ b/vdsm.spec.in @@ -430,6 +430,14 @@ To enable this hook on your host, set vars.fake_vmstats_enable=true in your /etc/vdsm/vdsm.conf.
+%package hook-fakesriov +Summary: Generate fake SR-IOV dsvices +Requires: %{name} + +%description hook-fakesriov +Hook intercepts reported host device by hostdevListByCaps and adds +1 fake sriov devices and 2 fake virtual function devices + %package hook-fileinject Summary: Allow uploading file to VMs disk Requires: python-libguestfs @@ -1273,6 +1281,11 @@ %defattr(-, root, root, -) %{_libexecdir}/%{vdsm_name}/hooks/after_get_all_vm_stats/10_fakevmstats
+%files hook-fakesriov +%defattr(-, root, root, -) +%{_libexecdir}/%{vdsm_name}/hooks/after_hostdev_list_by_caps/10_fakesriov +%{_libexecdir}/%{vdsm_name}/hooks/after_get_caps/10_fakesriov + %files hook-fileinject %defattr(-, root, root, -) %{_libexecdir}/%{vdsm_name}/hooks/before_vm_start/50_fileinject diff --git a/vdsm_hooks/Makefile.am b/vdsm_hooks/Makefile.am index 0573b2c..dda39bc 100644 --- a/vdsm_hooks/Makefile.am +++ b/vdsm_hooks/Makefile.am @@ -40,6 +40,7 @@ diskunmap \ extnet \ fileinject \ + fakesriov \ fakevmstats \ floppy \ hostusb \ diff --git a/vdsm_hooks/fakesriov/Makefile.am b/vdsm_hooks/fakesriov/Makefile.am new file mode 100644 index 0000000..2d6bc8d --- /dev/null +++ b/vdsm_hooks/fakesriov/Makefile.am @@ -0,0 +1,40 @@ +# +# Copyright 2015 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# +# Refer to the README and COPYING files for full details of the license +# + +include $(top_srcdir)/build-aux/Makefile.subs + +CLEANFILES = \ + config.log + +EXTRA_DIST = \ + after_hostdev_list_by_caps.py \ + after_get_caps.py + +install-data-local: + $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/after_hostdev_list_by_caps + $(INSTALL_SCRIPT) $(srcdir)/after_hostdev_list_by_caps.py \ + $(DESTDIR)$(vdsmhooksdir)/after_hostdev_list_by_caps/10_fakesriov + $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/after_get_caps + $(INSTALL_SCRIPT) $(srcdir)/after_get_caps.py \ + $(DESTDIR)$(vdsmhooksdir)/after_get_caps/10_fakesriov + +uninstall-local: + $(RM) $(DESTDIR)$(vdsmhooksdir)/after_hostdev_list_by_caps/10_fakesriov + $(RM) $(DESTDIR)$(vdsmhooksdir)/after_get_caps/10_fakesriov diff --git a/vdsm_hooks/fakesriov/after_get_caps.py b/vdsm_hooks/fakesriov/after_get_caps.py new file mode 100644 index 0000000..38dbb39 --- /dev/null +++ b/vdsm_hooks/fakesriov/after_get_caps.py @@ -0,0 +1,57 @@ +#!/usr/bin/python +# +# Copyright 2015 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# +# Refer to the README and COPYING files for full details of the license +# + +import hooking + +_PASSTHROUGH_SUPPORT = { + 'hostdevPassthrough': True} +_NICS = { + 'enp2s0f0': { + 'addr': '', 'cfg': {'BOOTPROTO': 'none', 'BRIDGE': 'ovirtmgmt', + 'DEVICE': 'enp2s0f0', + 'HWADDR': '78:e7:d1:e4:8f:16', 'IPV6INIT': 'no', + 'MTU': '1500', 'NM_CONTROLLED': 'no', + 'ONBOOT': 'yes'}, 'dhcpv4': False, 'dhcpv6': False, + 'gateway': '', 'hwaddr': '78:e7:d1:e4:8f:16', 'ipv4addrs': [], + 'ipv6addrs': ['fe80::7ae7:d1ff:fee4:8f16/64'], 'ipv6gateway': '::', + 'mtu': '1500', 'netmask': '', 'speed': 1000}, + 'enp2s16': {'addr': '', 'cfg': {'BOOTPROTO': 'none', 'DEVICE': 'enp2s16', + 'HWADDR': 'be:b8:2b:a8:15:bf', 'MTU': '1500', + 'NM_CONTROLLED': 'no', 'ONBOOT': 'yes'}, + 'dhcpv4': False, 'dhcpv6': False, 'gateway': '', + 'hwaddr': 'aa:8c:31:98:8a:9a', 'ipv4addrs': [], + 'ipv6addrs': [], 'ipv6gateway': '::', 'mtu': '1500', + 'netmask': '', 'speed': 0}, + 'enp2s16f2': {'addr': '', 'cfg': {'BOOTPROTO': 'none', 'BRIDGE': 'net', + 'DEVICE': 'enp2s16f2', + 'HWADDR': '26:83:76:ec:08:6b', + 'IPV6INIT': 'no', 'MTU': '1500', + 'NM_CONTROLLED': 'no', 'ONBOOT': 'yes'}, + 'dhcpv4': False, 'dhcpv6': False, 'gateway': '', + 'hwaddr': 'ce:1f:0b:d1:ca:93', 'ipv4addrs': [], + 'ipv6addrs': [], 'ipv6gateway': '::', 'mtu': '1500', + 'netmask': '', 'speed': 0}} + +if __name__ == '__main__': + caps = hooking.read_json() + caps.update(_PASSTHROUGH_SUPPORT) + caps['nics'].update(_NICS) + hooking.write_json(caps) diff --git a/vdsm_hooks/fakesriov/after_hostdev_list_by_caps.py b/vdsm_hooks/fakesriov/after_hostdev_list_by_caps.py new file mode 100644 index 0000000..2db7ffe --- /dev/null +++ b/vdsm_hooks/fakesriov/after_hostdev_list_by_caps.py @@ -0,0 +1,72 @@ +#!/usr/bin/python +# +# Copyright 2015 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# +# Refer to the README and COPYING files for full details of the license +# + +import hooking + +_FAKE_SRIOV = { + # sriov device + 'pci_0000_02_00_0': { + 'params': { + 'address': {'bus': '2', 'domain': '0', 'function': '0', + 'slot': '0'}, + 'capability': 'pci', 'iommu_group': '15', + 'parent': 'pci_0000_00_03_0', + 'product': '82576 Gigabit Network Connection', + 'product_id': '0x10e7', 'totalvfs': 7, + 'vendor': 'Intel Corporation', 'vendor_id': '0x8086'}}, + # sriov net device + 'net_enp2s0f0_78_e7_d1_e4_8f_16': { + 'params': { + 'capability': 'net', 'interface': 'enp2s0f0', + 'parent': 'pci_0000_02_00_0'}}, + # vf1 + 'pci_0000_02_10_0': { + 'params': { + 'address': {'bus': '2', 'domain': '0', 'function': '0', + 'slot': '16'}, + 'capability': 'pci', 'iommu_group': '23', + 'parent': 'pci_0000_00_03_0', 'physfn': 'pci_0000_02_00_0', + 'product': '82576 Virtual Function', 'product_id': '0x10ca', + 'vendor': 'Intel Corporation', 'vendor_id': '0x8086'}}, + # vf1 net device + 'net_enp2s16_aa_8c_31_98_8a_9a': { + 'params': { + 'capability': 'net', 'interface': 'enp2s16', + 'parent': 'pci_0000_02_10_0'}}, + # vf2 + 'pci_0000_02_10_2': { + 'params': { + 'address': {'bus': '2', 'domain': '0', 'function': '2', + 'slot': '16'}, + 'capability': 'pci', 'iommu_group': '24', + 'parent': 'pci_0000_00_03_0', 'physfn': 'pci_0000_02_00_0', + 'product': '82576 Virtual Function', 'product_id': '0x10ca', + 'vendor': 'Intel Corporation', 'vendor_id': '0x8086'}}, + # vf2 net device + 'net_enp2s16f2_ce_1f_0b_d1_ca_93': { + 'params': { + 'capability': 'net', 'interface': 'enp2s16f2', + 'parent': 'pci_0000_02_10_2'}}} + +if __name__ == '__main__': + host_devices = hooking.read_json() + host_devices.update(_FAKE_SRIOV) + hooking.write_json(host_devices)
automation@ovirt.org has posted comments on this change.
Change subject: net: fake sriov device hook ......................................................................
Patch Set 1:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
Ido Barkan has posted comments on this change.
Change subject: net: fake sriov device hook ......................................................................
Patch Set 1:
shell_helper is here only until after https://gerrit.ovirt.org/#/c/44198/ will be merged and then the rebase will eliminate this.
automation@ovirt.org has posted comments on this change.
Change subject: net: fake sriov device hook ......................................................................
Patch Set 2:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
Ido Barkan has posted comments on this change.
Change subject: net: fake sriov device hook ......................................................................
Patch Set 2: Verified+1
Dan Kenigsberg has posted comments on this change.
Change subject: net: fake sriov device hook ......................................................................
Patch Set 2: Code-Review-1
14:05:23 ./vdsm_hooks/fakesriov/after_get_caps.py:37:29: E128 continuation line under-indented for visual indent 14:05:23 ./vdsm_hooks/fakesriov/after_get_caps.py:38:29: E128 continuation line under-indented for visual indent 14:05:23 Makefile:1007: recipe for target 'pep8' failed
Dan Kenigsberg has posted comments on this change.
Change subject: net: fake sriov device hook ......................................................................
Patch Set 2:
(3 comments)
https://gerrit.ovirt.org/#/c/47847/2/vdsm_hooks/fakesriov/after_hostdev_list... File vdsm_hooks/fakesriov/after_hostdev_list_by_caps.py:
Line 22: import hooking Line 23: Line 24: _FAKE_SRIOV = { Line 25: # sriov device Line 26: 'pci_0000_02_00_0': { can you use fancier PCI addresses (say, bus 22 instead of 02) so there is a lesser chance we would collide with a true device on a true host? Line 27: 'params': { Line 28: 'address': {'bus': '2', 'domain': '0', 'function': '0', Line 29: 'slot': '0'}, Line 30: 'capability': 'pci', 'iommu_group': '15',
Line 32: 'product': '82576 Gigabit Network Connection', Line 33: 'product_id': '0x10e7', 'totalvfs': 7, Line 34: 'vendor': 'Intel Corporation', 'vendor_id': '0x8086'}}, Line 35: # sriov net device Line 36: 'net_enp2s0f0_78_e7_d1_e4_8f_16': { same request applies to nic names. Line 37: 'params': { Line 38: 'capability': 'net', 'interface': 'enp2s0f0', Line 39: 'parent': 'pci_0000_02_00_0'}}, Line 40: # vf1
Line 66: 'capability': 'net', 'interface': 'enp2s16f2', Line 67: 'parent': 'pci_0000_02_10_2'}}} Line 68: Line 69: if __name__ == '__main__': Line 70: host_devices = hooking.read_json() people tend to install hooks automatically, and then complain that their host behaves in a silly way.
Please make this hook disabled by default (see https://gerrit.ovirt.org/43931 ) and add a little README file explaining for what is this hook good for (demoing and testing our new feature). Line 71: host_devices.update(_FAKE_SRIOV)
Martin Polednik has posted comments on this change.
Change subject: net: fake sriov device hook ......................................................................
Patch Set 2:
Agree with Dan's comments, as long as the hook isn't default and the names are a bit fancier you can consider this comment +1 for the idea.
automation@ovirt.org has posted comments on this change.
Change subject: net: fake sriov device hook ......................................................................
Patch Set 3:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
automation@ovirt.org has posted comments on this change.
Change subject: net: fake sriov device hook ......................................................................
Patch Set 4:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
Dan Kenigsberg has posted comments on this change.
Change subject: net: fake sriov device hook ......................................................................
Patch Set 4: Code-Review-1
(1 comment)
https://gerrit.ovirt.org/#/c/47847/4/vdsm_hooks/fakesriov/after_get_caps.py File vdsm_hooks/fakesriov/after_get_caps.py:
Line 50: 'hwaddr': 'ce:1f:0b:d1:ca:93', 'ipv4addrs': [], Line 51: 'ipv6addrs': [], 'ipv6gateway': '::', 'mtu': '1500', Line 52: 'netmask': '', 'speed': 0}} Line 53: Line 54: if __name__ == '__main__': people tend to install hooks automatically, and then complain that their host behaves in a silly way.
Please make this hook disabled by default (see https://gerrit.ovirt.org/43931 ) and add a little README file explaining for what is this hook good for (demoing and testing our new feature). Line 55: caps = hooking.read_json() Line 56: caps.update(_PASSTHROUGH_SUPPORT) Line 57: caps['nics'].update(_NICS)
Yevgeny Zaspitsky has posted comments on this change.
Change subject: net: fake sriov device hook ......................................................................
Patch Set 4: Verified+1
Ido Barkan has posted comments on this change.
Change subject: net: fake sriov device hook ......................................................................
Patch Set 2:
(3 comments)
https://gerrit.ovirt.org/#/c/47847/2/vdsm_hooks/fakesriov/after_hostdev_list... File vdsm_hooks/fakesriov/after_hostdev_list_by_caps.py:
Line 22: import hooking Line 23: Line 24: _FAKE_SRIOV = { Line 25: # sriov device Line 26: 'pci_0000_02_00_0': {
can you use fancier PCI addresses (say, bus 22 instead of 02) so there is a
Done Line 27: 'params': { Line 28: 'address': {'bus': '2', 'domain': '0', 'function': '0', Line 29: 'slot': '0'}, Line 30: 'capability': 'pci', 'iommu_group': '15',
Line 32: 'product': '82576 Gigabit Network Connection', Line 33: 'product_id': '0x10e7', 'totalvfs': 7, Line 34: 'vendor': 'Intel Corporation', 'vendor_id': '0x8086'}}, Line 35: # sriov net device Line 36: 'net_enp2s0f0_78_e7_d1_e4_8f_16': {
same request applies to nic names.
Done Line 37: 'params': { Line 38: 'capability': 'net', 'interface': 'enp2s0f0', Line 39: 'parent': 'pci_0000_02_00_0'}}, Line 40: # vf1
Line 66: 'capability': 'net', 'interface': 'enp2s16f2', Line 67: 'parent': 'pci_0000_02_10_2'}}} Line 68: Line 69: if __name__ == '__main__': Line 70: host_devices = hooking.read_json()
people tend to install hooks automatically, and then complain that their ho
Done Line 71: host_devices.update(_FAKE_SRIOV)
Ido Barkan has posted comments on this change.
Change subject: net: fake sriov device hook ......................................................................
Patch Set 4:
(1 comment)
https://gerrit.ovirt.org/#/c/47847/4/vdsm_hooks/fakesriov/after_get_caps.py File vdsm_hooks/fakesriov/after_get_caps.py:
Line 50: 'hwaddr': 'ce:1f:0b:d1:ca:93', 'ipv4addrs': [], Line 51: 'ipv6addrs': [], 'ipv6gateway': '::', 'mtu': '1500', Line 52: 'netmask': '', 'speed': 0}} Line 53: Line 54: if __name__ == '__main__':
people tend to install hooks automatically, and then complain that their ho
done. I missed this in revision 2. fixed now. Line 55: caps = hooking.read_json() Line 56: caps.update(_PASSTHROUGH_SUPPORT) Line 57: caps['nics'].update(_NICS)
automation@ovirt.org has posted comments on this change.
Change subject: net: fake sriov device hook ......................................................................
Patch Set 5:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
automation@ovirt.org has posted comments on this change.
Change subject: net: use libvirt to manage bridge mac learning ......................................................................
Patch Set 6:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
automation@ovirt.org has posted comments on this change.
Change subject: net: fake sriov device hook ......................................................................
Patch Set 7:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
Ido Barkan has posted comments on this change.
Change subject: net: fake sriov device hook ......................................................................
Patch Set 7: Verified+1
Dan Kenigsberg has posted comments on this change.
Change subject: net: fake sriov device hook ......................................................................
Patch Set 7: Code-Review+2
Dan Kenigsberg has submitted this change and it was merged.
Change subject: net: fake sriov device hook ......................................................................
net: fake sriov device hook
This hook fakes both getVdsCaps and hostdevListByCaps to make VDSM report devices and capabilities of an SR-IOV capable host.
Change-Id: Ic661e152adf6365962b5d9fd215277b36bc49383 Signed-off-by: Ido Barkan ibarkan@redhat.com Reviewed-on: https://gerrit.ovirt.org/47847 Continuous-Integration: Jenkins CI Reviewed-by: Dan Kenigsberg danken@redhat.com --- M configure.ac M lib/vdsm/config.py.in M vdsm.spec.in M vdsm_hooks/Makefile.am A vdsm_hooks/fakesriov/Makefile.am A vdsm_hooks/fakesriov/README A vdsm_hooks/fakesriov/after_get_caps.py A vdsm_hooks/fakesriov/after_hostdev_list_by_caps.py 8 files changed, 225 insertions(+), 0 deletions(-)
Approvals: Ido Barkan: Verified Jenkins CI: Passed CI tests Dan Kenigsberg: Looks good to me, approved
automation@ovirt.org has posted comments on this change.
Change subject: net: fake sriov device hook ......................................................................
Patch Set 8:
* Update tracker: IGNORE, no Bug-Url found * Set MODIFIED::IGNORE, no Bug-Url found.
vdsm-patches@lists.fedorahosted.org