Change in vdsm[master]: ovs: acquire external ifaces
by automation@ovirt.org
gerrit-hooks has posted comments on this change.
Change subject: ovs: acquire external ifaces
......................................................................
Patch Set 29:
* #1195208::Update tracker: OK
* Check Bug-Url::OK
* Check Public Bug::#1195208::OK, public bug
* Check Product::#1195208::OK, Correct classification oVirt
* Check TM::SKIP, not in a monitored branch (ovirt-3.6 ovirt-4.0)
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-4.0'])
--
To view, visit https://gerrit.ovirt.org/60404
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I7a08095e03a3167d0be4f7261b9a43c9cf92c67b
Gerrit-PatchSet: 29
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phoracek(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Edward Haas <edwardh(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Petr Horáček <phoracek(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
Gerrit-HasComments: No
7 years, 10 months
Change in vdsm[master]: Fix return value names for VM.ioTune calls
by Martin Sivak
Martin Sivák has uploaded a new change for review.
Change subject: Fix return value names for VM.ioTune calls
......................................................................
Fix return value names for VM.ioTune calls
Change-Id: I4eaac318db3d76743b1ff83f47268d0fc1c2dad7
Signed-off-by: Martin Sivak <msivak(a)redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 3 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/13/60513/2
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 4dd7596..23feb77 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2778,12 +2778,12 @@
qos = self._getVmPolicy()
ioTuneList = qos.getElementsByTagName("ioTune")
if not ioTuneList or not ioTuneList[0].hasChildNodes():
- return response.success(ioTunePolicy=[])
+ return response.success(ioTunePolicyList=[])
for device in ioTuneList[0].getElementsByTagName("device"):
tunables.append(io_tune_dom_to_values(device))
- return response.success(ioTunePolicy=tunables)
+ return response.success(ioTunePolicyList=tunables)
def getIoTune(self):
resultList = []
@@ -2816,7 +2816,7 @@
else:
return response.error('updateIoTuneErr', e.message)
- return response.success(ioTune=resultList)
+ return response.success(ioTuneList=resultList)
def setIoTune(self, tunables):
for io_tune_change in tunables:
--
To view, visit https://gerrit.ovirt.org/60513
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4eaac318db3d76743b1ff83f47268d0fc1c2dad7
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Sivák <msivak(a)redhat.com>
Gerrit-Reviewer: Adam Litke <alitke(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Martin Sivák <msivak(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
7 years, 10 months
Change in vdsm[master]: vdscli test: Minor pythonic changes in _assertValidAddress
by edwardh@redhat.com
Edward Haas has uploaded a new change for review.
Change subject: vdscli test: Minor pythonic changes in _assertValidAddress
......................................................................
vdscli test: Minor pythonic changes in _assertValidAddress
Change-Id: I4b8bce3df493ab52215d586f3a20507d13ca22fa
Signed-off-by: Edward Haas <edwardh(a)redhat.com>
---
M tests/vdsClientTests.py
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/86/61386/1
diff --git a/tests/vdsClientTests.py b/tests/vdsClientTests.py
index 97a45f1..504f680 100644
--- a/tests/vdsClientTests.py
+++ b/tests/vdsClientTests.py
@@ -550,11 +550,11 @@
def _assertValidAddress(self, addr):
if addr != socket.gethostname():
- if addr.count('.'):
+ if '.' in addr:
if not _isIPv4Address(addr):
raise AssertionError('invalid IPv4 address: %s',
addr)
- elif addr.count(':'):
+ elif ':' in addr:
if not addr.startswith('[') or not addr.endswith(']'):
raise AssertionError('malformed IPv6 address: %s',
addr)
--
To view, visit https://gerrit.ovirt.org/61386
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4b8bce3df493ab52215d586f3a20507d13ca22fa
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Edward Haas <edwardh(a)redhat.com>
7 years, 10 months
Change in vdsm[master]: docs: add README about logging configuration
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: docs: add README about logging configuration
......................................................................
docs: add README about logging configuration
Most notably, document how to tune the logging
settings of Vdsm at runtime, using Vdsclient
Change-Id: I2653c2a68fcf42b1e085ae1ee703fb119a0cf1fc
Backport-To: 4.0
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
A README.logging
1 file changed, 48 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/33/60533/1
diff --git a/README.logging b/README.logging
new file mode 100644
index 0000000..c769585
--- /dev/null
+++ b/README.logging
@@ -0,0 +1,48 @@
+Logging in Vdsm
+===============
+
+Basic configuration
+-------------------
+
+Vdsm uses the python standard module[1] for logging.
+It can be configured using /etc/vdsm/logger.conf;
+the supervdsm logging is configured separately, using
+/etc/vdsm/svdsm.logger.conf
+
+Tuning the logging at runtime
+-----------------------------
+
+Vdsm logging could be configured extensively[2]
+using the configuration files, but this requires a restart of the daemon.
+
+You can also configuring the logging to some extent at runtime, without
+any restart, using vdsClient as explained below.
+Please note that any change you make using vdsClient is not permanent, and
+will be lost once Vdsm is restarted.
+
+Using vdsClient, you can tune the log level of any logger Vdsm uses.
+The basic syntax is:
+
+# vdsClient [options] setLogLevel LEVEL [logger]
+
+`LEVEL` is one of DEBUG, INFO, WARNING, ERROR, CRITICAL
+`logger` is any logger Vdsm uses. Please check the configuration file
+to learn about some predefined loggers.
+
+If no logger is given, the root logger default level is changed.
+
+Please note that the logging configuration of Vdsm is quite complex, so
+few trivial settings may yield surprising results.
+
+Examples of runtime tuning of logging
+-------------------------------------
+
+WRITEME
+
+Notes
+-----
+
+[1] https://docs.python.org/2/library/logging.html
+[2] https://docs.python.org/2/library/logging.config.html#logging-config-file...
+
+
--
To view, visit https://gerrit.ovirt.org/60533
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2653c2a68fcf42b1e085ae1ee703fb119a0cf1fc
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
7 years, 10 months
Change in vdsm[master]: periodic: always re-schedule operations
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: periodic: always re-schedule operations
......................................................................
periodic: always re-schedule operations
Should executor.dispatch() raise in Operation, perhaps
because of TooManyTasks, an Operation should always
try to reschedule itself.
Change-Id: Icb5836ca768c88316896e233d756a986e3111d8e
Bug-Url: https://bugzilla.redhat.com/1361028
Backport-To: 4.0
Backport-To: 3.6
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M lib/vdsm/virt/periodic.py
M tests/periodicTests.py
2 files changed, 37 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/85/61685/1
diff --git a/lib/vdsm/virt/periodic.py b/lib/vdsm/virt/periodic.py
index 6af0a30..f69504d 100644
--- a/lib/vdsm/virt/periodic.py
+++ b/lib/vdsm/virt/periodic.py
@@ -204,8 +204,12 @@
Send `func' to Executor to be run as soon as possible.
"""
self._call = None
- self._executor.dispatch(self, self._timeout)
- self._step()
+ try:
+ self._executor.dispatch(self, self._timeout)
+ except executor.TooManyTasks:
+ self._log.debug('executor queue full, skipped cycle')
+ finally:
+ self._step()
def __repr__(self):
return '<Operation action=%s at 0x%x>' % (
diff --git a/tests/periodicTests.py b/tests/periodicTests.py
index 0a3d369..19f5493 100644
--- a/tests/periodicTests.py
+++ b/tests/periodicTests.py
@@ -114,6 +114,27 @@
self.assertTrue(invoked.is_set())
self.assertTrue(TIMES <= invocations[0] <= TIMES+1)
+ def test_repeating_if_raises(self):
+ PERIOD = 0.1
+ TIMES = 5
+
+ def _work():
+ pass
+
+ exc = _FakeExecutor(fail=True, max_attempts=TIMES)
+ op = periodic.Operation(_work, period=PERIOD,
+ scheduler=self.sched,
+ executor=exc)
+ op.start()
+ completed = exc.done.wait(PERIOD * TIMES + PERIOD)
+ # depending on timing, _work may be triggered one more time.
+ # nothing prevents this, although is unlikely.
+ # we don't care of this case
+ op.stop()
+ self.assertTrue(completed)
+ self.assertTrue(TIMES <= exc.attempts <= TIMES+1)
+ self.assertTrue(False)
+
def test_stop(self):
PERIOD = 0.1
@@ -314,10 +335,19 @@
class _FakeExecutor(object):
- def __init__(self, fail=False):
+ def __init__(self, fail=False, max_attempts=None):
self._fail = fail
+ self._max_attempts = max_attempts
+ self.attempts = 0
+ self.done = threading.Event()
def dispatch(self, func, timeout):
+ if (self._max_attempts is not None and
+ self.attempts == self._max_attempts):
+ self.done.set()
+
+ self.attempts += 1
+
if self._fail:
raise executor.TooManyTasks()
else:
--
To view, visit https://gerrit.ovirt.org/61685
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icb5836ca768c88316896e233d756a986e3111d8e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
7 years, 10 months
Change in vdsm[master]: vm: periodic: fix stats age reporting
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: vm: periodic: fix stats age reporting
......................................................................
vm: periodic: fix stats age reporting
The Vm class reports the monitor responsiveness in two ways:
1. if a libvirt operation reports a timeout (a standard libvirt
exception)
2. if one sampling operation hangs for too long
In the second case, given the transient nature of the detected
failure, the responsiveness is reported, but not stored as Vm
field. This is noteworthy, but totally expected and legitimate.
The sampling code stores the bulk samples only for a limited
number of cycles, and drops the old values.
The sampling code also used to calculate the sample age
based on the stored values.
But if a VM hangs for too long, all its samples are eventually
evicted from the samples cache, so it stats age becomes None,
which is misinterpred as responsive VM.
We should keep reporting None when we don't have enough meaningful
data, but we should also fix the sampling age reporting; we do
so using earlier in the flow the vm last timestamp, which is needed
and guaranteed to be present for the sampling code to work at all.
Change-Id: I3e61626625a2e0517d55dc61e361f3f5eb690c00
Backport-To: 4.0
Backport-To: 3.6
Bug-Url: https://bugzilla.redhat.com/1357798
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M lib/vdsm/virt/sampling.py
M tests/samplingTests.py
2 files changed, 26 insertions(+), 8 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/10/61310/1
diff --git a/lib/vdsm/virt/sampling.py b/lib/vdsm/virt/sampling.py
index 4cfd3b1..4c34e13 100644
--- a/lib/vdsm/virt/sampling.py
+++ b/lib/vdsm/virt/sampling.py
@@ -411,18 +411,23 @@
Return the available StatSample for the given VM.
"""
with self._lock:
- first_batch, last_batch, interval = self._samples.stats()
-
- if first_batch is None:
+ last_ts = self._vm_last_timestamp.get(vmid)
+ if last_ts is None:
+ # this VM was never seen (yet)
return EMPTY_SAMPLE
+ first_batch, last_batch, interval = self._samples.stats()
+ if first_batch is None:
+ # not yet sampled
+ return EMPTY_SAMPLE
+
+ stats_age = self._clock() - last_ts
first_sample = first_batch.get(vmid)
last_sample = last_batch.get(vmid)
if first_sample is None or last_sample is None:
- return EMPTY_SAMPLE
-
- stats_age = self._clock() - self._vm_last_timestamp[vmid]
+ # recovering, or just gone disrupted
+ return StatsSample(None, None, None, stats_age)
return StatsSample(first_sample, last_sample,
interval, stats_age)
diff --git a/tests/samplingTests.py b/tests/samplingTests.py
index bba216f..a2ecadf 100644
--- a/tests/samplingTests.py
+++ b/tests/samplingTests.py
@@ -327,10 +327,23 @@
# here we lost sampling for 'b'
({'a': 'baz', 'b': 'baz'}, 3),
))
+ self.fake_monotonic_time.freeze(value=4)
self.assertEqual(self.cache.get('a'),
- ('bar', 'baz', 1, FakeClock.STEP))
+ ('bar', 'baz', 1, 1))
self.assertEqual(self.cache.get('b'),
- sampling.EMPTY_SAMPLE)
+ (None, None, None, 1))
+
+ def test_missing_initially(self):
+ self._feed_cache((
+ ({'a': 'foo'}, 1),
+ ({'a': 'bar', 'b': 'baz'}, 2)
+ ))
+ self.fake_monotonic_time.freeze(value=3)
+ res = self.cache.get('b')
+ self.assertEqual(
+ res,
+ (None, None, None, 1),
+ )
def _feed_cache(self, samples):
for sample in samples:
--
To view, visit https://gerrit.ovirt.org/61310
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e61626625a2e0517d55dc61e361f3f5eb690c00
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
7 years, 10 months
Change in vdsm[master]: virt: sampling: add empty() method to StatsSample
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: virt: sampling: add empty() method to StatsSample
......................................................................
virt: sampling: add empty() method to StatsSample
kill the EMPTY_SAMPLE constant.
we always need to fill the 'stats_age' field with meaningful
value, None is not good.
Replace it with a proper method.
Change-Id: I7bc3712d36c46ade9a779411028817c197ec34b3
Backport-To: 4.0
Backport-To: 3.6
Bug-Url: https://bugzilla.redhat.com/1357798
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M lib/vdsm/virt/sampling.py
M tests/samplingTests.py
2 files changed, 12 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/20/61420/1
diff --git a/lib/vdsm/virt/sampling.py b/lib/vdsm/virt/sampling.py
index 4cfd3b1..9cb3f2f 100644
--- a/lib/vdsm/virt/sampling.py
+++ b/lib/vdsm/virt/sampling.py
@@ -346,12 +346,18 @@
return sample
-StatsSample = namedtuple('StatsSample',
- ['first_value', 'last_value',
- 'interval', 'stats_age'])
+_StatsSample = namedtuple('StatsSample',
+ ['first_value', 'last_value',
+ 'interval', 'stats_age'])
-EMPTY_SAMPLE = StatsSample(None, None, None, None)
+class StatsSample(_StatsSample):
+ def empty(self):
+ return (
+ self.first_value is None and
+ self.last_value is None and
+ self.interval is None
+ )
class StatsCache(object):
diff --git a/tests/samplingTests.py b/tests/samplingTests.py
index ee8be7f..2dc9bd9 100644
--- a/tests/samplingTests.py
+++ b/tests/samplingTests.py
@@ -256,14 +256,14 @@
def test_empty(self):
res = self.cache.get('x') # vmid not relevant
- self.assertEqual(res, sampling.EMPTY_SAMPLE)
+ self.assertTrue(res.empty())
def test_not_enough_samples(self):
self._feed_cache((
({'a': 42}, 1),
))
res = self.cache.get('a')
- self.assertEqual(res, sampling.EMPTY_SAMPLE)
+ self.assertTrue(res.empty())
def test_get(self):
self._feed_cache((
--
To view, visit https://gerrit.ovirt.org/61420
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7bc3712d36c46ade9a779411028817c197ec34b3
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
7 years, 10 months
Change in vdsm[master]: lib: set system name for threads
by automation@ovirt.org
gerrit-hooks has posted comments on this change.
Change subject: lib: set system name for threads
......................................................................
Patch Set 3:
* #1141422::Update tracker: OK
* Check Bug-Url::OK
* Check Public Bug::#1141422::OK, public bug
* Check Product::#1141422::OK, Correct classification oVirt
* Check TM::SKIP, not in a monitored branch (ovirt-3.6 ovirt-4.0)
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-4.0'])
--
To view, visit https://gerrit.ovirt.org/55074
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I165f5ce9c86dad407d956a3b07e247431f2eed41
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
Gerrit-HasComments: No
7 years, 10 months
Change in vdsm[master]: utils: rename random_iface_name to random_name
by phoracek@redhat.com
Petr Horáček has uploaded a new change for review.
Change subject: utils: rename random_iface_name to random_name
......................................................................
utils: rename random_iface_name to random_name
We should not rescrict this function just for interface naming.
Change-Id: Ifb67c4a051b075cfdc83ae9ff0f607eb7a90836c
Bug-Url: https://bugzilla.redhat.com/1195208
Signed-off-by: Petr Horáček <phoracek(a)redhat.com>
---
M lib/vdsm/network/ovs/switch.py
M lib/vdsm/tool/dump_bonding_opts.py
M lib/vdsm/utils.py
M tests/network/netinfo_test.py
M tests/network/nettestlib.py
5 files changed, 15 insertions(+), 14 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/48/61648/1
diff --git a/lib/vdsm/network/ovs/switch.py b/lib/vdsm/network/ovs/switch.py
index 85fcb36..2cba323 100644
--- a/lib/vdsm/network/ovs/switch.py
+++ b/lib/vdsm/network/ovs/switch.py
@@ -25,7 +25,7 @@
from vdsm.network import errors as ne
from vdsm.network.netinfo import bonding
from vdsm.network.netinfo.nics import nics
-from vdsm.utils import random_iface_name
+from vdsm.utils import random_name
from . import driver
from . import info
@@ -228,7 +228,7 @@
@staticmethod
def _create_br_name():
- return random_iface_name(prefix=BRIDGE_PREFIX)
+ return random_name(prefix=BRIDGE_PREFIX)
def _create_sb_nic(self, bridge, nic):
self._transaction.add(self._ovsdb.add_port(bridge, nic))
diff --git a/lib/vdsm/tool/dump_bonding_opts.py b/lib/vdsm/tool/dump_bonding_opts.py
index e80d721..3f80f6a 100644
--- a/lib/vdsm/tool/dump_bonding_opts.py
+++ b/lib/vdsm/tool/dump_bonding_opts.py
@@ -26,7 +26,7 @@
from vdsm.network.netinfo.bonding import (
BONDING_MASTERS, BONDING_OPT, BONDING_DEFAULTS, BONDING_NAME2NUMERIC_PATH,
bond_opts_name2numeric_filtered, bondOpts)
-from ..utils import random_iface_name
+from ..utils import random_name
from . import expose, ExtraArgsError
_MAX_BONDING_MODES = 6
@@ -60,7 +60,7 @@
Return default options per mode, in a dictionary of dictionaries. All keys
are strings.
"""
- bond_name = random_iface_name()
+ bond_name = random_name()
with _bond_device(bond_name):
default_mode = bondOpts(bond_name, keys=['mode'])['mode']
@@ -83,7 +83,7 @@
Return a map of options values per mode, in a dictionary of dictionaries.
All keys are strings.
"""
- bond_name = random_iface_name()
+ bond_name = random_name()
opts = {}
for mode in range(_MAX_BONDING_MODES + 1):
mode = str(mode)
diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index 0beac90..b614350 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -828,10 +828,11 @@
return os.times()[4]
-def random_iface_name(prefix='', max_length=15):
+def random_name(prefix='', max_length=15):
"""
- Create a network device name with the supplied prefix and a pseudo-random
- suffix, e.g. dummy_ilXaYiSn7. The name is bound to IFNAMSIZ of 16-1 chars.
+ Create a random name with the supplied prefix and a pseudo-random suffix,
+ e.g. dummy_ilXaYiSn7. Network devices' names are bound to IFNAMSIZ of 16-1
+ chars.
"""
suffix_len = max_length - len(prefix)
suffix = ''.join(random.choice(string.ascii_letters + string.digits)
diff --git a/tests/network/netinfo_test.py b/tests/network/netinfo_test.py
index 06dfb56..fcedce0 100644
--- a/tests/network/netinfo_test.py
+++ b/tests/network/netinfo_test.py
@@ -30,7 +30,7 @@
from vdsm.network import netinfo
from vdsm.network.netinfo import addresses, bonding, dns, misc, nics, routes
from vdsm.network.netinfo.cache import get
-from vdsm.utils import random_iface_name
+from vdsm.utils import random_name
from vdsm import sysctl
from .ipwrapper_test import _fakeTypeDetection
@@ -245,7 +245,7 @@
@RequireBondingMod
def testGetBondingOptions(self):
INTERVAL = '12345'
- bondName = random_iface_name()
+ bondName = random_name()
with open(bonding.BONDING_MASTERS, 'w') as bonds:
bonds.write('+' + bondName)
diff --git a/tests/network/nettestlib.py b/tests/network/nettestlib.py
index bcaaa05..58b5e17 100644
--- a/tests/network/nettestlib.py
+++ b/tests/network/nettestlib.py
@@ -38,7 +38,7 @@
netns_exec)
from vdsm.network.netlink import monitor
from vdsm.commands import execCmd
-from vdsm.utils import CommandPath, random_iface_name
+from vdsm.utils import CommandPath, random_name
from . import dhcp
from . import firewall
@@ -65,7 +65,7 @@
class Interface(object):
def __init__(self, prefix='vdsm-', max_length=11):
- self.devName = random_iface_name(prefix, max_length)
+ self.devName = random_name(prefix, max_length)
def up(self):
linkSet(self.devName, ['up'])
@@ -337,8 +337,8 @@
Both sides of the pair have a pseudo-random suffix (e.g. veth_m6Lz7uMK9c).
"""
- left_side = random_iface_name(prefix, max_length)
- right_side = random_iface_name(prefix, max_length)
+ left_side = random_name(prefix, max_length)
+ right_side = random_name(prefix, max_length)
try:
linkAdd(left_side, linkType='veth',
args=('peer', 'name', right_side))
--
To view, visit https://gerrit.ovirt.org/61648
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifb67c4a051b075cfdc83ae9ff0f607eb7a90836c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phoracek(a)redhat.com>
7 years, 10 months
Change in vdsm[master]: ifcfg: simplify _update_from_ifcfg
by osvoboda@redhat.com
Ondřej Svoboda has uploaded a new change for review.
Change subject: ifcfg: simplify _update_from_ifcfg
......................................................................
ifcfg: simplify _update_from_ifcfg
Change-Id: If2dc4d17cfacd927b9fa0d8940f5a546db9c05b6
Signed-off-by: Ondřej Svoboda <osvoboda(a)redhat.com>
---
M lib/vdsm/network/configurators/ifcfg.py
1 file changed, 27 insertions(+), 32 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/72/61472/1
diff --git a/lib/vdsm/network/configurators/ifcfg.py b/lib/vdsm/network/configurators/ifcfg.py
index 3487103..95e0927 100644
--- a/lib/vdsm/network/configurators/ifcfg.py
+++ b/lib/vdsm/network/configurators/ifcfg.py
@@ -597,8 +597,9 @@
conf += 'BRIDGE=%s\n' % pipes.quote(bond.bridge.name)
conf += 'ONBOOT=yes\n'
- bond_updated_from_ifcfg = self._update_from_ifcfg(bond)
- self._createConfFile(conf, bond_updated_from_ifcfg)
+ if ifaceUsed(bond.name):
+ bond = self._update_from_ifcfg(copy.deepcopy(bond))
+ self._createConfFile(conf, bond)
# create the bonding device to avoid initscripts noise
with open(netinfo_bonding.BONDING_MASTERS) as info:
@@ -623,39 +624,33 @@
if ethtool_opts:
conf += 'ETHTOOL_OPTS=%s\n' % pipes.quote(ethtool_opts)
- nic_updated_from_ifcfg = self._update_from_ifcfg(nic)
- self._createConfFile(conf, nic_updated_from_ifcfg)
+ if ifaceUsed(nic.name):
+ nic = self._update_from_ifcfg(copy.deepcopy(nic))
+ self._createConfFile(conf, nic)
@staticmethod
def _update_from_ifcfg(iface):
- if ifaceUsed(iface.name):
- ipv4 = copy.deepcopy(iface.ipv4)
- ipv6 = copy.deepcopy(iface.ipv6)
- mtu = iface.mtu
- confParams = misc.getIfaceCfg(iface.name)
- if not ipv4.address and ipv4.bootproto != 'dhcp':
- ipv4.address = confParams.get('IPADDR')
- ipv4.netmask = confParams.get('NETMASK')
- ipv4.gateway = confParams.get('GATEWAY')
- if not ipv4.bootproto:
- ipv4.bootproto = confParams.get('BOOTPROTO')
- if ipv4.defaultRoute is None and confParams.get('DEFROUTE'):
- ipv4.defaultRoute = _from_ifcfg_bool(confParams['DEFROUTE'])
- if confParams.get('IPV6INIT') == 'yes':
- ipv6.address = confParams.get('IPV6ADDR')
- ipv6.gateway = confParams.get('IPV6_DEFAULTGW')
- ipv6.ipv6autoconf = confParams.get('IPV6_AUTOCONF') == 'yes'
- ipv6.dhcpv6 = confParams.get('DHCPV6C') == 'yes'
- if not iface.mtu:
- mtu = confParams.get('MTU')
- if mtu:
- mtu = int(mtu)
- iface_updated_from_ifcfg = copy.deepcopy(iface)
- iface_updated_from_ifcfg.ipv4 = ipv4
- iface_updated_from_ifcfg.ipv6 = ipv6
- return iface_updated_from_ifcfg
- else:
- return iface
+ confParams = misc.getIfaceCfg(iface.name)
+ ipv4 = iface.ipv4
+ ipv6 = iface.ipv6
+ if not ipv4.address and ipv4.bootproto != 'dhcp':
+ ipv4.address = confParams.get('IPADDR')
+ ipv4.netmask = confParams.get('NETMASK')
+ ipv4.gateway = confParams.get('GATEWAY')
+ if not ipv4.bootproto:
+ ipv4.bootproto = confParams.get('BOOTPROTO')
+ if ipv4.defaultRoute is None and confParams.get('DEFROUTE'):
+ ipv4.defaultRoute = _from_ifcfg_bool(confParams['DEFROUTE'])
+ if confParams.get('IPV6INIT') == 'yes':
+ ipv6.address = confParams.get('IPV6ADDR')
+ ipv6.gateway = confParams.get('IPV6_DEFAULTGW')
+ ipv6.ipv6autoconf = confParams.get('IPV6_AUTOCONF') == 'yes'
+ ipv6.dhcpv6 = confParams.get('DHCPV6C') == 'yes'
+ if not iface.mtu:
+ mtu = confParams.get('MTU')
+ if mtu:
+ iface.mtu = int(mtu)
+ return iface
def removeNic(self, nic):
cf = NET_CONF_PREF + nic
--
To view, visit https://gerrit.ovirt.org/61472
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If2dc4d17cfacd927b9fa0d8940f5a546db9c05b6
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda <osvoboda(a)redhat.com>
7 years, 10 months