Petr Horáček has posted comments on this change. Change subject: net: Libvirt hook that enables ovs-legacy migration ......................................................................
Patch Set 9: Code-Review-1 (9 comments) https://gerrit.ovirt.org/#/c/55497/9/vdsm_hooks/ovs/Makefile.am File vdsm_hooks/ovs/Makefile.am: Line 28: dist_vdsmexec_SCRIPTS = \ Line 29: ovs_migrate.py \ Line 30: ovs_utils.py \ Line 31: $(NULL) Line 32: install-data handling is not needed here? (see the second part of this file) Line 33: CLEANFILES = \ Line 34: $(nodist_noinst_DATA) Line 35: Line 36: EXTRA_DIST = \ https://gerrit.ovirt.org/#/c/55497/9/vdsm_hooks/ovs/ovs_migrate.py File vdsm_hooks/ovs/ovs_migrate.py: Line 1: #!/usr/bin/env python Line 2: # Copyright 2015 Red Hat, Inc. 2016 Line 3: # Line 4: # This program is free software; you can redistribute it and/or modify Line 5: # it under the terms of the GNU General Public License as published by Line 6: # the Free Software Foundation; either version 2 of the License, or Line 18: # Refer to the README and COPYING files for full details of the license Line 19: # Line 20: from __future__ import print_function Line 21: Line 22: import six six is not a standard library package Line 23: import sys Line 24: import xml.etree.ElementTree as ET Line 25: Line 26: from vdsm import netconfpersistence Line 27: Line 28: import ovs_utils Line 29: Line 30: # LOG_FILE = '/tmp/libvirthook_ovs_migrate.log' Line 31: # log = open(LOG_FILE, 'w') leftovers? Line 32: Line 33: Line 34: def main(domain, event, phase, *args, **gwargs): Line 35: if event not in ('migrate', 'restore'): PS9, Line 36: 0 why not 1? Line 34: def main(domain, event, phase, *args, **gwargs): Line 35: if event not in ('migrate', 'restore'): Line 36: sys.exit(0) Line 37: Line 38: # print('Hook input args are: ', domain, event, phase, file=log) leftovers? Line 39: Line 40: stdin = gwargs.get('stdin', sys.stdin) Line 41: tree = ET.parse(stdin) Line 42: root = tree.getroot() Line 48: # 'source bridge' element must exist Line 49: elem_source = interface.find('source') Line 50: source_bridge = elem_source.get('bridge') Line 51: Line 52: elem_virtualport = interface.find('virtualport') could be moved before to line 44 Line 53: Line 54: # If the source bridge is the OVS switch name (its default bridge) Line 55: # it cannot be validated against the running config, as it is not a Line 56: # net name. Instead, a non vlan network is looked for and if found, Line 54: # If the source bridge is the OVS switch name (its default bridge) Line 55: # it cannot be validated against the running config, as it is not a Line 56: # net name. Instead, a non vlan network is looked for and if found, Line 57: # it is assumed to be the target network (raising the limitation of Line 58: # having a single non-vlan network on a host). this limitation is only for OVS networks. you can have another legacy non-vlan network on the host. therefore you should iterate only OVS networks. take a look at ovs_before_network_setup_ovs.py:_get_untagged_net() Line 59: if source_bridge == ovs_utils.BRIDGE_NAME: Line 60: nets = [net for net, attrs in six.iteritems( Line 61: running_config.networks) if attrs.get('vlan') is None] Line 62: if len(nets) == 1: Line 94: stdout = gwargs.get('stdout', sys.stdout) Line 95: tree.write(stdout) Line 96: Line 97: # tree.write(log) Line 98: # print('\nEnd of hook', file=log) and leftovers Line 99: Line 100: Line 101: if __name__ == '__main__': -- To view, visit https://gerrit.ovirt.org/55497 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I29cf441cc365d3679382e44410dad0906d9be3ec Gerrit-PatchSet: 9 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Edward Haas <edwa...@redhat.com> Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com> Gerrit-Reviewer: Edward Haas <edwa...@redhat.com> Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Ondřej Svoboda <osvob...@redhat.com> Gerrit-Reviewer: Petr Horáček <phora...@redhat.com> Gerrit-Reviewer: gerrit-hooks <automat...@ovirt.org> Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches