Change in vdsm[master]: tests: Introduce schema parsing tests
by alitke@redhat.com
Adam Litke has uploaded a new change for review.
Change subject: tests: Introduce schema parsing tests
......................................................................
tests: Introduce schema parsing tests
Change-Id: I48c2d2cb260e175ad119ece4c5e36552bb303ada
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M tests/schemaTests.py
1 file changed, 88 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/64/45464/1
diff --git a/tests/schemaTests.py b/tests/schemaTests.py
index e00edba..c6fc89b 100644
--- a/tests/schemaTests.py
+++ b/tests/schemaTests.py
@@ -17,6 +17,10 @@
# Refer to the README and COPYING files for full details of the license
#
+import textwrap
+from contextlib import contextmanager
+
+from testlib import temporaryPath
from testlib import VdsmTestCase as TestCaseBase
from rpc import vdsmapi
@@ -92,3 +96,87 @@
def testTokenizeRaiseOnInvalidData(self):
generator = vdsmapi.tokenize("{'a': invalid, 'b': 'c'}")
self.assertRaises(ValueError, list, generator)
+
+
+class ParseTest(TestCaseBase):
+ blank_schema = {'types': {}, 'enums': {}, 'aliases': {},
+ 'maps': {}, 'commands': {}, 'unions': {}}
+
+ @contextmanager
+ def load_api(self, data):
+ vdsmapi._api_info = None
+ data = textwrap.dedent(data)
+ with temporaryPath(data=data) as filename:
+ yield vdsmapi.get_api(filename)
+
+ def assertTypeRelation(self, api, type_a, type_b):
+ self.assertIn(type_b, api['unions'][type_a])
+ self.assertIn(type_a, api['unions'][type_b])
+
+ def test_empty_schema(self):
+ with self.load_api('') as api:
+ self.assertEqual(self.blank_schema, api)
+
+ def test_unknown_symbol_type(self):
+ with self.load_api('''
+ {'foo': 'bar', 'data': ['a', 'b', 'c']}
+ ''') as api:
+ self.assertEqual(self.blank_schema, api)
+
+ def test_single_type(self):
+ with self.load_api('''
+ {'type': 'foo', 'data': {'a': 'str'}}
+ ''') as api:
+ self.assertIn('foo', api['types'])
+ self.assertEqual('str', api['types']['foo']['data']['a'])
+
+ def test_single_enum(self):
+ with self.load_api('''
+ {'enum': 'foo', 'data': ['a', 'b', 'c']}
+ ''') as api:
+ self.assertEqual(['a', 'b', 'c'], api['enums']['foo']['data'])
+
+ def test_single_alias(self):
+ with self.load_api('''
+ {'alias': 'UUID', 'data': 'str'}
+ ''') as api:
+ self.assertEqual('str', api['aliases']['UUID']['data'])
+
+ def test_single_map(self):
+ map = {'map': 'foo', 'key': 'str', 'value': 'str'}
+ with self.load_api(str(map)) as api:
+ self.assertEqual(map, api['maps']['foo'])
+
+ def test_single_command(self):
+ cmd = {'command': {'class': 'foo', 'name': 'bar'},
+ 'data': {'a': 'uint'}, 'returns': 'str'}
+ with self.load_api(str(cmd)) as api:
+ self.assertEqual(cmd, api['commands']['foo']['bar'])
+
+ def test_command_parameter_order(self):
+ # The parser will preserve the order of dict keys when loading
+ with self.load_api('''
+ {'command': {'class': 'foo', 'name': 'bar'},
+ 'data': {'a': 'uint', 'b': 'str', 'c': 'int'}}
+ ''') as api:
+ self.assertEqual(['a', 'b', 'c'],
+ api['commands']['foo']['bar']['data'].keys())
+
+ def test_type_union(self):
+ with self.load_api('''
+ {'enum': 'ThingTypes', 'data': ['person', 'place']}
+
+ {'type': 'Thing',
+ 'data': {'specificType': 'ThingTypes', 'name': 'str'},
+ 'union': ['Person', 'Place']}
+
+ {'type': 'Person',
+ 'data': {'specificType': 'ThingTypes', 'name': 'str',
+ 'address': 'str'}}
+
+ {'type': 'Place',
+ 'data': {'specificType': 'ThingTypes', 'name': 'str',
+ 'longitude': 'float', 'latitude': 'float'}}
+ ''') as api:
+ self.assertTypeRelation(api, 'Thing', 'Person')
+ self.assertTypeRelation(api, 'Thing', 'Place')
--
To view, visit https://gerrit.ovirt.org/45464
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I48c2d2cb260e175ad119ece4c5e36552bb303ada
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
8 years, 7 months
Change in vdsm[master]: lib: grub2 module
by Martin Polednik
Martin Polednik has posted comments on this change.
Change subject: lib: grub2 module
......................................................................
Patch Set 1:
(1 comment)
https://gerrit.ovirt.org/#/c/47946/1/lib/vdsm/grub2.py
File lib/vdsm/grub2.py:
Line 143: if not val:
Line 144: continue
Line 145: workarounds.append(val)
Line 146:
Line 147: return workarounds
> could be a list comprehnsion
Not really, as split would introduce empty element.
Line 148:
Line 149:
Line 150: def _add_workaround(workarounds, workaround):
Line 151: try:
--
To view, visit https://gerrit.ovirt.org/47946
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I9e7e0b327882f64196a71fe20dcbd99017b80800
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: Yes
8 years, 7 months
Change in vdsm[master]: lib: grub2 module
by automation@ovirt.org
automation(a)ovirt.org has posted comments on this change.
Change subject: lib: grub2 module
......................................................................
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'])
--
To view, visit https://gerrit.ovirt.org/47946
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I9e7e0b327882f64196a71fe20dcbd99017b80800
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
8 years, 7 months
Change in vdsm[master]: lib: grub2 module
by automation@ovirt.org
automation(a)ovirt.org has posted comments on this change.
Change subject: lib: grub2 module
......................................................................
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'])
--
To view, visit https://gerrit.ovirt.org/47946
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I9e7e0b327882f64196a71fe20dcbd99017b80800
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
8 years, 7 months
Change in vdsm[master]: config: Resolve crash when IPv6 disabled in kernel
by automation@ovirt.org
automation(a)ovirt.org has posted comments on this change.
Change subject: config: Resolve crash when IPv6 disabled in kernel
......................................................................
Patch Set 1:
* Update tracker::#1277204::OK
* Check Bug-Url::OK
* Check Public Bug::#1277204::OK, public bug
* Check Product::#1277204::OK, Correct classification oVirt
* Check TM::SKIP, not in a monitored branch (ovirt-3.5 ovirt-3.4 ovirt-3.3 ovirt-3.2)
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
--
To view, visit https://gerrit.ovirt.org/47978
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I774cac868ddee08ac072adf2104a811594779052
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ollie Armstrong <ollie(a)fubra.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
8 years, 7 months
Change in vdsm[master]: lib: grub2 module
by fromani@redhat.com
Francesco Romani has posted comments on this change.
Change subject: lib: grub2 module
......................................................................
Patch Set 1:
(8 comments)
initial review, mostly minor things.
To be able to do a meaningful review, I miss to see how this is going to be used. I'd like to ask for
- tests!
- a simple commandline tool to exercise/run the same code without vdsm running,for debug/troubleshooting purpose. Let's have it under contrib/
https://gerrit.ovirt.org/#/c/47946/1//COMMIT_MSG
Commit Message:
Line 5: CommitDate: 2015-11-02 10:49:59 +0100
Line 6:
Line 7: lib: grub2 module
Line 8:
Line 9: work in progress
when you add the real content, please say it loud and clear that in the long term we want to depend on a system configuration tool, asking just for the things we care, and state this is a short-term quick fix until we can use such tool.
Line 10:
Line 11: Change-Id: I9e7e0b327882f64196a71fe20dcbd99017b80800
https://gerrit.ovirt.org/#/c/47946/1/lib/vdsm/grub2.py
File lib/vdsm/grub2.py:
Line 29: _CFG_NAME_WORKAROUNDS = 'VDSM_WORKAROUNDS'
Line 30: _CFG_NAME_CMDLINE = 'GRUB_CMDLINE_LINUX'
Line 31: _CMDLINE_STUB_IDS = 'pci-stub.ids='
Line 32:
Line 33: _GRUB2_MKCONFIG = utils.CommandPath('/usr/sbin/grub2-mkconfig')
> maybe just grub2-mkconfig and let CommandPath figure out the path?
Nope, the common idiom is exactly this one. Bogus comment from me, let's ignore it.
Line 34:
Line 35:
Line 36: class Error(Exception):
Line 37:
Line 32:
Line 33: _GRUB2_MKCONFIG = utils.CommandPath('/usr/sbin/grub2-mkconfig')
Line 34:
Line 35:
Line 36: class Error(Exception):
> This is exactly what I'd like to see as I've seen it 3-or-so times lately.
Tracked in https://gerrit.ovirt.org/#/c/47964/ - and following
Line 37:
Line 38: def __init__(self, rc, out, err):
Line 39: self.rc = rc
Line 40: self.out = out
Line 51: rc, out, err = utils.execCmd(_GRUB2_MKCONFIG, raw=True)
Line 52: if rc != 0:
Line 53: raise Error(rc, out, err)
Line 54:
Line 55:
no other entry points? How the next functions are going to be used?
Line 56: def _init_cfg(grub_cfg):
Line 57: if _CFG_NAME_PCI_STUB not in grub_cfg:
Line 58: new_cfg = collections.OrderedDict()
Line 59: new_cfg[_CFG_NAME_PCI_STUB] = _CMDLINE_STUB_IDS
Line 81: for line in data:
Line 82: line = line.rstrip().split('=', 1)
Line 83: grub_cfg[line[0]] = line[1]
Line 84:
Line 85: return grub_cfg
minor: why not just
def _parse_cfg(cfg=_GRUB_CONFIG):
grub_cfg = collections.OrderedDict()
with open(cfg, 'r') as f:
for line in f:
key, value = line.rstrip().split('=', 1)
grub_cfg[key] = value
return grub_cfg
Line 86:
Line 87:
Line 88: def _save_cfg(grub_cfg, cfg=_GRUB_CONFIG):
Line 89: with open(cfg, 'w') as f:
Line 115:
Line 116: device_vendor = device_vendor.lstrip('0x')
Line 117: device_product = device_product.lstrip('0x')
Line 118:
Line 119: if len(stub_ids) > 0:
if stub_ids:
Line 120: for vendor, product in stub_ids:
Line 121: if device_vendor == vendor and device_product == product:
Line 122: return
Line 123:
Line 128:
Line 129: device_vendor = device_vendor.lstrip('0x')
Line 130: device_product = device_product.lstrip('0x')
Line 131:
Line 132: if len(stub_ids) > 0:
ditto
Line 133: for idx, (vendor, product) in enumerate(stub_ids):
Line 134: if device_vendor == vendor and device_product == product:
Line 135: del(stub_ids[idx])
Line 136: break
Line 143: if not val:
Line 144: continue
Line 145: workarounds.append(val)
Line 146:
Line 147: return workarounds
could be a list comprehnsion
Line 148:
Line 149:
Line 150: def _add_workaround(workarounds, workaround):
Line 151: try:
--
To view, visit https://gerrit.ovirt.org/47946
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I9e7e0b327882f64196a71fe20dcbd99017b80800
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: Yes
8 years, 7 months
Change in vdsm[master]: lib: grub2 module
by Martin Polednik
Martin Polednik has posted comments on this change.
Change subject: lib: grub2 module
......................................................................
Patch Set 1:
(2 comments)
Why do you see grub2-* as too low level?
https://gerrit.ovirt.org/#/c/47946/1/lib/vdsm/grub2.py
File lib/vdsm/grub2.py:
Line 22: import collections
Line 23:
Line 24: from . import utils
Line 25:
Line 26: _GRUB_CONFIG = os.path.abspath('/etc/default/grub')
> but this isn't already an abs path? :)
I'd say you're right, not really needed to normalize it I guess.
Line 27:
Line 28: _CFG_NAME_PCI_STUB = 'VDSM_PCI_STUB_DEVICES'
Line 29: _CFG_NAME_WORKAROUNDS = 'VDSM_WORKAROUNDS'
Line 30: _CFG_NAME_CMDLINE = 'GRUB_CMDLINE_LINUX'
Line 32:
Line 33: _GRUB2_MKCONFIG = utils.CommandPath('/usr/sbin/grub2-mkconfig')
Line 34:
Line 35:
Line 36: class Error(Exception):
> For another patch, not necessarily from yours: let's factor this Error copi
This is exactly what I'd like to see as I've seen it 3-or-so times lately.
Line 37:
Line 38: def __init__(self, rc, out, err):
Line 39: self.rc = rc
Line 40: self.out = out
--
To view, visit https://gerrit.ovirt.org/47946
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I9e7e0b327882f64196a71fe20dcbd99017b80800
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: Yes
8 years, 7 months
Change in vdsm[ovirt-3.6.0]: init: configure multipath on upgrade from ovirt-3.5
by ykaplan@redhat.com
Yeela Kaplan has uploaded a new change for review.
Change subject: init: configure multipath on upgrade from ovirt-3.5
......................................................................
init: configure multipath on upgrade from ovirt-3.5
multipath configurator was added to vdsm-tool
in ovirt-3.6.
In case we upgrade from ovirt-3.5 we now run configure of
module multipath in init script.
Change-Id: Ifbebdebb6bda25606b20d91804977fa8eb7f13e8
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1276736
Signed-off-by: Yeela Kaplan <ykaplan(a)redhat.com>
---
M init/vdsmd_init_common.sh.in
1 file changed, 4 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/57/47957/1
diff --git a/init/vdsmd_init_common.sh.in b/init/vdsmd_init_common.sh.in
index 00e4054..8dccec4 100644
--- a/init/vdsmd_init_common.sh.in
+++ b/init/vdsmd_init_common.sh.in
@@ -259,6 +259,10 @@
# by running manual configure command
"$VDSM_TOOL" configure --force
ret=$?
+ elif grep -q '^vdsm-4\.16\.' "${upgraded_ver_file}"; then
+ # REQUIRED_FOR upgrade from vdsm-4.16.z
+ "$VDSM_TOOL" configure --module multipath
+ ret=$?
fi
[ "${ret}" -eq 0 ] && rm -f "${upgraded_ver_file}"
fi
--
To view, visit https://gerrit.ovirt.org/47957
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifbebdebb6bda25606b20d91804977fa8eb7f13e8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6.0
Gerrit-Owner: Yeela Kaplan <ykaplan(a)redhat.com>
8 years, 7 months
Change in vdsm[ovirt-3.6]: init: configure multipath on upgrade from ovirt-3.5
by ykaplan@redhat.com
Yeela Kaplan has uploaded a new change for review.
Change subject: init: configure multipath on upgrade from ovirt-3.5
......................................................................
init: configure multipath on upgrade from ovirt-3.5
multipath configurator was added to vdsm-tool
in ovirt-3.6.
In case we upgrade from ovirt-3.5 we now run configure of
module multipath in init script.
Change-Id: Ifbebdebb6bda25606b20d91804977fa8eb7f13e8
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1276736
Signed-off-by: Yeela Kaplan <ykaplan(a)redhat.com>
---
M init/vdsmd_init_common.sh.in
1 file changed, 4 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/56/47956/1
diff --git a/init/vdsmd_init_common.sh.in b/init/vdsmd_init_common.sh.in
index 00e4054..8dccec4 100644
--- a/init/vdsmd_init_common.sh.in
+++ b/init/vdsmd_init_common.sh.in
@@ -259,6 +259,10 @@
# by running manual configure command
"$VDSM_TOOL" configure --force
ret=$?
+ elif grep -q '^vdsm-4\.16\.' "${upgraded_ver_file}"; then
+ # REQUIRED_FOR upgrade from vdsm-4.16.z
+ "$VDSM_TOOL" configure --module multipath
+ ret=$?
fi
[ "${ret}" -eq 0 ] && rm -f "${upgraded_ver_file}"
fi
--
To view, visit https://gerrit.ovirt.org/47956
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifbebdebb6bda25606b20d91804977fa8eb7f13e8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Yeela Kaplan <ykaplan(a)redhat.com>
8 years, 7 months
Change in vdsm[master]: hooks: ovs: start every log with 'OVS: '
by phoracek@redhat.com
Petr Horáček has uploaded a new change for review.
Change subject: hooks: ovs: start every log with 'OVS: '
......................................................................
hooks: ovs: start every log with 'OVS: '
Change-Id: I477954f0cb18071bf80caa88e241cfabdde6bbe9
Signed-off-by: Petr Horáček <phoracek(a)redhat.com>
---
M vdsm_hooks/ovs/ovs_after_get_stats.py
M vdsm_hooks/ovs/ovs_before_network_setup.py
M vdsm_hooks/ovs/ovs_before_network_setup_ip.py
M vdsm_hooks/ovs/ovs_before_network_setup_ovs.py
M vdsm_hooks/ovs/ovs_utils.py
5 files changed, 22 insertions(+), 20 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/06/46906/1
diff --git a/vdsm_hooks/ovs/ovs_after_get_stats.py b/vdsm_hooks/ovs/ovs_after_get_stats.py
index 6209f0a..fc04417 100755
--- a/vdsm_hooks/ovs/ovs_after_get_stats.py
+++ b/vdsm_hooks/ovs/ovs_after_get_stats.py
@@ -23,7 +23,7 @@
import hooking
-from ovs_utils import is_ovs_network
+from ovs_utils import is_ovs_network, log
def ovs_networks_stats(stats):
@@ -50,8 +50,7 @@
ovs_networks_stats[vlan_name] = stats[network]
ovs_networks_stats[vlan_name]['name'] = vlan_name
- hooking.log('Updating network stats with OVS networks: %s' %
- ovs_networks_stats)
+ log('Updating network stats with OVS networks: %s' % ovs_networks_stats)
return ovs_networks_stats
diff --git a/vdsm_hooks/ovs/ovs_before_network_setup.py b/vdsm_hooks/ovs/ovs_before_network_setup.py
index 6cef711..54a941e 100755
--- a/vdsm_hooks/ovs/ovs_before_network_setup.py
+++ b/vdsm_hooks/ovs/ovs_before_network_setup.py
@@ -27,7 +27,7 @@
from hooking import execCmd
import hooking
-from ovs_utils import (is_ovs_network, is_ovs_bond, rollback, EXT_IP,
+from ovs_utils import (is_ovs_network, is_ovs_bond, rollback, log, EXT_IP,
EXT_OVS_VSCTL)
from ovs_setup_ovs import configure_ovs, prepare_ovs
from ovs_setup_ip import configure_ip
@@ -65,11 +65,11 @@
yield
except:
if in_rollback:
- hooking.log('Failed while trying to rollback:')
+ log('Failed while trying to rollback:')
else:
- hooking.log('Configuration failed. Entering rollback.')
+ log('Configuration failed. Entering rollback.')
rollback(running_config, initial_config)
- hooking.log('Rollback finished. Initial error:')
+ log('Rollback finished. Initial error:')
raise
@@ -83,14 +83,14 @@
configure_mtu(running_config)
configure_ip(nets, initial_config.networks)
- hooking.log('Saving running configuration: %s %s' %
- (running_config.networks, running_config.bonds))
+ log('Saving running configuration: %s %s' % (running_config.networks,
+ running_config.bonds))
running_config.save()
def main():
setup_nets_config = hooking.read_json()
- hooking.log('Hook started, handling: %s' % setup_nets_config)
+ log('Hook started, handling: %s' % setup_nets_config)
running_config = RunningConfig()
networks = setup_nets_config['request']['networks']
@@ -103,7 +103,7 @@
setup_nets_config['request']['bondings'] = non_ovs_bonds
setup_nets_config['request']['networks'] = non_ovs_nets
- hooking.log('Hook finished, returning non-OVS networks and bondings back '
+ log('Hook finished, returning non-OVS networks and bondings back '
'to VDSM: %s' % setup_nets_config)
hooking.write_json(setup_nets_config)
diff --git a/vdsm_hooks/ovs/ovs_before_network_setup_ip.py b/vdsm_hooks/ovs/ovs_before_network_setup_ip.py
index 90640a4..c87e6d6 100644
--- a/vdsm_hooks/ovs/ovs_before_network_setup_ip.py
+++ b/vdsm_hooks/ovs/ovs_before_network_setup_ip.py
@@ -21,9 +21,7 @@
from vdsm import ipwrapper, sysctl
-import hooking
-
-from ovs_utils import suppress, BRIDGE_NAME
+from ovs_utils import suppress, log, BRIDGE_NAME
# TODO: move required modules into vdsm/lib
sys.path.append('/usr/share/vdsm')
@@ -58,7 +56,7 @@
dhclient = DhcpClient(iface, family, default_route)
rc = dhclient.start(blockingdhcp)
if blockingdhcp and rc:
- hooking.log('failed to start dhclient%s on iface %s' % (family, iface))
+ log('failed to start dhclient%s on iface %s' % (family, iface))
def _set_ip_config(iface, ipv4, ipv6, port, blockingdhcp):
@@ -119,8 +117,8 @@
ip_config_to_set[top_dev] = (
ipv4, ipv6, port, 'blockingdhcp' in attrs)
- hooking.log('Remove IP configuration of: %s' % ip_config_to_remove)
- hooking.log('Set IP configuration: %s' % ip_config_to_set)
+ log('Remove IP configuration of: %s' % ip_config_to_remove)
+ log('Set IP configuration: %s' % ip_config_to_set)
for iface, (ipv4, ipv6) in ip_config_to_remove.iteritems():
_remove_ip_config(iface, ipv4, ipv6)
for iface, (ipv4, ipv6, blockingdhcp, port) in ip_config_to_set.items():
diff --git a/vdsm_hooks/ovs/ovs_before_network_setup_ovs.py b/vdsm_hooks/ovs/ovs_before_network_setup_ovs.py
index 3f663b6..09efe81 100644
--- a/vdsm_hooks/ovs/ovs_before_network_setup_ovs.py
+++ b/vdsm_hooks/ovs/ovs_before_network_setup_ovs.py
@@ -23,7 +23,7 @@
import hooking
-from ovs_utils import (get_bond_options, is_ovs_bond, iter_ovs_nets,
+from ovs_utils import (get_bond_options, is_ovs_bond, iter_ovs_nets, log,
iter_ovs_bonds, rget, suppress, destroy_ovs_bridge,
BRIDGE_NAME, EXT_OVS_VSCTL)
@@ -41,7 +41,7 @@
return
for bond, attr in iter_ovs_bonds(running_config.bonds):
return
- hooking.log('Removing redundant OVS bridge')
+ log('Removing redundant OVS bridge')
destroy_ovs_bridge()
@@ -89,7 +89,7 @@
if commands:
commands = [EXT_OVS_VSCTL, '--', '--may-exist', 'add-br',
BRIDGE_NAME] + commands
- hooking.log('Executing commands: %s' % ' '.join(commands))
+ log('Executing commands: %s' % ' '.join(commands))
rc, _, err = hooking.execCmd(commands)
if rc != 0:
raise Exception('Executing commands failed: %s' % '\n'.join(err))
diff --git a/vdsm_hooks/ovs/ovs_utils.py b/vdsm_hooks/ovs/ovs_utils.py
index 35cb8cb..7375d20 100644
--- a/vdsm_hooks/ovs/ovs_utils.py
+++ b/vdsm_hooks/ovs/ovs_utils.py
@@ -23,6 +23,7 @@
from libvirt import libvirtError
from hooking import execCmd
+import hooking
from vdsm.utils import CommandPath
from vdsm import supervdsm
@@ -143,3 +144,7 @@
supervdsm.getProxy().setupNetworks(
initial_config.networks, initial_config.bonds,
{'connectivityCheck': False, '_inRollback': True})
+
+
+def log(message):
+ hooking.log('OVS: %s' % message)
--
To view, visit https://gerrit.ovirt.org/46906
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I477954f0cb18071bf80caa88e241cfabdde6bbe9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phoracek(a)redhat.com>
8 years, 7 months