Change in vdsm[master]: procwatch: Rename CommandStream to ProcessWatcher
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: procwatch: Rename CommandStream to ProcessWatcher
......................................................................
procwatch: Rename CommandStream to ProcessWatcher
This class is about watching child process standard streams, and
invoking callbacks when data is read from one of the streams.
Change-Id: I13981d80786bda2f185851febfd40754a38282a8
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M lib/vdsm/procwatch.py
M lib/vdsm/qemuimg.py
M tests/procwatch_test.py
3 files changed, 18 insertions(+), 18 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/73/65073/1
diff --git a/lib/vdsm/procwatch.py b/lib/vdsm/procwatch.py
index 1ae168a..fd4b543 100644
--- a/lib/vdsm/procwatch.py
+++ b/lib/vdsm/procwatch.py
@@ -27,7 +27,7 @@
from vdsm import utils
-class CommandStream(object):
+class ProcessWatcher(object):
def __init__(self, command, stdoutcb, stderrcb):
self._command = command
diff --git a/lib/vdsm/qemuimg.py b/lib/vdsm/qemuimg.py
index 8d60e4c..0527a15 100644
--- a/lib/vdsm/qemuimg.py
+++ b/lib/vdsm/qemuimg.py
@@ -203,7 +203,7 @@
with_ioclass=utils.IOCLASS.IDLE)
_log.debug(cmdutils.command_log_line(cmd, cwd=cwd))
self._command = CPopen(cmd, cwd=cwd, deathSignal=signal.SIGKILL)
- self._stream = procwatch.CommandStream(
+ self._watcher = procwatch.ProcessWatcher(
self._command, self._recvstdout, self._recvstderr)
def _recvstderr(self, buffer):
@@ -247,9 +247,9 @@
return self._command.poll() is not None
def poll(self, timeout=None):
- self._stream.receive(timeout=timeout)
+ self._watcher.receive(timeout=timeout)
- if not self._stream.closed:
+ if not self._watcher.closed:
return
self._command.wait()
diff --git a/tests/procwatch_test.py b/tests/procwatch_test.py
index e6b9d7f..8ed9d9f 100644
--- a/tests/procwatch_test.py
+++ b/tests/procwatch_test.py
@@ -30,7 +30,7 @@
@expandPermutations
-class CommandStreamTests(VdsmTestCase):
+class ProcessWatcherTests(VdsmTestCase):
def assertUnexpectedCall(self, data):
raise AssertionError("Unexpected data: %r" % data)
@@ -54,13 +54,13 @@
cmd[-1] = cmd[-1] % text
c = self._startCommand(cmd)
- p = procwatch.CommandStream(
+ watcher = procwatch.ProcessWatcher(
c,
recv_data if recv_out else self.assertUnexpectedCall,
recv_data if recv_err else self.assertUnexpectedCall)
- while not p.closed:
- p.receive()
+ while not watcher.closed:
+ watcher.receive()
retcode = c.wait()
@@ -81,7 +81,7 @@
operator.iadd(received, buffer)
c = self._startCommand(cmd)
- p = procwatch.CommandStream(
+ watcher = procwatch.ProcessWatcher(
c,
recv_data if recv_out else self.assertUnexpectedCall,
recv_data if recv_err else self.assertUnexpectedCall)
@@ -90,8 +90,8 @@
c.stdin.flush()
c.stdin.close()
- while not p.closed:
- p.receive()
+ while not watcher.closed:
+ watcher.receive()
retcode = c.wait()
@@ -100,13 +100,13 @@
def test_timeout(self):
c = self._startCommand(["sleep", "5"])
- p = procwatch.CommandStream(c, self.assertUnexpectedCall,
- self.assertUnexpectedCall)
+ watcher = procwatch.ProcessWatcher(c, self.assertUnexpectedCall,
+ self.assertUnexpectedCall)
with self.assertElapsed(2):
- p.receive(2)
+ watcher.receive(2)
- self.assertEqual(p.closed, False)
+ self.assertEqual(watcher.closed, False)
c.terminate()
@@ -118,14 +118,14 @@
))
def test_signals(self, method, expected_retcode):
c = self._startCommand(["sleep", "2"])
- p = procwatch.CommandStream(c, self.assertUnexpectedCall,
- self.assertUnexpectedCall)
+ watcher = procwatch.ProcessWatcher(c, self.assertUnexpectedCall,
+ self.assertUnexpectedCall)
getattr(c, method)()
try:
with self.assertElapsed(0):
- p.receive(2)
+ watcher.receive(2)
finally:
retcode = c.wait()
--
To view, visit https://gerrit.ovirt.org/65073
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I13981d80786bda2f185851febfd40754a38282a8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
7 years, 8 months
Change in vdsm[master]: procwatch: There is no need for _private helpers
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: procwatch: There is no need for _private helpers
......................................................................
procwatch: There is no need for _private helpers
In the context of tests classes, there is not need for private helpers.
The only caller is the test framework, and it calls only the test
functions.
Change-Id: I54c7acf9c599716527ae3b4919fc19bdbe7de5c1
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M tests/procwatch_test.py
1 file changed, 5 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/74/65074/1
diff --git a/tests/procwatch_test.py b/tests/procwatch_test.py
index 8ed9d9f..1c6b365 100644
--- a/tests/procwatch_test.py
+++ b/tests/procwatch_test.py
@@ -35,7 +35,7 @@
def assertUnexpectedCall(self, data):
raise AssertionError("Unexpected data: %r" % data)
- def _startCommand(self, command):
+ def startCommand(self, command):
return compat.CPopen(command)
@permutations([
@@ -53,7 +53,7 @@
cmd[-1] = cmd[-1] % text
- c = self._startCommand(cmd)
+ c = self.startCommand(cmd)
watcher = procwatch.ProcessWatcher(
c,
recv_data if recv_out else self.assertUnexpectedCall,
@@ -80,7 +80,7 @@
# defined in the parent function.
operator.iadd(received, buffer)
- c = self._startCommand(cmd)
+ c = self.startCommand(cmd)
watcher = procwatch.ProcessWatcher(
c,
recv_data if recv_out else self.assertUnexpectedCall,
@@ -99,7 +99,7 @@
self.assertEqual(text, str(received))
def test_timeout(self):
- c = self._startCommand(["sleep", "5"])
+ c = self.startCommand(["sleep", "5"])
watcher = procwatch.ProcessWatcher(c, self.assertUnexpectedCall,
self.assertUnexpectedCall)
@@ -117,7 +117,7 @@
('terminate', -signal.SIGTERM),
))
def test_signals(self, method, expected_retcode):
- c = self._startCommand(["sleep", "2"])
+ c = self.startCommand(["sleep", "2"])
watcher = procwatch.ProcessWatcher(c, self.assertUnexpectedCall,
self.assertUnexpectedCall)
--
To view, visit https://gerrit.ovirt.org/65074
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I54c7acf9c599716527ae3b4919fc19bdbe7de5c1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
7 years, 8 months
Change in vdsm[master]: py3: make network/conf_test pass
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: py3: make network/conf_test pass
......................................................................
py3: make network/conf_test pass
re.sub should not mix strings and byte arrays.
Change-Id: Idcab2d6f1f88b04d849156915a111189c4cc8589
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M tests/Makefile.am
M tests/network/conf_test.py
2 files changed, 2 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/28/64928/1
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 132be62..fb3d7c3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -191,7 +191,6 @@
momTests.py \
monkeypatchTests.py \
mountTests.py \
- network/conf_test.py \
network/hook_ovs_test.py \
network/iproute2_test.py \
network/ipwrapper_test.py \
diff --git a/tests/network/conf_test.py b/tests/network/conf_test.py
index d94b5e6..c230a3c 100644
--- a/tests/network/conf_test.py
+++ b/tests/network/conf_test.py
@@ -73,8 +73,8 @@
aXml = ET.tostring(ET.fromstring(a))
bXml = ET.tostring(ET.fromstring(b))
- aXmlNrml = re.sub('>\s*\n\s*<', '><', aXml).strip()
- bXmlNrml = re.sub('>\s*\n\s*<', '><', bXml).strip()
+ aXmlNrml = re.sub(b'>\s*\n\s*<', b'><', aXml).strip()
+ bXmlNrml = re.sub(b'>\s*\n\s*<', b'><', bXml).strip()
self.assertEqual(aXmlNrml, bXmlNrml, msg)
--
To view, visit https://gerrit.ovirt.org/64928
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idcab2d6f1f88b04d849156915a111189c4cc8589
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
7 years, 8 months
Change in vdsm[master]: net libvirt: make network/libvirt.py suitable for OVS
by phoracek@redhat.com
Petr Horáček has uploaded a new change for review.
Change subject: net libvirt: make network/libvirt.py suitable for OVS
......................................................................
net libvirt: make network/libvirt.py suitable for OVS
Make network/libvirt.py suitable for OVS (add support for vlan and
virtualport).
Change-Id: I6de49e456d8c49f0309690a7fc2bee995f9846bb
Signed-off-by: Petr Horáček <phoracek(a)redhat.com>
---
M lib/vdsm/network/configurators/ifcfg.py
M lib/vdsm/network/configurators/iproute2.py
M lib/vdsm/network/configurators/pyroute_two.py
M lib/vdsm/network/legacy_switch.py
M lib/vdsm/network/libvirt.py
M lib/vdsm/network/netinfo/cache.py
M lib/vdsm/network/netswitch.py
M tests/network/libvirt_test.py
M vdsm_hooks/ovs/ovs_before_network_setup_libvirt.py
9 files changed, 141 insertions(+), 31 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/65/65065/4
diff --git a/lib/vdsm/network/configurators/ifcfg.py b/lib/vdsm/network/configurators/ifcfg.py
index aac39d1..b9d093f 100644
--- a/lib/vdsm/network/configurators/ifcfg.py
+++ b/lib/vdsm/network/configurators/ifcfg.py
@@ -370,7 +370,9 @@
def createLibvirtNetwork(self, network, bridged=True, iface=None,
skipBackup=False):
- netXml = libvirt.createNetworkDef(network, bridged, iface)
+ netXml = libvirt.createNetworkDef(network,
+ bridge=network if bridged else None,
+ iface=iface if not bridged else None)
if not skipBackup:
self._networkBackup(network)
libvirt.createNetwork(netXml)
diff --git a/lib/vdsm/network/configurators/iproute2.py b/lib/vdsm/network/configurators/iproute2.py
index 4a96966..317dc5a 100644
--- a/lib/vdsm/network/configurators/iproute2.py
+++ b/lib/vdsm/network/configurators/iproute2.py
@@ -333,7 +333,9 @@
f.write(value)
def createLibvirtNetwork(self, network, bridged=True, iface=None):
- netXml = libvirt.createNetworkDef(network, bridged, iface)
+ netXml = libvirt.createNetworkDef(network,
+ bridge=network if bridged else None,
+ iface=iface if not bridged else None)
libvirt.createNetwork(netXml)
def removeLibvirtNetwork(self, network):
diff --git a/lib/vdsm/network/configurators/pyroute_two.py b/lib/vdsm/network/configurators/pyroute_two.py
index 8aece53..ff0b95f 100644
--- a/lib/vdsm/network/configurators/pyroute_two.py
+++ b/lib/vdsm/network/configurators/pyroute_two.py
@@ -164,7 +164,9 @@
f.write(value)
def createLibvirtNetwork(self, network, bridged=True, iface=None):
- netXml = libvirt.createNetworkDef(network, bridged, iface)
+ netXml = libvirt.createNetworkDef(network,
+ bridge=network if bridged else None,
+ iface=iface if not bridged else None)
libvirt.createNetwork(netXml)
def removeLibvirtNetwork(self, network):
diff --git a/lib/vdsm/network/legacy_switch.py b/lib/vdsm/network/legacy_switch.py
index 139ddfc..24d13cb 100644
--- a/lib/vdsm/network/legacy_switch.py
+++ b/lib/vdsm/network/legacy_switch.py
@@ -398,6 +398,7 @@
"""
_netinfo = CachingNetInfo()
_netinfo.networks[network] = netAttr
+ _netinfo.networks[network]['bridged'] = netAttr['bridge'] is not None
_netinfo.networks[network]['dhcpv4'] = False
if _netinfo.networks[network]['bridged']:
diff --git a/lib/vdsm/network/libvirt.py b/lib/vdsm/network/libvirt.py
index 12271d7..e80ba54 100644
--- a/lib/vdsm/network/libvirt.py
+++ b/lib/vdsm/network/libvirt.py
@@ -42,7 +42,8 @@
raise
-def createNetworkDef(network, bridged=True, iface=None):
+def createNetworkDef(network, bridge=None, vlan=None, iface=None,
+ virtualport=None):
"""
Creates Network Xml e.g.:
<network>
@@ -58,6 +59,9 @@
or interface subelement.
"""
+ if bridge and iface:
+ raise AttributeError('Cannot set both bridge and iface at once')
+
netName = LIBVIRT_NET_PREFIX + network
def EtreeElement(tagName, text=None, **attrs):
@@ -70,16 +74,25 @@
return elem
root = etree.Element('network')
- nameElem = EtreeElement('name', netName)
+
+ root.append(EtreeElement('name', netName))
+
forwardElem = EtreeElement(
- 'forward', mode='bridge' if bridged else 'passthrough'
- )
- root.append(nameElem)
+ 'forward', mode='bridge' if bridge else 'passthrough')
root.append(forwardElem)
- if bridged:
- root.append(EtreeElement('bridge', name=network))
- else:
+ if iface:
forwardElem.append(EtreeElement('interface', dev=iface))
+ elif bridge:
+ root.append(EtreeElement('bridge', name=bridge))
+
+ if vlan is not None:
+ vlanElem = EtreeElement('vlan')
+ root.append(vlanElem)
+ vlanElem.append(EtreeElement('tag', id=vlan))
+
+ if virtualport:
+ root.append(EtreeElement('virtualport', type=virtualport))
+
return etree.tostring(root)
@@ -107,8 +120,17 @@
:returns: dict of networkname={properties}
:rtype: dict of dict
- { 'ovirtmgmt': { 'bridge': 'ovirtmgmt', 'bridged': True}
- 'red': { 'iface': 'red', 'bridged': False}}
+ for legacy:
+ {'ovirtmgmt': {
+ 'bridge': 'ovirtmgmt', 'vlan': None, 'iface': None,
+ 'virtualport': None}
+ 'red': {
+ 'bridge': None, 'vlan': None, 'iface': 'red',
+ 'virtualport': None}}
+ for ovs:
+ {'ovirtmgmt': {
+ 'bridge': 'vdsmbr_xxx', 'vlan': 10, 'iface': None,
+ 'virtualport': 'openvswitch'}}
"""
nets = {}
conn = libvirtconnection.get()
@@ -116,13 +138,27 @@
for net, netname in allNets:
if netname.startswith(LIBVIRT_NET_PREFIX):
netname = netname[len(LIBVIRT_NET_PREFIX):]
- nets[netname] = {}
xml = etree.fromstring(net.XMLDesc(0))
- interface = xml.find('.//interface')
- if interface is not None:
- nets[netname]['iface'] = interface.get('dev')
- nets[netname]['bridged'] = False
- else:
- nets[netname]['bridge'] = xml.find('.//bridge').get('name')
- nets[netname]['bridged'] = True
+
+ _bridge = xml.find('.//bridge')
+ bridge = _bridge.get('name') if _bridge is not None else None
+
+ _vlan = xml.find('.//vlan')
+ _tag = _vlan.find('.//tag') if _vlan is not None else None
+ vlan = _tag.get('id') if _tag is not None else None
+ canonicalized_vlan = int(vlan) if vlan is not None else vlan
+
+ _iface = xml.find('.//interface')
+ iface = _iface.get('dev') if _iface is not None else None
+
+ _virtualport = xml.find('.//virtualport')
+ virtualport = (_virtualport.get('type') if _virtualport is not None
+ else None)
+
+ nets[netname] = {
+ 'bridge': bridge,
+ 'vlan': canonicalized_vlan,
+ 'iface': iface,
+ 'virtualport': virtualport
+ }
return nets
diff --git a/lib/vdsm/network/netinfo/cache.py b/lib/vdsm/network/netinfo/cache.py
index 73c87c6..d01d2a8 100644
--- a/lib/vdsm/network/netinfo/cache.py
+++ b/lib/vdsm/network/netinfo/cache.py
@@ -126,7 +126,8 @@
for net, netAttr in six.iteritems(nets):
try:
# Pass the iface if the net is _not_ bridged, the bridge otherwise
- d[net] = _getNetInfo(netAttr.get('iface', net), netAttr['bridged'],
+ d[net] = _getNetInfo(netAttr['iface'] or net,
+ netAttr['bridge'] is not None,
routes, ipAddrs,
running_config.networks.get(net, None))
except KeyError:
diff --git a/lib/vdsm/network/netswitch.py b/lib/vdsm/network/netswitch.py
index a5d393c..357d62c 100644
--- a/lib/vdsm/network/netswitch.py
+++ b/lib/vdsm/network/netswitch.py
@@ -22,9 +22,9 @@
import six
+from vdsm.network import libvirt
from vdsm.network.ip import address
from vdsm.network.ip import dhclient
-from vdsm.network.libvirt import networks as libvirt_nets
from vdsm.network.link import iface
from vdsm.network.link.bond import Bond
from vdsm.network.link.setup import SetupBonds
@@ -136,7 +136,7 @@
def _setup_legacy(networks, bondings, options, in_rollback):
- _libvirt_nets = libvirt_nets()
+ _libvirt_nets = libvirt.networks()
_netinfo = CachingNetInfo(netinfo_get(libvirtNets2vdsm(_libvirt_nets)))
with legacy_switch.ConfiguratorClass(in_rollback) as configurator:
diff --git a/tests/network/libvirt_test.py b/tests/network/libvirt_test.py
index b62351a..a182024 100644
--- a/tests/network/libvirt_test.py
+++ b/tests/network/libvirt_test.py
@@ -19,6 +19,7 @@
#
from __future__ import absolute_import
+from contextlib import contextmanager
import re
import xml.etree.ElementTree as ET
@@ -30,11 +31,13 @@
NETWORK = 'awesome_net'
LIBVIRT_NETWORK = 'vdsm-' + NETWORK
+OVS_BRIDGE = 'vdsmbr_123'
+VLAN = 10
IFACE = 'dummy'
@attr(type='unit')
-class LibvirtTests(TestCaseBase):
+class LibvirtUnitTests(TestCaseBase):
def assertEqualXml(self, a, b):
"""Compare two xml strings for equality"""
@@ -53,7 +56,7 @@
<forward mode='bridge'/>
<bridge name='{}'/>
</network>""".format(LIBVIRT_NETWORK, NETWORK)
- actual_doc = libvirt.createNetworkDef(NETWORK, bridged=True)
+ actual_doc = libvirt.createNetworkDef(NETWORK, bridge=NETWORK)
self.assertEqualXml(expected_doc, actual_doc)
def test_create_net_xml_with_iface(self):
@@ -63,6 +66,71 @@
<interface dev='{}'/>
</forward>
</network>""".format(LIBVIRT_NETWORK, IFACE)
- actual_doc = libvirt.createNetworkDef(
- NETWORK, bridged=False, iface=IFACE)
+ actual_doc = libvirt.createNetworkDef(NETWORK, iface=IFACE)
self.assertEqualXml(expected_doc, actual_doc)
+
+ def test_create_net_xml_with_ovs_bridge(self):
+ expected_doc = """<network>
+ <name>{}</name>
+ <forward mode='bridge'/>
+ <bridge name='{}'/>
+ <virtualport type='openvswitch'/>
+ </network>""".format(LIBVIRT_NETWORK, OVS_BRIDGE)
+ actual_doc = libvirt.createNetworkDef(
+ NETWORK, bridge=OVS_BRIDGE, virtualport='openvswitch')
+ self.assertEqualXml(expected_doc, actual_doc)
+
+ def test_create_net_xml_with_ovs_bridge_and_vlan(self):
+ expected_doc = """<network>
+ <name>{}</name>
+ <forward mode='bridge'/>
+ <bridge name='{}'/>
+ <vlan>
+ <tag id='{}'/>
+ </vlan>
+ <virtualport type='openvswitch'/>
+ </network>""".format(LIBVIRT_NETWORK, OVS_BRIDGE,
+ VLAN)
+ actual_doc = libvirt.createNetworkDef(
+ NETWORK, bridge=OVS_BRIDGE, vlan=VLAN, virtualport='openvswitch')
+ self.assertEqualXml(expected_doc, actual_doc)
+
+
+@attr(type='integration')
+class LibvirtIntegrationTests(TestCaseBase):
+
+ def _test_create_net(self, **net_attrs):
+ net_def = libvirt.createNetworkDef(NETWORK, **net_attrs)
+ with libvirt_net(NETWORK, net_def):
+ nets = libvirt.networks()
+ self.assertIn(NETWORK, nets)
+ self.assertEqual(nets[NETWORK], net_attrs)
+ nets = libvirt.networks()
+ self.assertNotIn(NETWORK, nets)
+
+ def test_create_net_with_bridge(self):
+ self._test_create_net(
+ bridge=NETWORK, iface=None, vlan=None, virtualport=None)
+
+ def test_create_net_with_iface(self):
+ self._test_create_net(
+ bridge=None, iface=IFACE, vlan=None, virtualport=None)
+
+ def test_create_net_with_ovs_bridge(self):
+ self._test_create_net(
+ bridge=OVS_BRIDGE, iface=None, vlan=None,
+ virtualport='openvswitch')
+
+ def test_create_net_with_ovs_bridge_and_vlan(self):
+ self._test_create_net(
+ bridge=OVS_BRIDGE, iface=None, vlan=VLAN,
+ virtualport='openvswitch')
+
+
+@contextmanager
+def libvirt_net(net, net_def):
+ try:
+ libvirt.createNetwork(net_def)
+ yield
+ finally:
+ libvirt.removeNetwork(net)
diff --git a/vdsm_hooks/ovs/ovs_before_network_setup_libvirt.py b/vdsm_hooks/ovs/ovs_before_network_setup_libvirt.py
index 9eb7495..55d8e75 100644
--- a/vdsm_hooks/ovs/ovs_before_network_setup_libvirt.py
+++ b/vdsm_hooks/ovs/ovs_before_network_setup_libvirt.py
@@ -34,9 +34,7 @@
else:
if net in running_config.networks:
libvirt_remove.add(net)
- libvirt_network_xml = libvirt.createNetworkDef(
- net, bridged=True, iface=(attrs.get('nic') or
- attrs.get('bonding')))
+ libvirt_network_xml = libvirt.createNetworkDef(net, bridge=net)
libvirt_create[net] = libvirt_network_xml
return libvirt_create, libvirt_remove
--
To view, visit https://gerrit.ovirt.org/65065
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6de49e456d8c49f0309690a7fc2bee995f9846bb
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phoracek(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
7 years, 8 months
Change in vdsm[master]: testlib: Handle EINTR in waitpid
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: testlib: Handle EINTR in waitpid
......................................................................
testlib: Handle EINTR in waitpid
Handle EINTR when waiting for a child process in a @forked test.
Fixes this error seen on travis:
Traceback (most recent call last):
File "/vdsm/tests/testlib.py", line 521, in wrapper
_, status = os.waitpid(pid, 0)
OSError: [Errno 4] Interrupted system call
Change-Id: Ibe64ef55111afe84c20f11a001419312cf4cfff6
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M tests/testlib.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/62/65262/1
diff --git a/tests/testlib.py b/tests/testlib.py
index e8c4274..837349c 100644
--- a/tests/testlib.py
+++ b/tests/testlib.py
@@ -518,7 +518,7 @@
os.write(w, pickle.dumps(e))
os._exit(1)
else:
- _, status = os.waitpid(pid, 0)
+ _, status = osutils.uninterruptible(os.waitpid, pid, 0)
if status != 0:
e = pickle.loads(os.read(r, 4006))
raise e
--
To view, visit https://gerrit.ovirt.org/65262
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibe64ef55111afe84c20f11a001419312cf4cfff6
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
7 years, 8 months
Change in vdsm[master]: dockerfile: Add missing networking packages
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: dockerfile: Add missing networking packages
......................................................................
dockerfile: Add missing networking packages
This patch adds:
- openvswitch
- bridge-utils
Change-Id: I00f2caff47b5e488536cfd898b462ce932ec4862
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M contrib/Dockerfile
1 file changed, 2 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/59/65259/1
diff --git a/contrib/Dockerfile b/contrib/Dockerfile
index 621ba22..1090cbb 100644
--- a/contrib/Dockerfile
+++ b/contrib/Dockerfile
@@ -5,6 +5,7 @@
PyYAML \
autoconf \
automake \
+ bridge-utils \
dosfstools \
e2fsprogs \
genisoimage \
@@ -13,6 +14,7 @@
libvirt-python \
make \
mom \
+ openvswitch \
psmisc \
python-cpopen \
python-decorator \
--
To view, visit https://gerrit.ovirt.org/65259
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I00f2caff47b5e488536cfd898b462ce932ec4862
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
7 years, 8 months
Change in vdsm[master]: mount: Add mounts monitor
by Nir Soffer
Nir Soffer has restored this change.
Change subject: mount: Add mounts monitor
......................................................................
Restored
--
To view, visit https://gerrit.ovirt.org/56516
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: restore
Gerrit-Change-Id: I25ad36ebfde12d2e3250e893de98bba66f160623
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Adam Litke <alitke(a)redhat.com>
Gerrit-Reviewer: Ala Hino <ahino(a)redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Freddy Rolland <frolland(a)redhat.com>
Gerrit-Reviewer: Idan Shaby <ishaby(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Jenkins CI RO
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
7 years, 8 months
Change in vdsm[master]: hsm: Report vg name in getDeviceList
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: hsm: Report vg name in getDeviceList
......................................................................
hsm: Report vg name in getDeviceList
Hosted engine needs the iscsi session info used by the hosted engine
storage domain. getDeviceList() seems to include the needed info, but it
does not report the vg name for each device, making it hard to match the
iscsi session info and the hosted engine storage domain.
We return now the vg name of each device, which seems to be useful info
regardless of hosted engine needs, and can be used on the engine side
for reconstructing host state or validating engine view vs host view.
Change-Id: I116714cb5143ea92f5cb54c3f80f895c07ada536
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/rpc/vdsmapi-schema.json
M vdsm/storage/hsm.py
2 files changed, 11 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/23/45823/1
diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index e0e95b9..1b2a171 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -1473,6 +1473,10 @@
#
# @status: The device status (free/used/unknown)
#
+# @vgname: The LVM volume group name, if this device is used as
+# a physical volume. This is typically a storage domain
+# UUID.
+#
# Since: 4.10.0
#
# Notes: The value of @serial may be dependent on the current host so this
@@ -1490,7 +1494,8 @@
'pathstatus': ['BlockDevicePathInfo'],
'pathlist': ['IscsiSessionInfo'], 'logicalblocksize': 'uint',
'physicalblocksize': 'uint', 'partitioned': 'bool',
- 'pvsize': 'uint', 'status': 'BlockDeviceStatus'}}
+ 'pvsize': 'uint', 'status': 'BlockDeviceStatus',
+ 'vgname': 'str'}}
##
# @Host.getDeviceList:
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 1b8c064..32e16c3 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -2019,14 +2019,18 @@
pvuuid = pv.uuid
pvsize = pv.size
vguuid = pv.vg_uuid
+ vgname = pv.vg_name
else:
pvuuid = ""
pvsize = ""
vguuid = ""
+ vgname = ""
devInfo = {'GUID': dev.get("guid", ""), 'pvUUID': pvuuid,
'pvsize': str(pvsize),
- 'vgUUID': vguuid, 'vendorID': dev.get("vendor", ""),
+ 'vgUUID': vguuid,
+ 'vgname': vgname,
+ 'vendorID': dev.get("vendor", ""),
'productID': dev.get("product", ""),
'fwrev': dev.get("fwrev", ""),
"serial": dev.get("serial", ""),
--
To view, visit https://gerrit.ovirt.org/45823
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I116714cb5143ea92f5cb54c3f80f895c07ada536
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
7 years, 8 months
Change in vdsm[master]: tests: Test both ssl and m2c
by Nir Soffer
Nir Soffer has restored this change.
Change subject: tests: Test both ssl and m2c
......................................................................
Restored
--
To view, visit https://gerrit.ovirt.org/48823
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: restore
Gerrit-Change-Id: Iaa6415c68261f0458b2befa1139b3c8f155820ac
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Jenkins CI RO
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
7 years, 8 months
Change in vdsm[master]: utils: Consider sleep time in deadline calculation
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: utils: Consider sleep time in deadline calculation
......................................................................
utils: Consider sleep time in deadline calculation
This patches fixes 2 utils.retry() broken tests:
- The special case when deadline has reached when an operation was done.
Previously we use to sleep and perform another retry, now we bail out.
- The special case when deadline was not reached when an operation was
done, but we don't have time for sleep (sleeping will reach or exceed
the deadline). Previously we used to sleep and perform another retry,
now we bail out.
Change-Id: I7f41c6b21e3432159c13d46cfe75d1f6236cbb8c
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M lib/vdsm/utils.py
M tests/utilsTests.py
2 files changed, 3 insertions(+), 8 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/00/46400/1
diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index caf4cc2..4a4b153 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -938,10 +938,7 @@
if tries in [0, None]:
tries = -1
- if timeout in [0, None]:
- timeout = -1
-
- startTime = monotonic_time()
+ deadline = monotonic_time() + timeout if timeout else None
while True:
tries -= 1
@@ -951,7 +948,7 @@
if tries == 0:
raise
- if (timeout > 0) and ((monotonic_time() - startTime) > timeout):
+ if deadline and monotonic_time() + sleep >= deadline:
raise
if stopCallback is not None and stopCallback():
diff --git a/tests/utilsTests.py b/tests/utilsTests.py
index d213de5..fd4f42e 100644
--- a/tests/utilsTests.py
+++ b/tests/utilsTests.py
@@ -44,7 +44,7 @@
from testlib import permutations, expandPermutations
from testlib import VdsmTestCase as TestCaseBase
from testValidation import checkSudo
-from testValidation import brokentest, stresstest
+from testValidation import stresstest
from multiprocessing import Process
EXT_SLEEP = "sleep"
@@ -86,7 +86,6 @@
# Make sure we had the proper amount of iterations before failing
self.assertEquals(counter[0], limit)
- @brokentest("deadline is not respected")
@MonkeyPatch(utils, 'monotonic_time', FakeTime(0))
@MonkeyPatch(time, 'sleep', fake_sleep)
def testTimeoutDeadlineReached(self):
@@ -104,7 +103,6 @@
timeout=3, sleep=1)
self.assertEqual(utils.monotonic_time.now, 3)
- @brokentest("sleep is not considered in deadline calculation")
@MonkeyPatch(utils, 'monotonic_time', FakeTime(0))
@MonkeyPatch(time, 'sleep', fake_sleep)
def testTimeoutNoTimeForSleep(self):
--
To view, visit https://gerrit.ovirt.org/46400
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7f41c6b21e3432159c13d46cfe75d1f6236cbb8c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
7 years, 8 months