Change in vdsm[master]: spec: Require latest ioprocess
by ykaplan@redhat.com
Yeela Kaplan has uploaded a new change for review.
Change subject: spec: Require latest ioprocess
......................................................................
spec: Require latest ioprocess
Latest IOProcess(0.12) includes a new patch for
the python bindings that deals with a memory leak.
Change-Id: I09de4d0dec19903109be407dee3e8d1fde439404
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1124369
Signed-off-by: Yeela Kaplan <ykaplan(a)redhat.com>
---
M vdsm.spec.in
1 file changed, 3 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/69/32569/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index e5ea531..5956bbca 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -82,7 +82,7 @@
BuildRequires: python-inotify
BuildRequires: python-pthreading
BuildRequires: python-cpopen >= 1.3
-BuildRequires: python-ioprocess >= 0.10
+BuildRequires: python-ioprocess >= 0.12
BuildRequires: rpm-python
BuildRequires: libnl
BuildRequires: libselinux-python
@@ -123,7 +123,7 @@
Requires: python-inotify
Requires: python-argparse
Requires: python-cpopen >= 1.3
-Requires: python-ioprocess >= 0.10
+Requires: python-ioprocess >= 0.12
Requires: python-pthreading >= 0.1.3-3
Requires: python-ethtool >= 0.6-3
Requires: %{name}-python-zombiereaper = %{version}-%{release}
@@ -339,7 +339,7 @@
Requires: %{name}-python-zombiereaper = %{version}-%{release}
Requires: python-cpopen >= 1.2.3-5
Requires: m2crypto
-Requires: python-ioprocess >= 0.10
+Requires: python-ioprocess >= 0.12
BuildArch: noarch
%description python
--
To view, visit http://gerrit.ovirt.org/32569
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I09de4d0dec19903109be407dee3e8d1fde439404
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan(a)redhat.com>
9 years, 8 months
Change in vdsm[master]: ethtool: remove vdsm dependency on ethtool
by asegurap@redhat.com
Antoni Segura Puimedon has uploaded a new change for review.
Change subject: ethtool: remove vdsm dependency on ethtool
......................................................................
ethtool: remove vdsm dependency on ethtool
We only leave a dependency in the bootstrap package as it is
deprecated anyway and touching it would do more harm than good.
Change-Id: I71f97e182f3fc74cfa9e8288b1071aad1082fb6f
Signed-off-by: Antoni S. Puimedon <asegurap(a)redhat.com>
---
M lib/vdsm/netlink/__init__.py
M lib/vdsm/netlink/addr.py
M lib/vdsm/netlink/link.py
M lib/vdsm/netlink/route.py
M tests/netinfoTests.py
M vdsm.spec.in
6 files changed, 21 insertions(+), 30 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/82/32382/1
diff --git a/lib/vdsm/netlink/__init__.py b/lib/vdsm/netlink/__init__.py
index a292e23..2ef8cfa 100644
--- a/lib/vdsm/netlink/__init__.py
+++ b/lib/vdsm/netlink/__init__.py
@@ -24,8 +24,6 @@
from Queue import Empty, Queue
from threading import BoundedSemaphore
-import ethtool
-
_POOL_SIZE = 5
_NETLINK_ROUTE = 0
CHARBUFFSIZE = 40 # Increased to fit IPv6 expanded representations
@@ -119,19 +117,14 @@
_none_proto = CFUNCTYPE(None, c_void_p)
-def _ethtool_uses_libnl3():
- """Returns whether ethtool uses libnl3."""
- return (StrictVersion('0.9') <=
- StrictVersion(ethtool.version.split()[1].lstrip('v')))
-
-if _ethtool_uses_libnl3():
+try:
LIBNL = CDLL('libnl-3.so.200', use_errno=True)
LIBNL_ROUTE = CDLL('libnl-route-3.so.200', use_errno=True)
_nl_socket_alloc = CFUNCTYPE(c_void_p)(('nl_socket_alloc', LIBNL))
_nl_socket_free = _none_proto(('nl_socket_free', LIBNL))
-else: # libnl-1
+except OSError: # CDLL failed to lead libnl3, assume libnl-1
# Change from handle to socket as it is now more accurately called in
# libnl-3
LIBNL_ROUTE = LIBNL = CDLL('libnl.so.1', use_errno=True)
diff --git a/lib/vdsm/netlink/addr.py b/lib/vdsm/netlink/addr.py
index 649a1d5..960f4ee 100644
--- a/lib/vdsm/netlink/addr.py
+++ b/lib/vdsm/netlink/addr.py
@@ -21,7 +21,7 @@
from . import _cache_manager, _nl_cache_get_first, _nl_cache_get_next
from . import _char_proto, _int_char_proto, _int_proto, _void_proto
-from . import _ethtool_uses_libnl3, LIBNL_ROUTE, _nl_geterror, _pool
+from . import LIBNL, LIBNL_ROUTE, _nl_geterror, _pool
from . import _addr_to_str, _af_to_str, _scope_to_str, CHARBUFFSIZE
from .link import _nl_link_cache, _link_index_to_name
@@ -64,7 +64,7 @@
# This helps ctypes know the calling conventions it should use to communicate
# with the binary interface of libnl and which types it should allocate and
# cast. Without it ctypes fails when not running on the main thread.
-if _ethtool_uses_libnl3():
+if LIBNL != LIBNL_ROUTE:
_addr_alloc_cache = CFUNCTYPE(c_int, c_void_p, c_void_p)(
('rtnl_addr_alloc_cache', LIBNL_ROUTE))
diff --git a/lib/vdsm/netlink/link.py b/lib/vdsm/netlink/link.py
index c66dc4a..13d00c4 100644
--- a/lib/vdsm/netlink/link.py
+++ b/lib/vdsm/netlink/link.py
@@ -24,7 +24,7 @@
from . import _cache_manager, _nl_cache_get_first, _nl_cache_get_next
from . import _char_proto, _int_char_proto, _int_proto, _void_proto
-from . import _ethtool_uses_libnl3, LIBNL_ROUTE, _nl_geterror, _pool
+from . import LIBNL, LIBNL_ROUTE, _nl_geterror, _pool
from . import _addr_to_str, CHARBUFFSIZE
@@ -64,7 +64,7 @@
# libnl-1 has a bug when getting type information.
# https://github.com/tgraf/libnl-1.1-stable/issues/1
# TODO: Add for libnl1 if the bug is fixed
- if _ethtool_uses_libnl3():
+ if LIBNL != LIBNL_ROUTE:
link_type = _rtnl_link_get_type(link)
if link_type is not None:
info['type'] = link_type
@@ -102,7 +102,7 @@
# This helps ctypes know the calling conventions it should use to communicate
# with the binary interface of libnl and which types it should allocate and
# cast. Without it ctypes fails when not running on the main thread.
-if _ethtool_uses_libnl3():
+if LIBNL != LIBNL_ROUTE:
_link_alloc_cache = CFUNCTYPE(c_int, c_void_p, c_int, c_void_p)(
('rtnl_link_alloc_cache', LIBNL_ROUTE))
_link_is_vlan = _int_proto(('rtnl_link_is_vlan', LIBNL_ROUTE))
diff --git a/lib/vdsm/netlink/route.py b/lib/vdsm/netlink/route.py
index fc1048e..5d1c3b0 100644
--- a/lib/vdsm/netlink/route.py
+++ b/lib/vdsm/netlink/route.py
@@ -22,7 +22,7 @@
from . import _cache_manager, _nl_cache_get_first, _nl_cache_get_next
from . import _char_proto, _int_proto, _void_proto
-from . import _ethtool_uses_libnl3, LIBNL_ROUTE, _nl_geterror, _pool
+from . import LIBNL, LIBNL_ROUTE, _nl_geterror, _pool
from . import _addr_to_str, _af_to_str, _scope_to_str
from .link import _nl_link_cache, _link_index_to_name
@@ -53,11 +53,11 @@
if oif_index > 0:
data['oif'] = _link_index_to_name(link_cache, oif_index)
table = _rtnl_route_get_table(route)
- if _ethtool_uses_libnl3() or table != _RT_TABLE_COMPAT:
+ if LIBNL != LIBNL_ROUTE or table != _RT_TABLE_COMPAT:
data['table'] = table
return data
-if _ethtool_uses_libnl3():
+if LIBNL != LIBNL_ROUTE:
_route_alloc_cache = CFUNCTYPE(c_int, c_void_p, c_int, c_int, c_void_p)(
('rtnl_route_alloc_cache', LIBNL_ROUTE))
_route_get_nnexthops = _int_proto(('rtnl_route_get_nnexthops',
diff --git a/tests/netinfoTests.py b/tests/netinfoTests.py
index 810e3dc..50b5c62 100644
--- a/tests/netinfoTests.py
+++ b/tests/netinfoTests.py
@@ -24,13 +24,12 @@
import time
from xml.dom import minidom
-import ethtool
-
from vdsm import ipwrapper
from vdsm import netconfpersistence
from vdsm import netinfo
from vdsm.netinfo import (getBootProtocol, getDhclientIfaces, BONDING_MASTERS,
BONDING_OPT, _randomIfaceName, _getBondingOptions)
+from vdsm.netlink import addr as nl_addr
from functional import dummy, veth
from ipwrapperTests import _fakeTypeDetection
@@ -95,18 +94,16 @@
self.assertEqual('::ffff:127.0.0.1', netinfo.IPv4toMapped('127.0.0.1'))
def testGetDeviceByIP(self):
- for dev in ethtool.get_interfaces_info(ethtool.get_active_devices()):
+ for addr in nl_addr.iter_addrs():
# Link-local IPv6 addresses are generated from the MAC address,
# which is shared between a nic and its bridge. Since We don't
# support having the same IP address on two different NICs, and
# link-local IPv6 addresses aren't interesting for 'getDeviceByIP'
# then ignore them in the test
- ipaddrs = [ipv6.address for ipv6 in dev.get_ipv6_addresses()
- if ipv6.scope != 'link']
- if dev.ipv4_address is not None:
- ipaddrs.append(dev.ipv4_address)
- for ip in ipaddrs:
- self.assertEqual(dev.device, netinfo.getDeviceByIP(ip))
+ if addr['scope'] != 'link':
+ self.assertEqual(
+ addr['label'],
+ netinfo.getDeviceByIP(addr['address'].split('/')[0]))
def _testNics(self):
"""Creates a test fixture so that nics() reports:
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 323b586..6f21278 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -78,7 +78,6 @@
# BuildRequires needed by the tests during the build
BuildRequires: dosfstools
BuildRequires: psmisc
-BuildRequires: python-ethtool
BuildRequires: python-inotify
BuildRequires: python-pthreading
BuildRequires: python-cpopen >= 1.3
@@ -125,7 +124,6 @@
Requires: python-cpopen >= 1.3
Requires: python-ioprocess >= 0.10
Requires: python-pthreading >= 0.1.3-3
-Requires: python-ethtool >= 0.6-3
Requires: %{name}-python-zombiereaper = %{version}-%{release}
Requires: rpm-python
Requires: nfs-utils
@@ -176,7 +174,6 @@
Requires: sanlock >= 2.8, sanlock-python
%if 0%{?rhel}
-Requires: python-ethtool >= 0.6-3
%if 0%{?rhel} >= 7
Requires: device-mapper-multipath
Requires: e2fsprogs
@@ -210,7 +207,6 @@
Requires: python >= 2.7.3
Requires: qemu-kvm >= 2:0.15.0-4
Requires: qemu-img >= 2:0.15.0-4
-Requires: python-ethtool >= 0.8-1
Requires: initscripts >= 9.42.2-1
Requires: device-mapper-multipath >= 0.4.9-18
Requires: e2fsprogs >= 1.41.14
@@ -316,6 +312,11 @@
%package bootstrap
Summary: VDSM bootstrapping package
BuildArch: noarch
+%if 0%{?rhel} < 7
+Requires: python-ethtool >= 0.6-3
+else
+Requires: python-ethtool >= 0.8-1
+%endif
%description bootstrap
VDSM bootstrapping package. Used for delivering the bootstrap code onto the
--
To view, visit http://gerrit.ovirt.org/32382
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I71f97e182f3fc74cfa9e8288b1071aad1082fb6f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap(a)redhat.com>
9 years, 8 months
Change in vdsm[master]: ethtool: remove some more usages
by asegurap@redhat.com
Antoni Segura Puimedon has uploaded a new change for review.
Change subject: ethtool: remove some more usages
......................................................................
ethtool: remove some more usages
This patch continues with the removal of the python ethtool
dependency, as it is not really necessary now that the libnl
bindings are mature.
Change-Id: Ib97f8d536edf293af748f5c16316ee92f162fe5f
Signed-off-by: Antoni S. Puimedon <asegurap(a)redhat.com>
---
M lib/vdsm/ipwrapper.py
M tests/tcTests.py
M vdsm/network/tc/__init__.py
3 files changed, 38 insertions(+), 43 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/81/32381/1
diff --git a/lib/vdsm/ipwrapper.py b/lib/vdsm/ipwrapper.py
index 5fa874e..9e38bf6 100644
--- a/lib/vdsm/ipwrapper.py
+++ b/lib/vdsm/ipwrapper.py
@@ -21,6 +21,7 @@
from contextlib import closing
from glob import iglob
import array
+import ctypes
import errno
import fcntl
import os
@@ -116,6 +117,7 @@
_hiddenNics = config.get('vars', 'hidden_nics').split(',')
_hiddenVlans = config.get('vars', 'hidden_vlans').split(',')
IFF_RUNNING = 1 << 6
+ IFF_PROMISC = 1 << 8
def __init__(self, address, index, linkType, mtu, name, qdisc, state,
vlanid=None, vlanprotocol=None, master=None, device=None,
@@ -243,6 +245,35 @@
def oper_up(self):
return bool(self.flags & self.IFF_RUNNING)
+ @property
+ def promisc(self):
+ return bool(self.flags & self.IFF_PROMISC)
+
+ @promisc.setter
+ def promisc(self, value):
+ """Takes a boolean to enable/disable Link promiscuity"""
+ if value:
+ self.flags |= self.IFF_PROMISC
+ else:
+ self.flags &= ~self.IFF_PROMISC
+ self.set_flags(self.flags)
+
+ def set_flags(self, flags):
+ "Set device flags. We need this local definition until ethtool has it"
+
+ SIOCSIFFLAGS = 0x8914
+
+ class ifreq(ctypes.Structure):
+ _fields_ = [("ifr_ifrn", ctypes.c_char * 16),
+ ("ifr_flags", ctypes.c_short)]
+
+ with closing(socket.socket(socket.AF_INET, socket.SOCK_DGRAM)) as s:
+ ifr = ifreq()
+ ifr.ifr_ifrn = self.name
+ ifr.ifr_flags = flags
+
+ fcntl.ioctl(s.fileno(), SIOCSIFFLAGS, ifr)
+
def drv_name(devName):
"""Returns the driver used by a device.
diff --git a/tests/tcTests.py b/tests/tcTests.py
index 606e2d0..1e59653 100644
--- a/tests/tcTests.py
+++ b/tests/tcTests.py
@@ -31,12 +31,12 @@
from subprocess import Popen, check_call, PIPE
import fcntl
import struct
-import ethtool
from testlib import VdsmTestCase as TestCaseBase
from testValidation import ValidateRunningAsRoot
from vdsm.constants import EXT_BRCTL, EXT_TC
+from vdsm import ipwrapper
from nose.plugins.skip import SkipTest
from network import tc
@@ -191,13 +191,11 @@
def testTogglePromisc(self):
tc.set_promisc(self._bridge.devName, True)
- self.assertTrue(ethtool.get_flags(self._bridge.devName) &
- ethtool.IFF_PROMISC,
+ self.assertTrue(ipwrapper.getLink(self._bridge.devName).promisc,
"Could not enable promiscuous mode.")
tc.set_promisc(self._bridge.devName, False)
- self.assertFalse(ethtool.get_flags(self._bridge.devName) &
- ethtool.IFF_PROMISC,
+ self.assertFalse(ipwrapper.getLink(self._bridge.devName).promisc,
"Could not disable promiscuous mode.")
def testException(self):
diff --git a/vdsm/network/tc/__init__.py b/vdsm/network/tc/__init__.py
index 61602ac..9b6c9bb 100644
--- a/vdsm/network/tc/__init__.py
+++ b/vdsm/network/tc/__init__.py
@@ -19,14 +19,10 @@
#
from collections import namedtuple
-from contextlib import closing
from functools import partial
-import ctypes
import errno
-import fcntl
-import socket
-import ethtool
+from vdsm import ipwrapper
from . import filter as tc_filter
from . import _parser
@@ -55,7 +51,7 @@
else:
return []
- devices = set(ethtool.get_devices())
+ devices = set(link.name for link in ipwrapper.getLinks())
acts = [act for act in filt.actions
if act.target in devices and act.target != target]
@@ -74,8 +70,7 @@
qdisc_replace_prio(network)
qdisc_id = _qdiscs_of_device(network).next()
_addTarget(network, qdisc_id, target)
-
- set_promisc(network, True)
+ ipwrapper.getLink(network).promisc = True
def unsetPortMirroring(network, target):
@@ -91,7 +86,7 @@
if not acts:
qdisc_del(network, 'root')
qdisc_del(network, 'ingress')
- set_promisc(network, False)
+ ipwrapper.getLink(network).promisc = False
def qdisc_replace_ingress(dev):
@@ -141,35 +136,6 @@
except TrafficControlException as e:
if e.errCode != errno.ENOENT:
raise
-
-
-def set_flags(dev, flags):
- "Set device flags. We need this local definition until ethtool has it"
-
- SIOCSIFFLAGS = 0x8914
-
- class ifreq(ctypes.Structure):
- _fields_ = [("ifr_ifrn", ctypes.c_char * 16),
- ("ifr_flags", ctypes.c_short)]
-
- with closing(socket.socket(socket.AF_INET, socket.SOCK_DGRAM)) as s:
- ifr = ifreq()
- ifr.ifr_ifrn = dev
- ifr.ifr_flags = flags
-
- fcntl.ioctl(s.fileno(), SIOCSIFFLAGS, ifr)
-
-
-def set_promisc(dev, on=True):
- flags = ethtool.get_flags(dev)
-
- if bool(flags & ethtool.IFF_PROMISC) != on:
- if on:
- flags |= ethtool.IFF_PROMISC
- else:
- flags &= ~ethtool.IFF_PROMISC
-
- set_flags(dev, flags)
Filter = namedtuple('Filter', 'prio handle actions')
--
To view, visit http://gerrit.ovirt.org/32381
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib97f8d536edf293af748f5c16316ee92f162fe5f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap(a)redhat.com>
9 years, 8 months
Change in vdsm[master]: sampling: remove ethtool dependency
by asegurap@redhat.com
Antoni Segura Puimedon has uploaded a new change for review.
Change subject: sampling: remove ethtool dependency
......................................................................
sampling: remove ethtool dependency
The flags are already part of the link object. There was no good
reason to ask the system again for this data.
Change-Id: I9ae5b5a017c954d0c3c2c0b6f3f62c08ee05bd4f
Signed-off-by: Antoni S. Puimedon <asegurap(a)redhat.com>
---
M lib/vdsm/ipwrapper.py
M vdsm/virt/sampling.py
2 files changed, 6 insertions(+), 15 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/60/32360/1
diff --git a/lib/vdsm/ipwrapper.py b/lib/vdsm/ipwrapper.py
index af31159..5fa874e 100644
--- a/lib/vdsm/ipwrapper.py
+++ b/lib/vdsm/ipwrapper.py
@@ -115,6 +115,7 @@
_hiddenBonds = config.get('vars', 'hidden_bonds').split(',')
_hiddenNics = config.get('vars', 'hidden_nics').split(',')
_hiddenVlans = config.get('vars', 'hidden_vlans').split(',')
+ IFF_RUNNING = 1 << 6
def __init__(self, address, index, linkType, mtu, name, qdisc, state,
vlanid=None, vlanprotocol=None, master=None, device=None,
@@ -238,6 +239,10 @@
return True
return False
+ @property
+ def oper_up(self):
+ return bool(self.flags & self.IFF_RUNNING)
+
def drv_name(devName):
"""Returns the driver used by a device.
diff --git a/vdsm/virt/sampling.py b/vdsm/virt/sampling.py
index d6bef32..969f755 100644
--- a/vdsm/virt/sampling.py
+++ b/vdsm/virt/sampling.py
@@ -31,7 +31,6 @@
import time
import logging
import errno
-import ethtool
import re
from vdsm import utils
@@ -87,19 +86,6 @@
if not tries:
raise
- def readIfaceOperstate(self, ifid):
- """
- Return the operational state of the interface.
-
- :returns: ``'up'`` if interface is up. ``'down'`` or ``0`` id it's
- down.
- """
- try:
- flags = ethtool.get_flags(ifid)
- except IOError:
- return '0'
- return 'up' if flags & ethtool.IFF_RUNNING else 'down'
-
def __init__(self, link):
ifid = link.name
self.rx = self.readIfaceStat(ifid, 'rx_bytes')
@@ -108,7 +94,7 @@
self.txDropped = self.readIfaceStat(ifid, 'tx_dropped')
self.rxErrors = self.readIfaceStat(ifid, 'rx_errors')
self.txErrors = self.readIfaceStat(ifid, 'tx_errors')
- self.operstate = self.readIfaceOperstate(ifid)
+ self.operstate = 'up' if link.oper_up else 'down'
self.speed = _getLinkSpeed(link)
self.duplex = _getDuplex(ifid)
--
To view, visit http://gerrit.ovirt.org/32360
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9ae5b5a017c954d0c3c2c0b6f3f62c08ee05bd4f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap(a)redhat.com>
9 years, 8 months
Change in vdsm[master]: vdsm: move video device to devices.py
by mpoledni@redhat.com
Martin Polednik has uploaded a new change for review.
Change subject: vdsm: move video device to devices.py
......................................................................
vdsm: move video device to devices.py
No real code changes
Change-Id: I40ba700e6223490251af86189196f189ae4bad39
Signed-off-by: Martin Polednik <mpoledni(a)redhat.com>
---
M tests/vmTests.py
M vdsm/virt/devices.py
M vdsm/virt/vm.py
3 files changed, 20 insertions(+), 19 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/63/29263/1
diff --git a/tests/vmTests.py b/tests/vmTests.py
index 2b6e82c..e31f691 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -31,6 +31,7 @@
from virt import vm
from virt import vmexitreason
from virt import xmldom
+from virt import devices
from vdsm import constants
from vdsm import define
from testrunner import VdsmTestCase as TestCaseBase
@@ -550,7 +551,7 @@
dev = {'device': 'vga', 'specParams': {'vram': '32768',
'heads': '2'}}
- video = vm.VideoDevice(self.conf, self.log, **dev)
+ video = devices.VideoDevice(self.conf, self.log, **dev)
self.assertXML(video.getXML(), videoXML)
def testInterfaceXML(self):
diff --git a/vdsm/virt/devices.py b/vdsm/virt/devices.py
index d484136..4d7fbee 100644
--- a/vdsm/virt/devices.py
+++ b/vdsm/virt/devices.py
@@ -32,3 +32,20 @@
Create domxml for general device
"""
return self.createXmlElem(self.type, self.device, ['address'])
+
+
+class VideoDevice(VmDevice):
+ __slots__ = ('address',)
+
+ def getXML(self):
+ """
+ Create domxml for video device
+ """
+ video = self.createXmlElem('video', None, ['address'])
+ sourceAttrs = {'vram': self.specParams.get('vram', '32768'),
+ 'heads': self.specParams.get('heads', '1')}
+ if 'ram' in self.specParams:
+ sourceAttrs['ram'] = self.specParams['ram']
+
+ video.appendChildWithArgs('model', type=self.device, **sourceAttrs)
+ return video
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index a0f4edf..bf7653c 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -628,23 +628,6 @@
return ctrl
-class VideoDevice(devices.VmDevice):
- __slots__ = ('address',)
-
- def getXML(self):
- """
- Create domxml for video device
- """
- video = self.createXmlElem('video', None, ['address'])
- sourceAttrs = {'vram': self.specParams.get('vram', '32768'),
- 'heads': self.specParams.get('heads', '1')}
- if 'ram' in self.specParams:
- sourceAttrs['ram'] = self.specParams['ram']
-
- video.appendChildWithArgs('model', type=self.device, **sourceAttrs)
- return video
-
-
class SoundDevice(devices.VmDevice):
__slots__ = ('address', 'alias')
@@ -1345,7 +1328,7 @@
DeviceMapping = ((DISK_DEVICES, Drive),
(NIC_DEVICES, NetworkInterfaceDevice),
(SOUND_DEVICES, SoundDevice),
- (VIDEO_DEVICES, VideoDevice),
+ (VIDEO_DEVICES, devices.VideoDevice),
(GRAPHICS_DEVICES, GraphicsDevice),
(CONTROLLER_DEVICES, ControllerDevice),
(GENERAL_DEVICES, devices.GeneralDevice),
--
To view, visit http://gerrit.ovirt.org/29263
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I40ba700e6223490251af86189196f189ae4bad39
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpoledni(a)redhat.com>
9 years, 8 months
Change in vdsm[master]: Additional tool tests for exposed functions
by ybronhei@redhat.com
Yaniv Bronhaim has uploaded a new change for review.
Change subject: Additional tool tests for exposed functions
......................................................................
Additional tool tests for exposed functions
Change-Id: Iae0f98a9218b38c94aa003fea832d6795e7f0f23
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
---
M tests/toolTests.py
1 file changed, 91 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/40/31940/1
diff --git a/tests/toolTests.py b/tests/toolTests.py
index e034ad0..aac1e54 100644
--- a/tests/toolTests.py
+++ b/tests/toolTests.py
@@ -21,7 +21,10 @@
from vdsm.tool.configurators import \
ModuleConfigure, \
NOT_CONFIGURED,\
- NOT_SURE
+ NOT_SURE,\
+ CONFIGURED,\
+ InvalidConfig,\
+ InvalidRun
from vdsm.tool.configurators.configfile import ConfigFile, ParserWrapper
from vdsm.tool.configurators.libvirt import Libvirt
from vdsm.tool import UsageError
@@ -50,6 +53,39 @@
def getRequires(self):
return self._dependencies
+
+ def getServices(self):
+ return []
+
+
+class FalseMockModuleConfigurator(MockModuleConfigurator):
+
+ def validate(self):
+ return False
+
+ def isconfigured(self):
+ return NOT_CONFIGURED
+
+ def configure(self):
+ raise InvalidRun('mock for invalid configure')
+
+ def removeConf(self):
+ raise Exception('mock invalid remove conf')
+
+
+class TrueMockModuleConfigurator(MockModuleConfigurator):
+
+ def validate(self):
+ return True
+
+ def isconfigured(self):
+ return CONFIGURED
+
+ def configure(self):
+ pass
+
+ def removeConf(self):
+ pass
class ConfiguratorTests(TestCase):
@@ -159,6 +195,60 @@
'--module=multipath'
)
+ @monkeypatch.MonkeyPatch(
+ configurator,
+ '_getConfigurers',
+ lambda: {
+ 'a': FalseMockModuleConfigurator('a', set()),
+ 'b': FalseMockModuleConfigurator('b', set()),
+ }
+ )
+ def testFailuresOnExposedFuncs(self):
+ self.assertRaises(
+ InvalidConfig,
+ configurator.validate_config,
+ 'validate-config',
+ )
+ self.assertRaises(
+ InvalidRun,
+ configurator.isconfigured,
+ 'is-configured',
+ )
+ # running configure with force flag to avoid validate check
+ self.assertRaises(
+ InvalidRun,
+ configurator.configure,
+ 'configure',
+ '--force',
+ )
+ self.assertRaises(
+ InvalidRun,
+ configurator.remove_config,
+ 'remove-config'
+ )
+
+ @monkeypatch.MonkeyPatch(
+ configurator,
+ '_getConfigurers',
+ lambda: {
+ 'a': TrueMockModuleConfigurator('a', set()),
+ 'b': TrueMockModuleConfigurator('b', set()),
+ }
+ )
+ def testValidFlowOnExposedFuncs(self):
+ configurator.validate_config(
+ 'validate-config',
+ )
+ configurator.isconfigured(
+ 'is-configured',
+ )
+ configurator.configure(
+ 'configure',
+ )
+ configurator.remove_config(
+ 'remove-config',
+ )
+
class LibvirtModuleConfigureTests(TestCase):
--
To view, visit http://gerrit.ovirt.org/31940
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iae0f98a9218b38c94aa003fea832d6795e7f0f23
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
9 years, 8 months
Change in vdsm[ovirt-3.5]: mounts: Optimize mount loop device resolution
by ybronhei@redhat.com
Hello Saggi Mizrahi, Dima Kuznetsov,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/32535
to review the following change.
Change subject: mounts: Optimize mount loop device resolution
......................................................................
mounts: Optimize mount loop device resolution
Existing code was re-reading mtab for each /proc/mounts entry.
Added lookup dictionary that translates /dev/loop spec to actual file
spec.
Lookup is reinitialized each time mtab is changed.
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1112779
Change-Id: I54f11786b45782cedd994d52e1e506292132fa47
Signed-off-by: Dima Kuznetsov <dkuznets(a)redhat.com>
Reviewed-on: http://gerrit.ovirt.org/28586
Reviewed-by: Saggi Mizrahi <smizrahi(a)redhat.com>
Tested-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
M tests/mountTests.py
M vdsm/storage/mount.py
2 files changed, 152 insertions(+), 10 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/35/32535/1
diff --git a/tests/mountTests.py b/tests/mountTests.py
index 04aa753..6eb6832 100644
--- a/tests/mountTests.py
+++ b/tests/mountTests.py
@@ -20,8 +20,10 @@
from contextlib import contextmanager
import errno
-from tempfile import mkstemp
+from tempfile import mkstemp, mkdtemp
import os
+import shutil
+import stat
from nose.plugins.skip import SkipTest
@@ -30,6 +32,7 @@
from storage.misc import execCmd
import storage.mount as mount
from testValidation import checkSudo
+import monkeypatch
FLOPPY_SIZE = (2 ** 20) * 4
@@ -72,3 +75,117 @@
self.assertTrue(m.isMounted())
finally:
m.umount()
+
+
+class IterMountsPerfTests(TestCaseBase):
+ line_fmt = ('%(fs_spec)s\t%(fs_file)s\t%(fs_vfstype)s'
+ '\t%(fs_mntops)s\t%(fs_freq)s\t%(fs_passno)s\n')
+
+ @classmethod
+ def _createFiles(cls, path, size):
+ mounts_path = os.path.join(path, 'mounts')
+ mtab_path = os.path.join(path, 'mtab')
+
+ with open(mounts_path, 'w') as mounts:
+ with open(mtab_path, 'w') as mtab:
+ for i in xrange(100):
+ mnt = mount.MountRecord('/dev/sda%d' % i,
+ '/some/path/%d' % i,
+ 'btrfs',
+ 'rw,relatime',
+ '0', '0')
+ mounts.write(cls.line_fmt % mnt._asdict())
+ mtab.write(cls.line_fmt % mnt._asdict())
+
+ for i in xrange(size):
+ mounts_mnt = mount.MountRecord('/dev/loop%d' % i,
+ '/mnt/loop%d' % i,
+ 'xfs',
+ 'rw,foobar,errors=continue',
+ '0', '0')
+ mtab_mnt = mount.MountRecord('/images/loop%d.img' % i,
+ '/mnt/loop%d' % i,
+ 'xfs',
+ 'rw,loop=/dev/loop%d' % i,
+ '0', '0')
+ mounts.write(cls.line_fmt % mounts_mnt._asdict())
+ mtab.write(cls.line_fmt % mtab_mnt._asdict())
+
+ return (mounts_path, mtab_path)
+
+ def setUp(self):
+ self._temp_dir = mkdtemp()
+ mounts, mtab = self._createFiles(self._temp_dir, 1000)
+ old_stat = os.stat
+
+ def mock_stat(path):
+ if path.startswith('/dev/loop'):
+ return old_stat('/')
+ return old_stat(path)
+ self._patch = monkeypatch.Patch([(mount, '_PROC_MOUNTS_PATH', mounts),
+ (mount, '_ETC_MTAB_PATH', mtab),
+ (mount, '_SYS_DEV_BLOCK_PATH',
+ self._temp_dir),
+ (mount, '_loopFsSpecs', {}),
+ (os, 'stat', mock_stat),
+ (stat, 'S_ISBLK', lambda x: True)])
+ self._patch.apply()
+
+ def tearDown(self):
+ shutil.rmtree(self._temp_dir)
+ self._patch.revert()
+
+ def test1000EntriesValidate(self):
+ mounts = list(mount.iterMounts())
+ for entry in mounts:
+ mountpoint = entry.fs_file
+ if mountpoint.startswith('/mnt/loop'):
+ expected_spec = ('/images/loop%s.img' %
+ mountpoint[len('/mnt/loop'):])
+ self.assertEquals(entry.fs_spec, expected_spec)
+
+ def test1000EntriesTwice(self):
+ list(mount.iterMounts())
+ list(mount.iterMounts())
+
+ def testLookupWipe(self):
+ with open(mount._PROC_MOUNTS_PATH) as f:
+ old_mounts = f.read()
+ with open(mount._ETC_MTAB_PATH) as f:
+ old_mtab = f.read()
+
+ self.assertEquals(len(list(mount.iterMounts())), 1100)
+ mounts_mnt = mount.MountRecord('/dev/loop10001',
+ '/mnt/loop10001',
+ 'xfs',
+ 'rw,foobar,errors=continue',
+ '0', '0')
+ mtab_mnt = mount.MountRecord('/images/loop10001.img',
+ '/mnt/loop%d',
+ 'xfs',
+ 'rw,loop=/dev/loop10001',
+ '0', '0')
+
+ with open(mount._PROC_MOUNTS_PATH, 'a') as f:
+ f.write(self.line_fmt % mounts_mnt._asdict())
+ with open(mount._ETC_MTAB_PATH, 'a') as f:
+ f.write(self.line_fmt % mtab_mnt._asdict())
+
+ self.assertEquals(len(list(mount.iterMounts())), 1101)
+ self.assertEquals(
+ len(filter(lambda x: x.fs_spec == '/images/loop10001.img',
+ mount.iterMounts())),
+ 1)
+ self.assertTrue('/dev/loop10001' in mount._getLoopFsSpecs())
+
+ with open(mount._PROC_MOUNTS_PATH, 'w') as f:
+ f.write(old_mounts)
+ with open(mount._ETC_MTAB_PATH, 'w') as f:
+ f.write(old_mtab)
+
+ self.assertEquals(len(list(mount.iterMounts())), 1100)
+ self.assertEquals(
+ len(filter(lambda x: x.fs_spec == '/images/loop10001.img',
+ mount.iterMounts())),
+ 0)
+ self.assertFalse('/dev/loop10001' in mount._getLoopFsSpecs())
diff --git a/vdsm/storage/mount.py b/vdsm/storage/mount.py
index a475a6f..99b2299 100644
--- a/vdsm/storage/mount.py
+++ b/vdsm/storage/mount.py
@@ -23,6 +23,7 @@
import re
import os
import stat
+import threading
from vdsm import constants
import misc
@@ -35,6 +36,10 @@
MountRecord = namedtuple("MountRecord", "fs_spec fs_file fs_vfstype "
"fs_mntops fs_freq fs_passno")
+
+_ETC_MTAB_PATH = '/etc/mtab'
+_PROC_MOUNTS_PATH = '/proc/mounts'
+_SYS_DEV_BLOCK_PATH = '/sys/dev/block/'
_RE_ESCAPE = re.compile(r"\\0\d\d")
@@ -62,7 +67,7 @@
def _iterateMtab():
- with open("/etc/mtab", "r") as f:
+ with open(_ETC_MTAB_PATH, "r") as f:
for line in f:
yield _parseFstabLine(line)
@@ -73,6 +78,26 @@
class MountError(RuntimeError):
pass
+
+
+_loopFsSpecsLock = threading.Lock()
+_loopFsSpecs = {}
+_loopFsSpecsTimestamp = None
+
+
+def _getLoopFsSpecs():
+ with _loopFsSpecsLock:
+ mtabTimestamp = os.stat(_ETC_MTAB_PATH).st_mtime
+ if _loopFsSpecsTimestamp != mtabTimestamp:
+ global _loopFsSpecs
+ _loopFsSpecs = {}
+ for entry in _iterateMtab():
+ for opt in entry.fs_mntops:
+ if opt.startswith('loop='):
+ _loopFsSpecs[opt[len('loop='):]] = entry.fs_spec
+ global _loopFsSpecsTimestamp
+ _loopFsSpecsTimestamp = mtabTimestamp
+ return _loopFsSpecs
def _resolveLoopDevice(path):
@@ -93,7 +118,9 @@
minor = os.minor(st.st_rdev)
major = os.major(st.st_rdev)
- loopdir = "/sys/dev/block/%d:%d/loop" % (major, minor)
+ loopdir = os.path.join(_SYS_DEV_BLOCK_PATH,
+ '%d:%d' % (major, minor),
+ 'loop')
if os.path.exists(loopdir):
with open(loopdir + "/backing_file", "r") as f:
# Remove trailing newline
@@ -101,19 +128,17 @@
# Old kernels might not have the sysfs entry, this is a bit slower and does
# not work on hosts that do support the above method.
- for rec in _iterateMtab():
- loopOpt = "loop=%s" % path
- for opt in rec.fs_mntops:
- if opt != loopOpt:
- continue
- return rec.fs_spec
+ lookup = _getLoopFsSpecs()
+
+ if path in lookup:
+ return lookup[path]
return path
def _iterKnownMounts():
- with open("/proc/mounts", "r") as f:
+ with open(_PROC_MOUNTS_PATH, "r") as f:
for line in f:
yield _parseFstabLine(line)
--
To view, visit http://gerrit.ovirt.org/32535
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I54f11786b45782cedd994d52e1e506292132fa47
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: Dima Kuznetsov <dkuznets(a)redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>
9 years, 9 months
Change in vdsm[master]: Fix failure while related services conf files do not exist
by ybronhei@redhat.com
Yaniv Bronhaim has uploaded a new change for review.
Change subject: Fix failure while related services conf files do not exist
......................................................................
Fix failure while related services conf files do not exist
During vdsm configuration we failed if one of the conf files (such as
libvirtd.conf) was not exist. This failed the configuration process and
introduced a regression.
This patch will create the file if not exists and move on with vdsm
configure.
Change-Id: Idb6565ce9cef6c7aa3f14c85f1dae0715e1858e2
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1135664
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
---
M lib/vdsm/tool/configurators/configfile.py
1 file changed, 12 insertions(+), 10 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/66/32166/1
diff --git a/lib/vdsm/tool/configurators/configfile.py b/lib/vdsm/tool/configurators/configfile.py
index 62b99b1..84651e3 100644
--- a/lib/vdsm/tool/configurators/configfile.py
+++ b/lib/vdsm/tool/configurators/configfile.py
@@ -1,4 +1,4 @@
-# Copyright 2013 Red Hat, Inc.
+# Copyright 2014 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
@@ -24,6 +24,7 @@
import re
import selinux
import io
+import errno
from ... import utils
if utils.isOvirtNode():
@@ -87,11 +88,6 @@
sectionEnd='## end of configuration section by vdsm',
prefix='# VDSM backup',
lineComment='by vdsm'):
- if not os.path.exists(filename):
- raise OSError(
- 'No such file or directory: %s' % (filename, )
- )
-
self._filename = filename
self._context = False
self._sectionStart = sectionStart
@@ -238,10 +234,16 @@
"""
Notice this method can be called out of context since it is read only
"""
- for line in open(self._filename, 'r'):
- if line == self._start():
- return True
- return False
+ try:
+ with open(self._filename, 'r') as f:
+ for line in f:
+ if line == self._start():
+ return True
+ return False
+ except IOError as e:
+ if e.errno == errno.ENOENT:
+ utils.touchFile(self._filename)
+ return False
class ParserWrapper(object):
--
To view, visit http://gerrit.ovirt.org/32166
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idb6565ce9cef6c7aa3f14c85f1dae0715e1858e2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
9 years, 9 months
Change in vdsm[master]: vdsm: initial split of vm devices
by mpoledni@redhat.com
Martin Polednik has uploaded a new change for review.
Change subject: vdsm: initial split of vm devices
......................................................................
vdsm: initial split of vm devices
initial boostrapping of VmDevice and GeneralDevice from devices.py
Change-Id: I63b602851c17697259e86dfad3a9063447c57e50
Signed-off-by: Martin Polednik <mpoledni(a)redhat.com>
---
M debian/vdsm.install
M vdsm.spec.in
A vdsm/virt/devices.py
M vdsm/virt/vm.py
4 files changed, 53 insertions(+), 48 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/50/29250/1
diff --git a/debian/vdsm.install b/debian/vdsm.install
index aaa1ecc..96b0779 100644
--- a/debian/vdsm.install
+++ b/debian/vdsm.install
@@ -150,4 +150,5 @@
./usr/share/vdsm/virt/vmpowerdown.py
./usr/share/vdsm/virt/vmstatus.py
./usr/share/vdsm/virt/xmldom.py
+./usr/share/vdsm/virt/devices.py
./var/lib/polkit-1/localauthority/10-vendor.d/10-vdsm-libvirt-access.pkla
diff --git a/vdsm.spec.in b/vdsm.spec.in
index ac5e1c2..8e54be2 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -937,6 +937,7 @@
%{_datadir}/%{vdsm_name}/virt/vmpowerdown.py*
%{_datadir}/%{vdsm_name}/virt/sampling.py*
%{_datadir}/%{vdsm_name}/virt/xmldom.py*
+%{_datadir}/%{vdsm_name}/virt/devices.py*
%{_datadir}/%{vdsm_name}/tool
%config(noreplace) %{_sysconfdir}/%{vdsm_name}/vdsm.conf
diff --git a/vdsm/virt/devices.py b/vdsm/virt/devices.py
new file mode 100644
index 0000000..d484136
--- /dev/null
+++ b/vdsm/virt/devices.py
@@ -0,0 +1,34 @@
+# local package imports
+from . import xmldom
+
+
+class VmDevice(xmldom.XMLDevice):
+ __slots__ = ('deviceType', 'device', 'alias', 'specParams', 'deviceId',
+ 'conf', 'log', '_deviceXML', 'type', 'custom')
+
+ def __init__(self, conf, log, **kwargs):
+ self.conf = conf
+ self.log = log
+ self.specParams = {}
+ self.custom = kwargs.pop('custom', {})
+ for attr, value in kwargs.iteritems():
+ try:
+ setattr(self, attr, value)
+ except AttributeError: # skip read-only properties
+ self.log.debug('Ignoring param (%s, %s) in %s', attr, value,
+ self.__class__.__name__)
+ self._deviceXML = None
+
+ def __str__(self):
+ attrs = [':'.join((a, str(getattr(self, a, None)))) for a in dir(self)
+ if not a.startswith('__')]
+ return ' '.join(attrs)
+
+
+class GeneralDevice(VmDevice):
+
+ def getXML(self):
+ """
+ Create domxml for general device
+ """
+ return self.createXmlElem(self.type, self.device, ['address'])
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index d44d96d..a0f4edf 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -63,6 +63,7 @@
from . import vmexitreason
from . import vmstatus
from . import xmldom
+from . import devices
from vmpowerdown import VmShutdown, VmReboot
@@ -612,39 +613,7 @@
return f
-class VmDevice(xmldom.XMLDevice):
- __slots__ = ('deviceType', 'device', 'alias', 'specParams', 'deviceId',
- 'conf', 'log', '_deviceXML', 'type', 'custom')
-
- def __init__(self, conf, log, **kwargs):
- self.conf = conf
- self.log = log
- self.specParams = {}
- self.custom = kwargs.pop('custom', {})
- for attr, value in kwargs.iteritems():
- try:
- setattr(self, attr, value)
- except AttributeError: # skip read-only properties
- self.log.debug('Ignoring param (%s, %s) in %s', attr, value,
- self.__class__.__name__)
- self._deviceXML = None
-
- def __str__(self):
- attrs = [':'.join((a, str(getattr(self, a, None)))) for a in dir(self)
- if not a.startswith('__')]
- return ' '.join(attrs)
-
-
-class GeneralDevice(VmDevice):
-
- def getXML(self):
- """
- Create domxml for general device
- """
- return self.createXmlElem(self.type, self.device, ['address'])
-
-
-class ControllerDevice(VmDevice):
+class ControllerDevice(devices.VmDevice):
__slots__ = ('address', 'model', 'index', 'master')
def getXML(self):
@@ -659,7 +628,7 @@
return ctrl
-class VideoDevice(VmDevice):
+class VideoDevice(devices.VmDevice):
__slots__ = ('address',)
def getXML(self):
@@ -676,7 +645,7 @@
return video
-class SoundDevice(VmDevice):
+class SoundDevice(devices.VmDevice):
__slots__ = ('address', 'alias')
def getXML(self):
@@ -688,7 +657,7 @@
return sound
-class NetworkInterfaceDevice(VmDevice):
+class NetworkInterfaceDevice(devices.VmDevice):
__slots__ = ('nicModel', 'macAddr', 'network', 'bootOrder', 'address',
'linkActive', 'portMirroring', 'filter',
'sndbufParam', 'driver', 'name')
@@ -702,7 +671,7 @@
kwargs[attr] = 'virtio'
elif attr == 'network' and value == '':
kwargs[attr] = DUMMY_BRIDGE
- VmDevice.__init__(self, conf, log, **kwargs)
+ devices.VmDevice.__init__(self, conf, log, **kwargs)
self.sndbufParam = False
self._customize()
@@ -801,7 +770,7 @@
return bandwidth
-class Drive(VmDevice):
+class Drive(devices.VmDevice):
__slots__ = ('iface', 'path', 'readonly', 'bootOrder', 'domainID',
'poolID', 'imageID', 'UUID', 'volumeID', 'format',
'propagateErrors', 'address', 'apparentsize', 'volumeInfo',
@@ -816,7 +785,7 @@
def __init__(self, conf, log, **kwargs):
if not kwargs.get('serial'):
self.serial = kwargs.get('imageID'[-20:]) or ''
- VmDevice.__init__(self, conf, log, **kwargs)
+ devices.VmDevice.__init__(self, conf, log, **kwargs)
# Keep sizes as int
self.reqsize = int(kwargs.get('reqsize', '0')) # Backward compatible
self.truesize = int(kwargs.get('truesize', '0'))
@@ -1107,7 +1076,7 @@
return diskelem
-class GraphicsDevice(VmDevice):
+class GraphicsDevice(devices.VmDevice):
__slots__ = ('device', 'port', 'tlsPort')
LIBVIRT_PORT_AUTOSELECT = '-1'
@@ -1212,7 +1181,7 @@
return graphics
-class BalloonDevice(VmDevice):
+class BalloonDevice(devices.VmDevice):
__slots__ = ('address',)
def getXML(self):
@@ -1229,7 +1198,7 @@
return m
-class WatchdogDevice(VmDevice):
+class WatchdogDevice(devices.VmDevice):
__slots__ = ('address',)
def __init__(self, *args, **kwargs):
@@ -1253,7 +1222,7 @@
return m
-class SmartCardDevice(VmDevice):
+class SmartCardDevice(devices.VmDevice):
__slots__ = ('address',)
def getXML(self):
@@ -1272,7 +1241,7 @@
return card
-class TpmDevice(VmDevice):
+class TpmDevice(devices.VmDevice):
__slots__ = ()
def getXML(self):
@@ -1294,7 +1263,7 @@
return tpm
-class RedirDevice(VmDevice):
+class RedirDevice(devices.VmDevice):
__slots__ = ('address',)
def getXML(self):
@@ -1308,7 +1277,7 @@
return self.createXmlElem('redirdev', self.device, ['bus', 'address'])
-class RngDevice(VmDevice):
+class RngDevice(devices.VmDevice):
def getXML(self):
"""
<rng model='virtio'>
@@ -1334,7 +1303,7 @@
return rng
-class ConsoleDevice(VmDevice):
+class ConsoleDevice(devices.VmDevice):
__slots__ = ()
def getXML(self):
@@ -1379,7 +1348,7 @@
(VIDEO_DEVICES, VideoDevice),
(GRAPHICS_DEVICES, GraphicsDevice),
(CONTROLLER_DEVICES, ControllerDevice),
- (GENERAL_DEVICES, GeneralDevice),
+ (GENERAL_DEVICES, devices.GeneralDevice),
(BALLOON_DEVICES, BalloonDevice),
(WATCHDOG_DEVICES, WatchdogDevice),
(CONSOLE_DEVICES, ConsoleDevice),
--
To view, visit http://gerrit.ovirt.org/29250
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I63b602851c17697259e86dfad3a9063447c57e50
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpoledni(a)redhat.com>
9 years, 9 months
Change in vdsm[master]: mount: fix _loopFsSpecsTimestamp global definition
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: mount: fix _loopFsSpecsTimestamp global definition
......................................................................
mount: fix _loopFsSpecsTimestamp global definition
The variable _loopFsSpecsTimestamp should be defined as global before
its first use within a function.
Change-Id: Id844fd830a7ed52196d3dda91664a370ea99938b
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
M vdsm/storage/mount.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/72/32472/1
diff --git a/vdsm/storage/mount.py b/vdsm/storage/mount.py
index 44c3134..fefa5df 100644
--- a/vdsm/storage/mount.py
+++ b/vdsm/storage/mount.py
@@ -86,6 +86,7 @@
def _getLoopFsSpecs():
+ global _loopFsSpecsTimestamp
with _loopFsSpecsLock:
mtabTimestamp = os.stat(_ETC_MTAB_PATH).st_mtime
if _loopFsSpecsTimestamp != mtabTimestamp:
@@ -95,7 +96,6 @@
for opt in entry.fs_mntops:
if opt.startswith('loop='):
_loopFsSpecs[opt[len('loop='):]] = entry.fs_spec
- global _loopFsSpecsTimestamp
_loopFsSpecsTimestamp = mtabTimestamp
return _loopFsSpecs
--
To view, visit http://gerrit.ovirt.org/32472
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id844fd830a7ed52196d3dda91664a370ea99938b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
9 years, 9 months