Change in vdsm[master]: guestIF: Additional object strings filtering
by Vinzenz Feenstra
Vinzenz Feenstra has uploaded a new change for review.
Change subject: guestIF: Additional object strings filtering
......................................................................
guestIF: Additional object strings filtering
Filtering the plain UTF-8 data is not enough. The filter has
to be applied also on the object parsed from json to be really
effective.
Change-Id: Id64438812a19b25b67b8e50c5c56b0d776c4463e
Signed-off-by: Vinzenz Feenstra <vfeenstr(a)redhat.com>
---
M tests/guestIFTests.py
M vdsm/guestIF.py
2 files changed, 40 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/26/14126/1
diff --git a/tests/guestIFTests.py b/tests/guestIFTests.py
index 559a61e..7a392fd 100644
--- a/tests/guestIFTests.py
+++ b/tests/guestIFTests.py
@@ -93,6 +93,28 @@
invalid2 = "\x00"
self.assertEqual('?', guestIF._filterXmlChars(invalid2))
+ def test_filterObject(self):
+ ILLEGAL_DATA = {"foo": "\x00data\x00test"}
+ LEGAL_DATA = {"foo": "?data?test"}
+ EXPECTED_DATA = {"foo": "?data?test"}
+ self.assertEqual(EXPECTED_DATA, guestIF._filterObject(ILLEGAL_DATA))
+ self.assertEqual(EXPECTED_DATA, guestIF._filterObject(LEGAL_DATA))
+
+ def test_StringAndObjectFiltering(self):
+ ILLEGAL_DATA = json.dumps({"foo": "\x00data\x00test"})
+ LEGAL_DATA = json.dumps({"foo": "?data?test"})
+ EXPECTED_DATA = {"foo": "?data?test"}
+
+ filtered = guestIF._filterXmlChars(ILLEGAL_DATA)
+ parsed = json.loads(filtered.decode('utf-8'))
+ filt_obj = guestIF._filterObject(parsed)
+ self.assertEqual(filt_obj, EXPECTED_DATA)
+
+ filtered = guestIF._filterXmlChars(LEGAL_DATA)
+ parsed = json.loads(filtered.decode('utf-8'))
+ filt_obj = guestIF._filterObject(parsed)
+ self.assertEqual(filt_obj, EXPECTED_DATA)
+
def test_handleMessage(self):
logging.TRACE = 5
fakeGuestAgent = guestIF.GuestAgent(None,
diff --git a/vdsm/guestIF.py b/vdsm/guestIF.py
index 47cd9ed..92a9cf2 100644
--- a/vdsm/guestIF.py
+++ b/vdsm/guestIF.py
@@ -50,6 +50,23 @@
return ''.join(maskRestricted(c) for c in u)
+def _filterObject(obj):
+ """
+ Apply _filterXmlChars on every string in the json response object
+ """
+ def filt(o):
+ if isinstance(o, dict):
+ return dict(map(filt, o.iteritems()))
+ elif isinstance(o, list):
+ return map(filt, o)
+ elif isinstance(o, tuple):
+ return tuple(map(filt, o))
+ elif isinstance(o, basestring):
+ return _filterXmlChars(o)
+ return o
+ return filt(obj)
+
+
class MessageState:
NORMAL = 'normal'
TOO_BIG = 'too-big'
@@ -335,6 +352,7 @@
def _parseLine(self, line):
line = _filterXmlChars(line)
args = json.loads(line.decode('utf8'))
+ args = _filterObject(args)
name = args['__name__']
del args['__name__']
return (name, args)
--
To view, visit http://gerrit.ovirt.org/14126
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id64438812a19b25b67b8e50c5c56b0d776c4463e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr(a)redhat.com>
11 years, 1 month
Change in vdsm[master]: Revert "Bond destroying"
by ybronhei@redhat.com
Yaniv Bronhaim has uploaded a new change for review.
Change subject: Revert "Bond destroying"
......................................................................
Revert "Bond destroying"
This reverts commit 1dc2048c852d8e3b0d48b60d264d070f77a8dfa2.
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
Change-Id: Ifcfd325c4c3562ccdde7eaacd072134298bee36d
---
M lib/vdsm/netinfo.py
M lib/vdsm/tool/load_needed_modules.py.in
M vdsm/netconf/ifcfg.py
3 files changed, 6 insertions(+), 10 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/44/14144/1
diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py
index 3ecc483..ded1bfa 100644
--- a/lib/vdsm/netinfo.py
+++ b/lib/vdsm/netinfo.py
@@ -51,8 +51,6 @@
DUMMY_BRIDGE = ';vdsmdummy;'
DEFAULT_MTU = '1500'
-REQUIRED_BONDINGS = frozenset(('bond0', 'bond1', 'bond2', 'bond3', 'bond4'))
-
def _match_nic_name(nic, patterns):
return any(map(lambda p: fnmatch(nic, p), patterns))
diff --git a/lib/vdsm/tool/load_needed_modules.py.in b/lib/vdsm/tool/load_needed_modules.py.in
index c7f1d1a..400ff1f 100644
--- a/lib/vdsm/tool/load_needed_modules.py.in
+++ b/lib/vdsm/tool/load_needed_modules.py.in
@@ -20,7 +20,6 @@
import subprocess
-from vdsm import netinfo
from vdsm.tool import expose
@@ -41,11 +40,13 @@
def _enable_bond_dev():
+ REQUIRED = set(['bond0', 'bond1', 'bond2', 'bond3', 'bond4'])
+ MASTER_FILE = '/sys/class/net/bonding_masters'
+
# @ENGINENAME@ currently assumes that all bonding devices pre-exist
- with open(netinfo.BONDING_MASTERS) as f:
- existing = set(f.read().split())
- for bond in netinfo.REQUIRED_BONDINGS - existing:
- with open(netinfo.BONDING_MASTERS, 'w') as f:
+ existing = set(file(MASTER_FILE).read().split())
+ for bond in REQUIRED - existing:
+ with open(MASTER_FILE, 'w') as f:
f.write('+%s\n' % bond)
diff --git a/vdsm/netconf/ifcfg.py b/vdsm/netconf/ifcfg.py
index ee7c666..0a2f51f 100644
--- a/vdsm/netconf/ifcfg.py
+++ b/vdsm/netconf/ifcfg.py
@@ -577,9 +577,6 @@
def removeBonding(self, bonding):
self._backup(netinfo.NET_CONF_PREF + bonding)
self._removeFile(netinfo.NET_CONF_PREF + bonding)
- if bonding not in netinfo.REQUIRED_BONDINGS:
- with open(netinfo.BONDING_MASTERS, 'w') as f:
- f.write("-%s\n" % bonding)
def removeBridge(self, bridge):
ifdown(bridge)
--
To view, visit http://gerrit.ovirt.org/14144
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifcfd325c4c3562ccdde7eaacd072134298bee36d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
11 years, 1 month
Change in vdsm[master]: fix access to watchdog event actions
by lhornyak@redhat.com
Laszlo Hornyak has uploaded a new change for review.
Change subject: fix access to watchdog event actions
......................................................................
fix access to watchdog event actions
The data structure 'actionEnum' is a a list, but it was accessed as
function.
Change-Id: I3f64b6c6508c23285b9a4a159be7a16cdf64ae9c
Signed-off-by: Laszlo Hornyak <lhornyak(a)redhat.com>
---
M vdsm/libvirtvm.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/34/14134/1
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index bd72e29..a9768a6 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -2435,7 +2435,7 @@
actionEnum = ['ignore', 'pause', 'reset', 'destroy', 'shutdown', 'log']
self._watchdogEvent["time"] = time.time()
- self._watchdogEvent["action"] = actionEnum(action)
+ self._watchdogEvent["action"] = actionEnum[action]
self.log.info("Watchdog event comes from guest %s. "
"Action: %s", self.conf['vmName'],
actionToString(action))
--
To view, visit http://gerrit.ovirt.org/14134
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3f64b6c6508c23285b9a4a159be7a16cdf64ae9c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Laszlo Hornyak <lhornyak(a)redhat.com>
11 years, 1 month
Change in vdsm[master]: Fix vdsm-tool error when importing netinfo
by asegurap@redhat.com
Antoni Segura Puimedon has uploaded a new change for review.
Change subject: Fix vdsm-tool error when importing netinfo
......................................................................
Fix vdsm-tool error when importing netinfo
netinfo is part of lib/vdsm which is supposed to be a python package
without any dependency on the vdsm modules that reside in
/usr/share/vdsm . This patch fixes one of such dependencies by
moving NetinfoErrors to netinfo.py
Change-Id: Id61bb6191c4dad08bf13680906545e0c63dfebfa
Signed-off-by: Antoni S. Puimedon <asegurap(a)redhat.com>
---
M lib/vdsm/netinfo.py
M vdsm/neterrors.py
2 files changed, 3 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/43/14143/1
diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py
index 3ecc483..c890d9e 100644
--- a/lib/vdsm/netinfo.py
+++ b/lib/vdsm/netinfo.py
@@ -35,7 +35,6 @@
import libvirtconnection
import constants
-import neterrors as ne
from config import config
from storage.misc import execCmd
@@ -53,6 +52,8 @@
REQUIRED_BONDINGS = frozenset(('bond0', 'bond1', 'bond2', 'bond3', 'bond4'))
+class NetInfoError(Exception):
+ pass
def _match_nic_name(nic, patterns):
return any(map(lambda p: fnmatch(nic, p), patterns))
@@ -86,7 +87,7 @@
rc, out, err = execCmd([constants.EXT_IPROUTE, '--details',
'link', 'show'], raw=True)
if rc != 0:
- raise ne.NetInfoError(err)
+ raise NetInfoError(err)
interfaces = _parseIpLinkOutput(out)
return Interfaces([nic for nic in interfaces['nic']
diff --git a/vdsm/neterrors.py b/vdsm/neterrors.py
index c2f98af..034414c 100644
--- a/vdsm/neterrors.py
+++ b/vdsm/neterrors.py
@@ -36,7 +36,3 @@
self.errCode = errCode
self.message = message
Exception.__init__(self, self.errCode, self.message)
-
-
-class NetInfoError(Exception):
- pass
--
To view, visit http://gerrit.ovirt.org/14143
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id61bb6191c4dad08bf13680906545e0c63dfebfa
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap(a)redhat.com>
11 years, 1 month
Change in vdsm[master]: Revert "Use 'ip link' to get different kinds of interfaces"
by wudxw@linux.vnet.ibm.com
Mark Wu has uploaded a new change for review.
Change subject: Revert "Use 'ip link' to get different kinds of interfaces"
......................................................................
Revert "Use 'ip link' to get different kinds of interfaces"
This reverts commit 8febe0e40650983d809abaa10be983bc1953ef1e.
The netlink support for bridge is only available on kernel 3.0+.
Please see the following commit for details.
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id...
Add netlink support for bond is also added after kernel 2.6.32.
So this solution doesn't work on RHEL6 system. We have to revert
it.
Change-Id: I9d3f037a9e837fd97cb8808b7bf4b72026ec77c5
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
---
M lib/vdsm/netinfo.py
M tests/Makefile.am
D tests/ip_details_link.out
M tests/netinfoTests.py
M vdsm.spec.in
M vdsm/clientIF.py
M vdsm/neterrors.py
7 files changed, 28 insertions(+), 114 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/57/14157/1
diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py
index 3ecc483..3abe601 100644
--- a/lib/vdsm/netinfo.py
+++ b/lib/vdsm/netinfo.py
@@ -19,7 +19,6 @@
#
import os
-import re
import errno
import glob
import ethtool
@@ -30,14 +29,11 @@
from fnmatch import fnmatch
from xml.dom import minidom
from itertools import chain
-from collections import namedtuple
import libvirtconnection
import constants
-import neterrors as ne
from config import config
-from storage.misc import execCmd
NET_CONF_DIR = '/etc/sysconfig/network-scripts/'
NET_CONF_BACK_DIR = constants.P_VDSM_LIB + 'netconfback/'
@@ -58,61 +54,33 @@
return any(map(lambda p: fnmatch(nic, p), patterns))
-def _parseIpLinkOutput(links):
- interfaces = {'nic': [], 'bond': [], 'vlan': [], 'bridge': [], 'fake': []}
- IP_LINK_RE = re.compile(r'^\d+: (?P<name>\S+):.*\n'
- ' {4}link/(?P<link>\w+).*\n'
- '( {4}(?P<type>\w+))?', re.MULTILINE)
-
- for match in re.finditer(IP_LINK_RE, links):
- name = match.group('name')
- ifaceType = match.group('type')
- link = match.group('link')
- if ifaceType:
- if ifaceType in ('tun', 'dummy'):
- ifaceType = 'fake'
- interfaces[ifaceType].append(name)
- elif link == 'ether':
- interfaces['nic'].append(name)
-
- return interfaces
-
-
-def getInterfaces():
- Interfaces = namedtuple('Interfaces', ('nics, bonds, vlans, bridges'))
+def nics():
+ res = []
hidden_nics = config.get('vars', 'hidden_nics').split(',')
fake_nics = config.get('vars', 'fake_nics').split(',')
- rc, out, err = execCmd([constants.EXT_IPROUTE, '--details',
- 'link', 'show'], raw=True)
- if rc != 0:
- raise ne.NetInfoError(err)
- interfaces = _parseIpLinkOutput(out)
+ for b in glob.glob('/sys/class/net/*'):
+ nic = b.split('/')[-1]
+ if not os.path.exists(os.path.join(b, 'device')):
+ if _match_nic_name(nic, fake_nics):
+ res.append(nic)
+ elif not _match_nic_name(nic, hidden_nics):
+ res.append(nic)
- return Interfaces([nic for nic in interfaces['nic']
- if not _match_nic_name(nic, hidden_nics)] +
- [nic for nic in interfaces['fake']
- if _match_nic_name(nic, fake_nics)],
- interfaces['bond'],
- [vlan.split('@')[0] for vlan in interfaces['vlan']],
- [br for br in interfaces['bridge']
- if br != DUMMY_BRIDGE])
-
-
-def nics():
- return getInterfaces().nics
+ return res
def bondings():
- return getInterfaces().bondings
+ return [b.split('/')[-2] for b in glob.glob('/sys/class/net/*/bonding')]
def vlans():
- return getInterfaces().vlans
+ return [b.split('/')[-1] for b in glob.glob('/sys/class/net/*.*')]
def bridges():
- return getInterfaces().bridges
+ return [b.split('/')[-2] for b in glob.glob('/sys/class/net/*/bridge')
+ if b.split('/')[-2] != DUMMY_BRIDGE]
def networks():
@@ -239,14 +207,13 @@
def graph():
- _, bondings, vlans, bridges = getInterfaces()
- for bridge in bridges:
+ for bridge in bridges():
print bridge
for iface in ports(bridge):
print '\t' + iface
- if iface in vlans:
+ if iface in vlans():
iface = iface.split('.')[0]
- if iface in bondings:
+ if iface in bondings():
for slave in slaves(iface):
print '\t\t' + slave
@@ -254,15 +221,14 @@
def getVlanBondingNic(bridge):
"""Return the (vlan, bonding, nics) tupple that belongs to bridge."""
- _, bondings, vlans, bridges = getInterfaces()
- if bridge not in bridges:
+ if bridge not in bridges():
raise ValueError('unknown bridge %s' % bridge)
vlan = bonding = ''
nics = []
for iface in ports(bridge):
- if iface in vlans:
+ if iface in vlans():
iface, vlan = iface.split('.')
- if iface in bondings:
+ if iface in bondings():
bonding = iface
nics = slaves(iface)
else:
@@ -350,9 +316,9 @@
return d
-def permAddr(bondings):
+def permAddr():
paddr = {}
- for b in bondings:
+ for b in bondings():
slave = ''
for line in file('/proc/net/bonding/' + b):
if line.startswith('Slave Interface: '):
@@ -434,8 +400,7 @@
d = {}
routes = getRoutes()
ipv6routes = getIPv6Routes()
- nics, bondings, vlans, bridges = getInterfaces()
- paddr = permAddr(bondings)
+ paddr = permAddr()
d['networks'] = {}
for net, netAttr in networks().iteritems():
@@ -447,10 +412,10 @@
continue # Do not report missing libvirt networks.
d['bridges'] = dict([_bridgeinfo(bridge, routes, ipv6routes)
- for bridge in bridges])
- d['nics'] = dict([_nicinfo(nic, paddr) for nic in nics])
- d['bondings'] = dict([_bondinfo(bond) for bond in bondings])
- d['vlans'] = dict([_vlaninfo(vlan) for vlan in vlans])
+ for bridge in bridges()])
+ d['nics'] = dict([_nicinfo(nic, paddr) for nic in nics()])
+ d['bondings'] = dict([_bondinfo(bond) for bond in bondings()])
+ d['vlans'] = dict([_vlaninfo(vlan) for vlan in vlans()])
return d
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7a8c204..1038cfb 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -74,7 +74,6 @@
glob_1c60971a-8647-44ac-ae33-6520887f8843.out \
glusterVolumeProfileInfo.xml \
glusterVolumeProfileInfoNfs.xml \
- ip_details_link.out \
lvs_3386c6f2-926f-42c4-839c-38287fac8998.out \
netmaskconversions \
route_info.out \
diff --git a/tests/ip_details_link.out b/tests/ip_details_link.out
deleted file mode 100644
index 3145b6b..0000000
--- a/tests/ip_details_link.out
+++ /dev/null
@@ -1,32 +0,0 @@
-1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN mode DEFAULT
- link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
-2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master ovirtmgmt state UP mode DEFAULT qlen 1000
- link/ether 00:16:3e:e3:68:64 brd ff:ff:ff:ff:ff:ff
-3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000
- link/ether 52:54:00:de:44:dd brd ff:ff:ff:ff:ff:ff
-4: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000
- link/ether 52:54:00:df:89:d9 brd ff:ff:ff:ff:ff:ff
-5: ovirtmgmt: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT
- link/ether 00:16:3e:e3:68:64 brd ff:ff:ff:ff:ff:ff
- bridge
-7: ;vdsmdummy;: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT
- link/ether 92:63:1c:88:31:ef brd ff:ff:ff:ff:ff:ff
- bridge
-8: bond0: <NO-CARRIER,BROADCAST,MULTICAST,MASTER,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT
- link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
- bond
-9: bond4: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noop state DOWN mode DEFAULT
- link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
- bond
-10: eth0.10@eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT
- link/ether 00:16:3e:e3:68:64 brd ff:ff:ff:ff:ff:ff
- vlan id 10 <REORDER_HDR>
-11: eth2.20@eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT
- link/ether 52:54:00:df:89:d9 brd ff:ff:ff:ff:ff:ff
- vlan id 20 <REORDER_HDR>
-12: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master virbr1 state UNKNOWN mode DEFAULT qlen 500
- link/ether fe:16:3e:e3:68:64 brd ff:ff:ff:ff:ff:ff
- tun
-13: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT
- link/ether 22:f8:79:a7:3d:00 brd ff:ff:ff:ff:ff:ff
- dummy
diff --git a/tests/netinfoTests.py b/tests/netinfoTests.py
index fca9547..5e0716e 100644
--- a/tests/netinfoTests.py
+++ b/tests/netinfoTests.py
@@ -85,15 +85,3 @@
def testMatchNicName(self):
self.assertTrue(netinfo._match_nic_name('test1', ['test0', 'test1']))
-
- def testParseIpLinkOutput(self):
- outFile = os.path.join(os.path.dirname(os.path.abspath(__file__)),
- "ip_details_link.out")
- with open(outFile) as f:
- links = f.read()
- interfaces = netinfo._parseIpLinkOutput(links)
- self.assertEqual(interfaces['nic'], ['eth0', 'eth1', 'eth2'])
- self.assertEqual(interfaces['bond'], ['bond0', 'bond4'])
- self.assertEqual(interfaces['vlan'], ['eth0.10@eth0', 'eth2.20@eth2'])
- self.assertEqual(interfaces['bridge'], ['ovirtmgmt', ';vdsmdummy;'])
- self.assertEqual(interfaces['fake'], ['vnet0', 'dummy0'])
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 1966835..644ec59 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -955,7 +955,6 @@
%{_datadir}/%{vdsm_name}/tests/caps_libvirt_amd_6274.out
%{_datadir}/%{vdsm_name}/tests/caps_libvirt_intel_E31220.out
%{_datadir}/%{vdsm_name}/tests/glob_1c60971a-8647-44ac-ae33-6520887f8843.out
-%{_datadir}/%{vdsm_name}/tests/ip_details_link.out
%{_datadir}/%{vdsm_name}/tests/lvs_3386c6f2-926f-42c4-839c-38287fac8998.out
%{_datadir}/%{vdsm_name}/tests/netmaskconversions
%{_datadir}/%{vdsm_name}/tests/run_tests.sh
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index 7b7f5b9..ed7db4b 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -82,8 +82,7 @@
self.gluster = None
try:
self.vmContainer = {}
- nics, bondings, _, _ = netinfo.getInterfaces()
- ifids = nics + bondings
+ ifids = netinfo.nics() + netinfo.bondings()
ifrates = map(netinfo.speed, ifids)
self._hostStats = sampling.HostStatsThread(
cif=self, log=log, ifids=ifids,
diff --git a/vdsm/neterrors.py b/vdsm/neterrors.py
index c2f98af..034414c 100644
--- a/vdsm/neterrors.py
+++ b/vdsm/neterrors.py
@@ -36,7 +36,3 @@
self.errCode = errCode
self.message = message
Exception.__init__(self, self.errCode, self.message)
-
-
-class NetInfoError(Exception):
- pass
--
To view, visit http://gerrit.ovirt.org/14157
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9d3f037a9e837fd97cb8808b7bf4b72026ec77c5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <wudxw(a)linux.vnet.ibm.com>
11 years, 1 month
Change in vdsm[master]: Prefetch domains when connecting a storage server.
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: Prefetch domains when connecting a storage server.
......................................................................
Prefetch domains when connecting a storage server.
When a storage server is connected is searched for domains.
A uuid:findDomain method dictionary is saved for accelerate
further produces.
Related to BZ#912158
Change-Id: I8f2b19a566c659bac30a318d17cef929e0b2575b
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/hsm.py
M vdsm/storage/localFsSD.py
M vdsm/storage/sdc.py
3 files changed, 70 insertions(+), 23 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/69/12869/1
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 179ddd1..c90f681 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -25,6 +25,7 @@
import os
import threading
import logging
+import glob
from fnmatch import fnmatch
from copy import deepcopy
from itertools import imap
@@ -2223,6 +2224,46 @@
vars.task.setDefaultException(se.GetFloppyListError("%s" % spUUID))
return self.getIsoList(spUUID=spUUID, extension='vfd')
+ def __getSDTypefindMethod(self, domType):
+ # TODO: make sd.domain_types a real dictionary and remove this.
+ # Storage Domain Types find methods
+ SDTypeFindMethod = {sd.NFS_DOMAIN: nfsSD.findDomain,
+ sd.FCP_DOMAIN: blockSD.findDomain,
+ sd.ISCSI_DOMAIN: blockSD.findDomain,
+ sd.LOCALFS_DOMAIN: localFsSD.findDomain,
+ sd.POSIXFS_DOMAIN: nfsSD.findDomain,
+ sd.GLUSTERFS_DOMAIN: glusterSD.findDomain}
+ return SDTypeFindMethod.get(domType)
+
+ def __prefetchDomains(self, domType, conObj):
+ uuidPatern = "????????-????-????-????-????????????"
+
+ if domType in (sd.FCP_DOMAIN, sd.ISCSI_DOMAIN):
+ uuids = blockSD.getStorageDomainsList()
+ self.log.debug("block uuids: %s", uuids)
+ elif domType in (sd.NFS_DOMAIN, sd.POSIXFS_DOMAIN):
+ lPath = conObj._mountCon._getLocalPath()
+ self.log.debug("nfs lpath: %s", lPath)
+ uuids = tuple(os.path.basename(d) for d in
+ glob.glob(os.path.join(lPath, uuidPatern)))
+ self.log.debug("nfs uuids: %s", uuids)
+ elif domType is sd.GLUSTERFS_DOMAIN:
+ glusterDomPath = os.path.join(sd.GLUSTERSD_DIR, "*")
+ uuids = tuple(sdUUID for sdUUID, domainPath in
+ nfsSD.fileSD.scanDomains(glusterDomPath))
+ elif domType is sd.LOCALFS_DOMAIN:
+ lPath = conObj._path
+ self.log.debug("local lpath: %s", lPath)
+ uuids = tuple(os.path.basename(d) for d in
+ glob.glob(os.path.join(lPath, uuidPatern)))
+ self.log.debug("local uuids: %s", uuids)
+ else:
+ self.log.warn("domType %s does not support prefetch")
+ uuids = tuple()
+
+ findMethod = self.__getSDTypefindMethod(domType)
+ return dict.fromkeys(uuids, findMethod)
+
@deprecated
@public(logger=logged(printers={'conList': connectionListPrinter}))
def connectStorageServer(self, domType, spUUID, conList, options=None):
@@ -2254,11 +2295,16 @@
try:
self._connectStorageOverIser(conDef, conObj, domType)
conObj.connect()
- status = 0
except Exception as err:
self.log.error(
"Could not connect to storageServer", exc_info=True)
status, _ = self._translateConnectionError(err)
+ else:
+ status = 0
+ doms = self.__prefetchDomains(domType, conObj)
+ sdCache.knownSDs.update(doms)
+
+ self.log.debug("knownSDs: %s", sdCache.knownSDs)
res.append({'id': conDef["id"], 'status': status})
@@ -2481,6 +2527,10 @@
domVersion)
else:
raise se.StorageDomainTypeError(storageType)
+
+ findMethod = self.__getSDTypefindMethod(storageType)
+ sdCache.knownSDs[sdUUID] = findMethod
+ self.log.debug("knownSDs: %s", sdCache.knownSDs)
sdCache.manuallyAddDomain(newSD)
@public
diff --git a/vdsm/storage/localFsSD.py b/vdsm/storage/localFsSD.py
index fac54f9..1066fb5 100644
--- a/vdsm/storage/localFsSD.py
+++ b/vdsm/storage/localFsSD.py
@@ -102,34 +102,13 @@
@staticmethod
def findDomainPath(sdUUID):
for tmpSdUUID, domainPath in fileSD.scanDomains("_*"):
- if tmpSdUUID == sdUUID and isLocalFsDomain(domainPath):
+ if tmpSdUUID == sdUUID:
return domainPath
else:
raise se.StorageDomainDoesNotExist(sdUUID)
def getRealPath(self):
return os.readlink(self.mountpoint)
-
-
-def isLocalFsDomain(domainPath):
- """This ancillary function differentiates local and mounted SD's.
-
- Assumed that a local SD can't be mounted.
- mounted: nfs, posixFS
- local: a link to a local dir in the /rhev/datacenter
- """
- mtab = open("/etc/mtab", "r").readlines()
- for mEntry in mtab:
- mPoint = mEntry.split()[1]
- if mPoint == '/':
- continue
- elif mPoint in domainPath:
- # This is a mounted domain therefore not exists as a local SD.
- isLocal = False
- break
- else:
- isLocal = True
- return isLocal
def findDomain(sdUUID):
diff --git a/vdsm/storage/sdc.py b/vdsm/storage/sdc.py
index 4ead0b5..39e19dd 100644
--- a/vdsm/storage/sdc.py
+++ b/vdsm/storage/sdc.py
@@ -70,6 +70,7 @@
self.__inProgress = set()
self.__staleStatus = self.STORAGE_STALE
self.storage_repo = storage_repo
+ self.knownSDs = {} # {sdUUID: mod.findDomain}
def invalidateStorage(self):
with self._syncroot:
@@ -130,11 +131,28 @@
self._syncroot.notifyAll()
def _findDomain(self, sdUUID):
+ try:
+ findMethod = self.knownSDs[sdUUID]
+ except KeyError:
+ self.log.error("looking for unfetched domain %s", sdUUID)
+ self._findUnfetchedDomain(sdUUID)
+ else:
+ try:
+ dom = findMethod(sdUUID)
+ except se.StorageDomainDoesNotExist:
+ self.log.error("prefetch domain %s not found", sdUUID,
+ exc_info=True)
+ else:
+ return dom
+
+ def _findUnfetchedDomain(self, sdUUID):
import blockSD
import glusterSD
import localFsSD
import nfsSD
+ self.log.error("looking for unfetched domain %s", sdUUID)
+
# The order is somewhat important, it's ordered
# by how quickly get can find the domain. For instance
# if an nfs mount is unavailable we will get stuck
--
To view, visit http://gerrit.ovirt.org/12869
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8f2b19a566c659bac30a318d17cef929e0b2575b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
11 years, 1 month
Change in vdsm[master]: Fix getPools comment.
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: Fix getPools comment.
......................................................................
Fix getPools comment.
Change-Id: Iadfcf0c5d3fb53f3fb0c7aa48f43052bb4a618c9
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/sd.py
1 file changed, 6 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/14/14014/1
diff --git a/vdsm/storage/sd.py b/vdsm/storage/sd.py
index 678e360..445a3ca 100644
--- a/vdsm/storage/sd.py
+++ b/vdsm/storage/sd.py
@@ -434,14 +434,14 @@
def getPools(self):
try:
pools = self.getMetaParam(key=DMDK_POOLS)
- # This is here because someone thought it would be smart
- # to put blank uuids in this field. Remove when you can be
- # sure no old MD will pop up and surprise you
+ except KeyError:
+ pools = []
+ else:
+ # Old pool MD marked SDs not belonging to any pool with
+ # BLANK_UUID as the pool uuid.
if BLANK_UUID in pools:
pools.remove(BLANK_UUID)
- return pools
- except KeyError:
- return []
+ return pools
def getIdsFilePath(self):
return os.path.join(self.getMDPath(), IDS)
--
To view, visit http://gerrit.ovirt.org/14014
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iadfcf0c5d3fb53f3fb0c7aa48f43052bb4a618c9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
11 years, 1 month
Change in vdsm[master]: spec: bump libvirt version for el6
by michal.skrivanek@redhat.com
Michal Skrivanek has uploaded a new change for review.
Change subject: spec: bump libvirt version for el6
......................................................................
spec: bump libvirt version for el6
resolves libvirt stability issues (e.g. BZ #922063)
Change-Id: Icbd9c1a6885b9b7ce9ea58b8be2915bf3bc4f1c6
Signed-off-by: Michal Skrivanek <michal.skrivanek(a)redhat.com>
---
M vdsm.spec.in
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/20/14120/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 7db32b3..1966835 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -123,7 +123,7 @@
# Update the qemu-kvm requires when block_stream will be included
Requires: qemu-kvm >= 2:0.12.1.2-2.295.el6_3.4
Requires: qemu-img >= 2:0.12.1.2-2.295.el6_3.4
-Requires: libvirt >= 0.10.2-18.el6_4.2
+Requires: libvirt >= 0.10.2-18.el6_4.4
Requires: iscsi-initiator-utils >= 6.2.0.872-15
Requires: device-mapper-multipath >= 0.4.9-52
Requires: e2fsprogs >= 1.41.12-11
--
To view, visit http://gerrit.ovirt.org/14120
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icbd9c1a6885b9b7ce9ea58b8be2915bf3bc4f1c6
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Michal Skrivanek <michal.skrivanek(a)redhat.com>
11 years, 1 month