Federico Simoncelli has uploaded a new change for review.
Change subject: gluster: fix volume name parsing in getVmVolumeInfo
......................................................................
gluster: fix volume name parsing in getVmVolumeInfo
It is permitted to use slashes '/' in gluster mount strings even
though they're prohibited in the volume name.
In order to recognize and strip them out we should use getRealPath
instead of getRemotePath that translates slashes into permitted
underscores.
It is now allowed to mount gluster volumes with slashes (serv:/volume)
and correctly identifying the volume name and its information.
Change-Id: Icfdbc573ec2aec31b78323253f8178425a07302c
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
M vdsm/storage/glusterVolume.py
1 file changed, 3 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/37/36237/1
diff --git a/vdsm/storage/glusterVolume.py b/vdsm/storage/glusterVolume.py
index 647b1ec..8f701ba 100644
--- a/vdsm/storage/glusterVolume.py
+++ b/vdsm/storage/glusterVolume.py
@@ -19,10 +19,9 @@
"""
Send info to represent Gluster volume as a network block device
"""
- rpath = sdCache.produce(self.sdUUID).getRemotePath()
- rpath_list = rpath.rsplit(":", 1)
- volfileServer = rpath_list[0]
- volname = rpath_list[1]
+ rpath = sdCache.produce(self.sdUUID).getRealPath()
+ volfileServer, volname = rpath.rsplit(":", 1)
+ volname = volname.strip('/')
# Volume transport to Libvirt transport mapping
VOLUME_TRANS_MAP = {'TCP': 'tcp', 'RDMA': 'rdma'}
--
To view, visit http://gerrit.ovirt.org/36237
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icfdbc573ec2aec31b78323253f8178425a07302c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
Ido Barkan has uploaded a new change for review.
Change subject: network: wait for all udev events after configuring SRIOV
......................................................................
network: wait for all udev events after configuring SRIOV
After changing the number of virtual functions on an SRIOV device
udev asynchronously adds them and then renames them from 'eth0'
according to it's naming policy. Since that process is asynchronous
and might take time, we have to wait for it to finish since
subsequent reporting of hardware by vdsm must return a stable state.
Change-Id: I04d63ca35aab585051c3d0a5f2652dbf2f91b080
Signed-off-by: Ido Barkan <ibarkan(a)redhat.com>
---
M vdsm/network/api.py
1 file changed, 6 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/00/40400/1
diff --git a/vdsm/network/api.py b/vdsm/network/api.py
index 2d31adc..eae43b3 100755
--- a/vdsm/network/api.py
+++ b/vdsm/network/api.py
@@ -32,6 +32,7 @@
from vdsm import netinfo
from vdsm import utils
from vdsm import ipwrapper
+from vdsm import udevadm
from .configurators import libvirt
from .errors import ConfigNetworkError
@@ -538,6 +539,11 @@
# https://www.kernel.org/doc/Documentation/PCI/pci-iov-howto.txt
f.write('0')
f.write(str(num_vfs))
+ # This is a blocking call that should wait for all udev events to be
+ # handled. Since those include renaming devices, we should wait until
+ # udev finishes in order to report a stable hardware state in
+ # subsequent engine calls.
+ udevadm.settle(timeout=10)
def _persist_num_vfs(device_name, numvfs):
--
To view, visit https://gerrit.ovirt.org/40400
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I04d63ca35aab585051c3d0a5f2652dbf2f91b080
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ido Barkan <ibarkan(a)redhat.com>
Ido Barkan has uploaded a new change for review.
Change subject: network: restore sriov devices number of vfs
......................................................................
network: restore sriov devices number of vfs
vdsm-restore-net-config will attempt to restore the number of vfs
from the last successful change. If no sriov devices are found the
function only tries to collect garbage. This is done before network
restoration so that networks can be configured based on the
restored vfs.
The patch also introduces a 'safe' changing of number of vfs of an
sriov card which also checks if the connectivity to the engine was
lost as a consequence.
Change-Id: I76b898019840ffe65939ffad4a1e98829ad3c887
Signed-off-by: Ido Barkan <ibarkan(a)redhat.com>
---
M vdsm/network/api.py
M vdsm/vdsm-restore-net-config
2 files changed, 85 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/88/40088/1
diff --git a/vdsm/network/api.py b/vdsm/network/api.py
index bc2dbd2..07f2640 100755
--- a/vdsm/network/api.py
+++ b/vdsm/network/api.py
@@ -40,6 +40,7 @@
import hooks # TODO: Turn into parent package import when vdsm is a package
CONNECTIVITY_TIMEOUT_DEFAULT = 4
+_SYSFS_SRIOV_NUMVFS = '/sys/bus/pci/devices/{}/sriov_numvfs'
def _getConfiguratorClass():
@@ -541,17 +542,51 @@
'connectivity check failed')
-def changeNumvfs(device_name, numvfs):
- with open('/sys/bus/pci/devices/{}/sriov_numvfs'.format(
- device_name), 'w', 0) as f:
+def _update_num_vfs(device_name, num_vfs):
+ with open(_SYSFS_SRIOV_NUMVFS.format(device_name), 'w', 0) as f:
# Zero needs to be written first in order to remove previous VFs.
# Trying to just write the number (if n > 0 VF's existed before)
# results in 'write error: Device or resource busy'
# https://www.kernel.org/doc/Documentation/PCI/pci-iov-howto.txt
f.write('0')
+ f.write(str(num_vfs))
+
+
+def _persist_num_vfs(device_name, numvfs):
+ dir_path = os.path.join(constants.P_VDSM_LIB, 'virtual_functions')
+ try:
+ os.makedirs(dir_path)
+ except OSError as ose:
+ if errno.EEXIST != ose.errno:
+ raise
+ with open(dir_path, device_name, 'w') as f:
f.write(str(numvfs))
+def changeNumvfs(device_name, num_vfs):
+ """Change number of virtual functions of a device in a 'safe' way. If the
+ connectivity to engine is lost as a consequence, the value is restored.
+ Since calling this verb is currently blocked by engine if this device is
+ already in use, the logic does not attempt to do anything further, such as
+ restoring possibly lost networks.
+ The persistence is stored in a place which is writable also in ovirt-node.
+ Garbage is will be collected during restoration.
+ """
+ original_value = _get_num_vfs(device_name)
+ _update_num_vfs(device_name, num_vfs)
+ if not clientSeen():
+ _update_num_vfs(device_name, original_value)
+ raise ConfigNetworkError(
+ ne.ERR_LOST_CONNECTION, 'connectivity check failed')
+
+ _persist_num_vfs(device_name, num_vfs)
+
+
+def _get_num_vfs(device_name):
+ with open(_SYSFS_SRIOV_NUMVFS.format(device_name), 'r', 0) as f:
+ return int(f.read())
+
+
def _validateNetworkSetup(networks, bondings):
for network, networkAttrs in networks.iteritems():
if networkAttrs.get('remove', False):
diff --git a/vdsm/vdsm-restore-net-config b/vdsm/vdsm-restore-net-config
index 21d6592..afe4abd 100755
--- a/vdsm/vdsm-restore-net-config
+++ b/vdsm/vdsm-restore-net-config
@@ -27,21 +27,64 @@
from vdsm.config import config
from vdsm import netinfo
-from vdsm.constants import P_VDSM_RUN
+from vdsm.constants import P_VDSM_RUN, P_VDSM_LIB
+import hostdev
# Ifcfg persistence restoration
from network.configurators import ifcfg
# Unified persistence restoration
-from network.api import setupNetworks
+from network.api import setupNetworks, changeNumvfs
from network import configurators
from vdsm.netconfpersistence import RunningConfig, PersistentConfig
import pkgutil
_NETS_RESTORED_MARK = os.path.join(P_VDSM_RUN, 'nets_restored')
+_VIRTUAL_FUNCTIONS_PATH = os.path.join(P_VDSM_LIB, 'virtual_functions')
+
+
+def _get_sriov_devices():
+ devices = hostdev.list_by_caps()
+ sriov_pci_addrs = [addr for addr, device in devices.iteritems()
+ if 'totalvfs' in device['params']]
+ net_devs = [device for device in devices.itervalues()
+ if device['params']['capability'] == 'net']
+ return [device['params']['interface'] for device in net_devs
+ if device['params']['parent'] in sriov_pci_addrs]
+
+
+def _get_persisted_numvfs(existing_sriov_devices):
+ num_vfs_by_device = {}
+ missing_devices = []
+ for file_name in os.listdir(_VIRTUAL_FUNCTIONS_PATH):
+ if file_name not in existing_sriov_devices:
+ missing_devices.append(file_name)
+ else:
+ with open(os.path.join(
+ _VIRTUAL_FUNCTIONS_PATH, file_name), 'r') as f:
+ num_vfs_by_device[file_name] = int(f.read().strip())
+
+ return num_vfs_by_device, missing_devices
+
+
+def _remove_missing_devices_persistence(missing_devices):
+ for file_name in missing_devices:
+ os.remove(os.path.join(_VIRTUAL_FUNCTIONS_PATH, file_name))
+
+
+def _restore_sriov_num_vfs():
+ sriov_devices = _get_sriov_devices()
+ persisted_num_vfs, missing_devices = _get_persisted_numvfs(sriov_devices)
+
+ for device in sriov_devices:
+ changeNumvfs(device, persisted_num_vfs[device])
+
+ _remove_missing_devices_persistence(missing_devices)
def ifcfg_restoration():
+ _restore_sriov_num_vfs()
+
configWriter = ifcfg.ConfigWriter()
configWriter.restorePersistentBackup()
@@ -51,6 +94,8 @@
Builds a setupNetworks command from the persistent configuration to set it
as running configuration.
"""
+ _restore_sriov_num_vfs()
+
runningConfig = RunningConfig()
removeNetworks = {}
removeBonds = {}
--
To view, visit https://gerrit.ovirt.org/40088
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I76b898019840ffe65939ffad4a1e98829ad3c887
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ido Barkan <ibarkan(a)redhat.com>
Simone Tiraboschi has uploaded a new change for review.
Change subject: packaging: debian: making code compatible with upstream M2Crypto
......................................................................
packaging: debian: making code compatible with upstream M2Crypto
Upstream M2Crypto still doesn't provide settimeout method in the
M2Crypto.SSL.Connection class:
https://github.com/M2Crypto/M2Crypto/blob/master/M2Crypto/SSL/Connection.py
The method is indeed just a wrapper of the same method on the
internal socket object.
Using the method on the external class if available otherwise
fall back and directly use it on the socket object.
Change-Id: Id1808bc9e27dde72b018c3be413f5b2066127982
Signed-off-by: Simone Tiraboschi <stirabos(a)redhat.com>
---
M lib/vdsm/sslutils.py
1 file changed, 7 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/46/37746/1
diff --git a/lib/vdsm/sslutils.py b/lib/vdsm/sslutils.py
index 74555ee..4f2d4f5 100644
--- a/lib/vdsm/sslutils.py
+++ b/lib/vdsm/sslutils.py
@@ -118,11 +118,14 @@
client = SSL.Connection(self.context, client)
client.addr = address
try:
- client.setup_ssl()
- client.set_accept_state()
- client.settimeout(self.accept_timeout)
+ settimeout = getattr(
+ client,
+ 'settimeout',
+ client.socket.settimeout
+ )
+ settimeout(self.accept_timeout)
client.accept_ssl()
- client.settimeout(None)
+ settimeout(None)
except SSL.SSLError as e:
raise SSL.SSLError("%s, client %s" % (e, address[0]))
--
To view, visit http://gerrit.ovirt.org/37746
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id1808bc9e27dde72b018c3be413f5b2066127982
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Simone Tiraboschi <stirabos(a)redhat.com>