Change in vdsm[master]: virt: vmstats: never raise if stat is missing.
by Code Review
From Dan Kenigsberg <danken(a)redhat.com>:
Dan Kenigsberg has posted comments on this change.
Change subject: virt: vmstats: never raise if stat is missing.
......................................................................
Patch Set 4: Code-Review+2
I hate this exception swallowing, but I give up being holly.
--
To view, visit https://gerrit.ovirt.org/77995
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib7f19fe26151fbc4d9fe6ff9c83ca3db77ff6e25
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek(a)redhat.com>
Gerrit-Reviewer: Milan Zamazal <mzamazal(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
Gerrit-HasComments: No
6 years, 10 months
Change in vdsm[ovirt-4.1]: net,static: Configure NM with slaves-order=name
by Code Review
From Dan Kenigsberg <danken(a)redhat.com>:
Dan Kenigsberg has submitted this change and it was merged.
Change subject: net,static: Configure NM with slaves-order=name
......................................................................
net,static: Configure NM with slaves-order=name
NM by default, adds bond slaves based on their index.
In order to be consistent with initscripts ordering, the order is
changed to follow the slaves names instead of the index.
Note: This solution is available from NM version 1.8, part of RHEL 7.4
and Fedora 26.
Change-Id: Ic0e0c740ae8284b9843f114c215d5dad62996837
Bug-Url: https://bugzilla.redhat.com/1463218
Signed-off-by: Edward Haas <edwardh(a)redhat.com>
---
M static/Makefile.am
A static/etc/NetworkManager/conf.d/vdsm.conf
M vdsm.spec.in
3 files changed, 15 insertions(+), 0 deletions(-)
Approvals:
Jenkins CI: Passed CI tests
Dan Kenigsberg: Looks good to me, approved
Edward Haas: Verified
--
To view, visit https://gerrit.ovirt.org/78362
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic0e0c740ae8284b9843f114c215d5dad62996837
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-4.1
Gerrit-Owner: Edward Haas <edwardh(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Edward Haas <edwardh(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Petr Horáček <phoracek(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
6 years, 10 months
Change in vdsm[master]: dockerfile: Add missing glusterfs-api package
by Code Review
From Dan Kenigsberg <danken(a)redhat.com>:
Dan Kenigsberg has submitted this change and it was merged.
Change subject: dockerfile: Add missing glusterfs-api package
......................................................................
dockerfile: Add missing glusterfs-api package
This package is required for vdsm.gluster.gfapi module. Importing this
module during imports tests fail on Fedora 25 becuase libgfapi is not
installed in this image. For some reason, this library is included in
the Fedora 24 and Centos 7 image.
Add the library to all dockerfiles to make sure the library exists even
if the base image is modified in the future.
Change-Id: Ieaf94a2d3a94cb6693893db8de70063ad1503510
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M docker/Dockerfile.centos
M docker/Dockerfile.fedora.24
M docker/Dockerfile.fedora.25
3 files changed, 3 insertions(+), 0 deletions(-)
Approvals:
Nir Soffer: Verified
Jenkins CI: Passed CI tests
Dan Kenigsberg: Looks good to me, approved
Sahina Bose: Looks good to me, but someone else must approve
--
To view, visit https://gerrit.ovirt.org/76744
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ieaf94a2d3a94cb6693893db8de70063ad1503510
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Sahina Bose <sabose(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
6 years, 10 months
Change in vdsm[master]: dockerfile: Add missing glusterfs-api package
by Code Review
From Dan Kenigsberg <danken(a)redhat.com>:
Dan Kenigsberg has posted comments on this change.
Change subject: dockerfile: Add missing glusterfs-api package
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit https://gerrit.ovirt.org/76744
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ieaf94a2d3a94cb6693893db8de70063ad1503510
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Sahina Bose <sabose(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
Gerrit-HasComments: No
6 years, 10 months
Change in vdsm[master]: spec: make sure infra package is deleted on upgrade
by Code Review
From Yaniv Bronhaim <ybronhei(a)redhat.com>:
Yaniv Bronhaim has posted comments on this change.
Change subject: spec: make sure infra package is deleted on upgrade
......................................................................
Patch Set 2:
(1 comment)
https://gerrit.ovirt.org/#/c/78357/2/vdsm.spec.in
File vdsm.spec.in:
Line 119: Requires: safelease >= 1.0-7
Line 120: Requires: mom >= 0.5.8
Line 121: Requires(pre): shadow-utils
Line 122:
Line 123: Obsoletes: %{name}-infra <= %{version}-%{release}
> why would we have vdsm-infra in 4.19? isn't <=4.18 enough?
so seems like < 4.19 is the right thing to do iiuc.. I prefer to be explicit in the spec. since 4.19 you shouldn't see vdsm-infra
Line 124:
Line 125: %if 0%{?with_openvswitch}
Line 126: Requires: openvswitch >= 2.0.0
Line 127: %endif
--
To view, visit https://gerrit.ovirt.org/78357
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I8c975bffe713b716dfa9a8bc1bbee6d9a24fb144
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Irit Goihman <igoihman(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Irit Goihman <igoihman(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
Gerrit-HasComments: Yes
6 years, 10 months
Change in vdsm[master]: py3: fix v2v and its test
by Code Review
From Dan Kenigsberg <danken(a)redhat.com>:
Dan Kenigsberg has uploaded a new change for review.
Change subject: py3: fix v2v and its test
......................................................................
py3: fix v2v and its test
Change-Id: I1a7d26d8731ccd1e03687fa6ab772f165cb9f523
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M lib/vdsm/v2v.py
M tests/Makefile.am
M tests/v2v_test.py
M tests/v2v_testlib.py
4 files changed, 27 insertions(+), 28 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/14/78414/1
diff --git a/lib/vdsm/v2v.py b/lib/vdsm/v2v.py
index eedcf6d..9d98886 100644
--- a/lib/vdsm/v2v.py
+++ b/lib/vdsm/v2v.py
@@ -74,7 +74,7 @@
_XEN_SSH_PROTOCOL = 'xen+ssh'
_VMWARE_PROTOCOL = 'vpx'
_KVM_PROTOCOL = 'qemu'
-_SSH_AUTH_RE = '(SSH_AUTH_SOCK)=([^;]+).*;\nSSH_AGENT_PID=(\d+)'
+_SSH_AUTH_RE = b'(SSH_AUTH_SOCK)=([^;]+).*;\nSSH_AGENT_PID=(\d+)'
_OVF_RESOURCE_CPU = 3
_OVF_RESOURCE_MEMORY = 4
_OVF_RESOURCE_NETWORK = 10
@@ -525,9 +525,9 @@
fd = os.open(self._passwd_file, os.O_WRONLY | os.O_CREAT, 0o600)
try:
if self._password.value is None:
- os.write(fd, "")
+ os.write(fd, b"")
else:
- os.write(fd, self._password.value)
+ os.write(fd, self._password.value.encode())
finally:
os.close(fd)
try:
@@ -940,12 +940,12 @@
class OutputParser(object):
- COPY_DISK_RE = re.compile(r'.*(Copying disk (\d+)/(\d+)).*')
- DISK_PROGRESS_RE = re.compile(r'\s+\((\d+).*')
+ COPY_DISK_RE = re.compile(br'.*(Copying disk (\d+)/(\d+)).*')
+ DISK_PROGRESS_RE = re.compile(br'\s+\((\d+).*')
def parse(self, stream):
for line in stream:
- if 'Copying disk' in line:
+ if b'Copying disk' in line:
description, current_disk, disk_count = self._parse_line(line)
yield ImportProgress(int(current_disk), int(disk_count),
description)
@@ -964,15 +964,15 @@
return m.group(1), m.group(2), m.group(3)
def _iter_progress(self, stream):
- chunk = ''
+ chunk = b''
while True:
c = stream.read(1)
if not c:
raise OutputParserError('copy-disk stream closed unexpectedly')
chunk += c
- if c == '\r':
+ if c == b'\r':
yield chunk
- chunk = ''
+ chunk = b''
def _parse_progress(self, chunk):
m = self.DISK_PROGRESS_RE.match(chunk)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7fe8571..edb9975 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -242,7 +242,6 @@
storage_workarounds_test.py \
unicode_test.py \
utils_test.py \
- v2v_test.py \
vmapi_test.py \
vmmigration_test.py \
vmoperations_test.py \
diff --git a/tests/v2v_test.py b/tests/v2v_test.py
index 2d44945..5f438de 100644
--- a/tests/v2v_test.py
+++ b/tests/v2v_test.py
@@ -18,7 +18,7 @@
#
from contextlib import contextmanager
-from io import StringIO
+import io
import subprocess
import tarfile
import uuid
@@ -41,7 +41,7 @@
from testlib import VdsmTestCase as TestCaseBase, recorded
from monkeypatch import MonkeyPatch, MonkeyPatchScope
-import vmfakelib as fake
+import vmfakecon as fake
FAKE_VIRT_V2V = CommandPath('fake-virt-v2v',
@@ -85,7 +85,7 @@
def read_ovf(ovf_path):
- return """<?xml version="1.0" encoding="UTF-8"?>
+ return u"""<?xml version="1.0" encoding="UTF-8"?>
<Envelope xmlns="http://schemas.dmtf.org/ovf/envelope/1"
xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_Re\
@@ -129,7 +129,7 @@
ovapath = os.path.join(base, 'testvm.ova')
ovf = read_ovf('test')
- with open(ovfpath, 'w') as ovffile:
+ with io.open(ovfpath, 'w') as ovffile:
ovffile.write(ovf)
yield ovapath
@@ -319,7 +319,7 @@
u'[ 256.0] Finishing off')
parser = v2v.OutputParser()
- events = list(parser.parse(StringIO(output)))
+ events = list(parser.parse(io.StringIO(output)))
self.assertEqual(events, [
(v2v.ImportProgress(1, 2, 'Copying disk 1/2')),
(v2v.DiskProgress(0)),
@@ -458,10 +458,10 @@
rc, output, error = execCmd(cmd, raw=True)
self.assertEqual(rc, 0)
- with open('fake-virt-v2v.out', 'r') as f:
+ with io.open('fake-virt-v2v.out', 'rb') as f:
self.assertEqual(output, f.read())
- with open('fake-virt-v2v.err', 'r') as f:
+ with io.open('fake-virt-v2v.err', 'rb') as f:
self.assertEqual(error, f.read())
@MonkeyPatch(v2v, '_VIRT_V2V', FAKE_VIRT_V2V)
@@ -486,25 +486,25 @@
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
msg = "test\ntest"
- p.stdin.write(msg)
+ p.stdin.write(msg.encode())
p.stdin.close()
p.wait()
out = p.stdout.read()
- self.assertEqual(out, msg)
+ self.assertEqual(out, msg.encode())
p = v2v._simple_exec_cmd(['/bin/sh', '-c', 'echo -en "%s" >&2' % msg],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
p.wait()
out = p.stdout.read()
- self.assertEqual(out, msg)
+ self.assertEqual(out, msg.encode())
@MonkeyPatch(v2v, '_VIRT_V2V', FAKE_VIRT_V2V)
def testV2VCapabilities(self):
cmd = v2v.V2VCommand({}, None, None)
- self.assertIn('virt-v2v', cmd._v2v_caps)
- self.assertIn('input:libvirt', cmd._v2v_caps)
- self.assertIn('output:vdsm', cmd._v2v_caps)
+ self.assertIn(b'virt-v2v', cmd._v2v_caps)
+ self.assertIn(b'input:libvirt', cmd._v2v_caps)
+ self.assertIn(b'output:vdsm', cmd._v2v_caps)
@MonkeyPatch(v2v, '_VIRT_V2V', FAKE_VIRT_V2V)
def testQcow2Compat(self):
@@ -514,7 +514,7 @@
# Make sure vdsm-compat capability is supported
cmd = v2v.V2VCommand({}, None, None)
- self.assertIn('vdsm-compat-option', cmd._v2v_caps)
+ self.assertIn(b'vdsm-compat-option', cmd._v2v_caps)
# Look for the command line argument
cmd = v2v.V2VCommand({'qcow2_compat': '1.1'}, None, None)
@@ -544,7 +544,7 @@
self.assertEqual(ret, True)
out = p.stdout.read()
- self.assertEqual(out, msg)
+ self.assertEqual(out, msg.encode())
@permutations([
# (cmd1, cmd2, returncode)
@@ -647,7 +647,7 @@
ovapath = os.path.join(base, 'testvm.ova')
ovf = read_ovf('test')
- with open(ovfpath, 'w') as ovffile:
+ with io.open(ovfpath, 'w') as ovffile:
ovffile.write(ovf)
yield base, ovfpath, ovapath
diff --git a/tests/v2v_testlib.py b/tests/v2v_testlib.py
index 0436b9a..579a9d5 100644
--- a/tests/v2v_testlib.py
+++ b/tests/v2v_testlib.py
@@ -22,7 +22,7 @@
import libvirt
import uuid
-import vmfakelib as fake
+import vmfakecon as fake
VmSpec = namedtuple('VmSpec',
['name', 'uuid', 'id', 'active', 'has_snapshots'])
@@ -51,7 +51,7 @@
class FakeVolume(object):
def __init__(self):
- self._bytes = BytesIO('x' * 1024)
+ self._bytes = BytesIO(b'x' * 1024)
def info(self):
# type, capacity, allocation
--
To view, visit https://gerrit.ovirt.org/78414
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1a7d26d8731ccd1e03687fa6ab772f165cb9f523
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
6 years, 10 months
Change in vdsm[master]: py3: use next() builting instead of deprecated method
by Code Review
From Dan Kenigsberg <danken(a)redhat.com>:
Dan Kenigsberg has uploaded a new change for review.
Change subject: py3: use next() builting instead of deprecated method
......................................................................
py3: use next() builting instead of deprecated method
Change-Id: I95d4dea51fc6e9ec21ea88c47cc18750cdfa9ac3
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M lib/vdsm/network/tc/__init__.py
M lib/vdsm/osinfo.py
M tests/stompasyncdispatcher_test.py
M tests/storage_misc_test.py
M vdsm_hooks/fakevmstats/after_get_all_vm_stats.py
M vdsm_hooks/smbios/before_vm_start.py
6 files changed, 16 insertions(+), 16 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/46/78346/1
diff --git a/lib/vdsm/network/tc/__init__.py b/lib/vdsm/network/tc/__init__.py
index 3f22064..bbdc5f7 100644
--- a/lib/vdsm/network/tc/__init__.py
+++ b/lib/vdsm/network/tc/__init__.py
@@ -79,7 +79,7 @@
_addTarget(network, QDISC_INGRESS, target)
qdisc.replace(network, 'prio', parent=None)
- qdisc_id = _qdiscs_of_device(network).next()
+ qdisc_id = next(_qdiscs_of_device(network))
_addTarget(network, qdisc_id, target)
ipwrapper.getLink(network).promisc = True
@@ -98,7 +98,7 @@
'''
acts = _delTarget(network, QDISC_INGRESS, target)
try:
- qdisc_id = _qdiscs_of_device(network).next()
+ qdisc_id = next(_qdiscs_of_device(network))
acts += _delTarget(network, qdisc_id, target)
except StopIteration:
pass
diff --git a/lib/vdsm/osinfo.py b/lib/vdsm/osinfo.py
index 2b130d8..440987e 100644
--- a/lib/vdsm/osinfo.py
+++ b/lib/vdsm/osinfo.py
@@ -269,8 +269,8 @@
for pkg, names in KEY_PACKAGES.iteritems():
try:
- mi = itertools.chain(*[ts.dbMatch('name', name)
- for name in names]).next()
+ mi = next(itertools.chain(
+ *[ts.dbMatch('name', name) for name in names]))
except StopIteration:
logging.debug("rpm package %s not found",
KEY_PACKAGES[pkg])
diff --git a/tests/stompasyncdispatcher_test.py b/tests/stompasyncdispatcher_test.py
index ea95355..1838b77 100644
--- a/tests/stompasyncdispatcher_test.py
+++ b/tests/stompasyncdispatcher_test.py
@@ -79,9 +79,9 @@
self._chain = itertools.chain(list)
def get_fake_time(self):
- next = self._chain.next()
- print(next)
- return next
+ next_time = next(self._chain)
+ print(next_time)
+ return next_time
class AsyncDispatcherTest(TestCaseBase):
diff --git a/tests/storage_misc_test.py b/tests/storage_misc_test.py
index da928db..53e60a9 100644
--- a/tests/storage_misc_test.py
+++ b/tests/storage_misc_test.py
@@ -197,7 +197,7 @@
def testInvalidITMapParams(self):
data = 1
- self.assertRaises(ValueError, misc.itmap(int, data, 0).next)
+ self.assertRaises(ValueError, lambda: next(misc.itmap(int, data, 0)))
class ParseHumanReadableSize(TestCaseBase):
diff --git a/vdsm_hooks/fakevmstats/after_get_all_vm_stats.py b/vdsm_hooks/fakevmstats/after_get_all_vm_stats.py
index ebba2a1..e6f9250 100644
--- a/vdsm_hooks/fakevmstats/after_get_all_vm_stats.py
+++ b/vdsm_hooks/fakevmstats/after_get_all_vm_stats.py
@@ -158,19 +158,19 @@
diskUsage.append(createDiskUsage('/boot', 'ext4', 1 * GB))
diskUsage.append(createDiskUsage('/home', 'ext4', 50 * GB))
# Add guest-specific number of extra mounts
- for i in range(vmDigest.next() % MAX_DYNAMIC_MOUNTS):
+ for i in range(next(vmDigest) % MAX_DYNAMIC_MOUNTS):
diskUsage.append(createDiskUsage('/mount/dynamic-%d' % i, 'ext4',
- vmDigest.next() * GB))
+ next(vmDigest) * GB))
stats['diskUsage'] = diskUsage
# Each vm between 1 to 3 ifaces, not dynamic:
netIfaces = []
- for i in range(1 + (vmDigest.next() % 3)):
+ for i in range(1 + (next(vmDigest) % 3)):
netif = {}
- hw = map(lambda x: vmDigest.next(), range(6))
+ hw = map(lambda x: next(vmDigest), range(6))
netif['hw'] = ETH_HW_ADDR_FORMAT % (hw[0], hw[1], hw[2], hw[3], hw[4],
hw[5])
- inet = map(lambda x: vmDigest.next(), range(4))
+ inet = map(lambda x: next(vmDigest), range(4))
netif['inet'] = ['%d.%d.%d.%d' % (inet[0], inet[1], inet[2], inet[3])]
# For simplicty purposes, the ipv6 addresses are transition from ipv4
netif['inet6'] = ['0:0:0:0:0:ffff:%x%02x:%x%02x' % (inet[0], inet[1],
diff --git a/vdsm_hooks/smbios/before_vm_start.py b/vdsm_hooks/smbios/before_vm_start.py
index f46cdae..14abbeb 100755
--- a/vdsm_hooks/smbios/before_vm_start.py
+++ b/vdsm_hooks/smbios/before_vm_start.py
@@ -38,7 +38,7 @@
break
if not updated:
- name = entry.iterkeys().next()
+ name = next(entry.iterkeys())
e = domxml.createElement('entry')
e.setAttribute('name', name)
txt = domxml.createTextNode(entry[name])
@@ -65,7 +65,7 @@
break
if not updated:
- name = entry.iterkeys().next()
+ name = next(entry.iterkeys())
e = domxml.createElement('entry')
e.setAttribute('name', name)
txt = domxml.createTextNode(entry[name])
@@ -94,7 +94,7 @@
for d in data.split('^'):
# convert string to dictionary
entry = ast.literal_eval(d)
- name = entry.iterkeys().next()
+ name = next(entry.iterkeys())
if name in bios_entries:
addBiosEntry(domxml, sysinfo, entry)
else:
--
To view, visit https://gerrit.ovirt.org/78346
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I95d4dea51fc6e9ec21ea88c47cc18750cdfa9ac3
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
6 years, 10 months
Change in vdsm[master]: storage: move storageServer to lib/vdsm
by Code Review
From Dan Kenigsberg <danken(a)redhat.com>:
Dan Kenigsberg has uploaded a new change for review.
Change subject: storage: move storageServer to lib/vdsm
......................................................................
storage: move storageServer to lib/vdsm
Change-Id: I0fba9e9da91354a2e28fdf0ce754836ae61c7094
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M lib/vdsm/storage/Makefile.am
R lib/vdsm/storage/storageServer.py
M tests/storage_storageserver_test.py
M vdsm.spec.in
M vdsm/storage/Makefile.am
M vdsm/storage/hsm.py
6 files changed, 10 insertions(+), 8 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/16/73116/1
diff --git a/lib/vdsm/storage/Makefile.am b/lib/vdsm/storage/Makefile.am
index 47bb7fb..096d903 100644
--- a/lib/vdsm/storage/Makefile.am
+++ b/lib/vdsm/storage/Makefile.am
@@ -52,6 +52,7 @@
resourceManager.py \
rwlock.py \
securable.py \
+ storageServer.py \
task.py \
taskManager.py \
threadPool.py \
diff --git a/vdsm/storage/storageServer.py b/lib/vdsm/storage/storageServer.py
similarity index 99%
rename from vdsm/storage/storageServer.py
rename to lib/vdsm/storage/storageServer.py
index 28c93d1..e6e80d4 100644
--- a/vdsm/storage/storageServer.py
+++ b/lib/vdsm/storage/storageServer.py
@@ -17,6 +17,7 @@
#
# Refer to the README and COPYING files for full details of the license
#
+from __future__ import absolute_import
import errno
import logging
diff --git a/tests/storage_storageserver_test.py b/tests/storage_storageserver_test.py
index ce0a8e7..40fba98 100644
--- a/tests/storage_storageserver_test.py
+++ b/tests/storage_storageserver_test.py
@@ -21,13 +21,13 @@
from monkeypatch import MonkeyPatch
from testlib import permutations, expandPermutations
from testlib import VdsmTestCase
-from storage.storageServer import GlusterFSConnection
-from storage.storageServer import IscsiConnection
-from storage.storageServer import MountConnection
-from storage import storageServer
from vdsm.gluster import cli as gluster_cli
from vdsm.gluster import exception as ge
+from vdsm.storage.storageServer import GlusterFSConnection
+from vdsm.storage.storageServer import IscsiConnection
+from vdsm.storage.storageServer import MountConnection
+from vdsm.storage import storageServer
class FakeSupervdsm(object):
diff --git a/vdsm.spec.in b/vdsm.spec.in
index b832882..7109533 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -941,7 +941,6 @@
%{_datadir}/%{vdsm_name}/storage/sd.py*
%{_datadir}/%{vdsm_name}/storage/sp.py*
%{_datadir}/%{vdsm_name}/storage/spbackends.py*
-%{_datadir}/%{vdsm_name}/storage/storageServer.py*
%{_datadir}/%{vdsm_name}/storage/volume.py*
%{_datadir}/%{vdsm_name}/storage/imageRepository/__init__.py*
%{_datadir}/%{vdsm_name}/storage/imageRepository/formatConverter.py*
@@ -1208,6 +1207,7 @@
%{python_sitelib}/%{vdsm_name}/storage/resourceManager.py*
%{python_sitelib}/%{vdsm_name}/storage/rwlock.py*
%{python_sitelib}/%{vdsm_name}/storage/securable.py*
+%{python_sitelib}/%{vdsm_name}/storage/storageServer.py*
%{python_sitelib}/%{vdsm_name}/storage/task.py*
%{python_sitelib}/%{vdsm_name}/storage/taskManager.py*
%{python_sitelib}/%{vdsm_name}/storage/threadPool.py*
diff --git a/vdsm/storage/Makefile.am b/vdsm/storage/Makefile.am
index 29a45a4..29450dc 100644
--- a/vdsm/storage/Makefile.am
+++ b/vdsm/storage/Makefile.am
@@ -42,8 +42,8 @@
sd.py \
sp.py \
spbackends.py \
- storageServer.py \
- volume.py
+ volume.py \
+ $(NULL)
dist_vdsmexec_SCRIPTS = \
curl-img-wrap \
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 216dfd3..ccce68e 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -58,6 +58,7 @@
from vdsm.storage import multipath
from vdsm.storage import outOfProcess as oop
from vdsm.storage import resourceManager as rm
+from vdsm.storage import storageServer
from vdsm.storage import taskManager
from vdsm.storage import types
from vdsm.storage.constants import STORAGE
@@ -78,7 +79,6 @@
from sdc import sdCache
import image
import merge
-import storageServer
import sdm.api.create_volume
--
To view, visit https://gerrit.ovirt.org/73116
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0fba9e9da91354a2e28fdf0ce754836ae61c7094
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
6 years, 10 months
Change in vdsm[master]: storage: validateDirAccess: move to fileUtils
by Code Review
From Dan Kenigsberg <danken(a)redhat.com>:
Dan Kenigsberg has uploaded a new change for review.
Change subject: storage: validateDirAccess: move to fileUtils
......................................................................
storage: validateDirAccess: move to fileUtils
validateDirAccess is the only thing keeping storageServer out of
lib/vdsm.
fileUtils is not a perfect location for it, but I did not find a better
place.
Change-Id: I21ead1cb635f8224cb09f7319ffcb55eebe2a9e3
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M lib/vdsm/storage/fileUtils.py
M vdsm/storage/fileSD.py
M vdsm/storage/localFsSD.py
M vdsm/storage/nfsSD.py
M vdsm/storage/storageServer.py
5 files changed, 27 insertions(+), 28 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/15/73115/1
diff --git a/lib/vdsm/storage/fileUtils.py b/lib/vdsm/storage/fileUtils.py
index 2e84d5f..71c7bef 100644
--- a/lib/vdsm/storage/fileUtils.py
+++ b/lib/vdsm/storage/fileUtils.py
@@ -37,7 +37,11 @@
import six
from vdsm import constants
+from vdsm import supervdsm
from vdsm.common.network import address
+
+from . import exception as se
+from . import outOfProcess
log = logging.getLogger('storage.fileUtils')
@@ -139,6 +143,25 @@
raise OSError(errno.EACCES, os.strerror(errno.EACCES))
+def validateDirAccess(dirPath):
+ try:
+ outOfProcess.getGlobalProcPool().fileUtils.validateAccess(dirPath)
+ supervdsm.getProxy().validateAccess(
+ constants.VDSM_USER,
+ (constants.VDSM_GROUP,), dirPath,
+ (os.R_OK | os.W_OK | os.X_OK))
+ supervdsm.getProxy().validateAccess(
+ constants.QEMU_PROCESS_USER,
+ (constants.DISKIMAGE_GROUP, constants.METADATA_GROUP), dirPath,
+ (os.R_OK | os.X_OK))
+ except OSError as e:
+ if e.errno == errno.EACCES:
+ raise se.StorageServerAccessPermissionError(dirPath)
+ raise
+
+ return True
+
+
def validateQemuReadable(targetPath):
"""
Validate that qemu process can read file
diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py
index ab9ae21..9d76c3c 100644
--- a/vdsm/storage/fileSD.py
+++ b/vdsm/storage/fileSD.py
@@ -41,7 +41,6 @@
from vdsm import constants
from vdsm.utils import stripNewLines
from vdsm.storage.constants import LEASE_FILEEXT
-from vdsm import supervdsm
REMOTE_PATH = "REMOTE_PATH"
@@ -64,27 +63,6 @@
ST_BYTES_PER_BLOCK = 512
_MOUNTLIST_IGNORE = ('/' + sd.BLOCKSD_DIR, '/' + sd.GLUSTERSD_DIR)
-
-getProcPool = oop.getGlobalProcPool
-
-
-def validateDirAccess(dirPath):
- try:
- getProcPool().fileUtils.validateAccess(dirPath)
- supervdsm.getProxy().validateAccess(
- constants.VDSM_USER,
- (constants.VDSM_GROUP,), dirPath,
- (os.R_OK | os.W_OK | os.X_OK))
- supervdsm.getProxy().validateAccess(
- constants.QEMU_PROCESS_USER,
- (constants.DISKIMAGE_GROUP, constants.METADATA_GROUP), dirPath,
- (os.R_OK | os.X_OK))
- except OSError as e:
- if e.errno == errno.EACCES:
- raise se.StorageServerAccessPermissionError(dirPath)
- raise
-
- return True
def validateFileSystemFeatures(sdUUID, mountDir):
diff --git a/vdsm/storage/localFsSD.py b/vdsm/storage/localFsSD.py
index 94db70d..a724a3d 100644
--- a/vdsm/storage/localFsSD.py
+++ b/vdsm/storage/localFsSD.py
@@ -59,7 +59,7 @@
if os.path.abspath(typeSpecificArg) != typeSpecificArg:
raise se.StorageDomainIllegalRemotePath(typeSpecificArg)
- fileSD.validateDirAccess(domPath)
+ fileUtils.validateDirAccess(domPath)
fileSD.validateFileSystemFeatures(sdUUID, domPath)
sd.validateDomainVersion(version)
diff --git a/vdsm/storage/nfsSD.py b/vdsm/storage/nfsSD.py
index 8c41952..fc020de 100644
--- a/vdsm/storage/nfsSD.py
+++ b/vdsm/storage/nfsSD.py
@@ -46,7 +46,7 @@
if not mount.isMounted(domPath):
raise se.StorageDomainFSNotMounted(domPath)
- fileSD.validateDirAccess(domPath)
+ fileUtils.validateDirAccess(domPath)
fileSD.validateFileSystemFeatures(sdUUID, domPath)
# Make sure there are no remnants of other domain
diff --git a/vdsm/storage/storageServer.py b/vdsm/storage/storageServer.py
index dc3fd80..28c93d1 100644
--- a/vdsm/storage/storageServer.py
+++ b/vdsm/storage/storageServer.py
@@ -40,8 +40,6 @@
from vdsm.storage import mount
from vdsm.storage.mount import MountError
-import fileSD
-
IscsiConnectionParameters = namedtuple("IscsiConnectionParameters",
"target, iface, credentials")
@@ -163,7 +161,7 @@
six.reraise(t, v, tb)
else:
try:
- fileSD.validateDirAccess(
+ fileUtils.validateDirAccess(
self.getMountObj().getRecord().fs_file)
except se.StorageServerAccessPermissionError:
t, v, tb = sys.exc_info()
@@ -566,7 +564,7 @@
def checkTarget(self):
if not os.path.isdir(self._path):
raise se.StorageServerLocalNotDirError(self._path)
- fileSD.validateDirAccess(self._path)
+ fileUtils.validateDirAccess(self._path)
return True
def checkLink(self):
--
To view, visit https://gerrit.ovirt.org/73115
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I21ead1cb635f8224cb09f7319ffcb55eebe2a9e3
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
6 years, 10 months
Change in vdsm[master]: tests: python3: avoid decoding errors
by Code Review
From Dan Kenigsberg <danken(a)redhat.com>:
Dan Kenigsberg has submitted this change and it was merged.
Change subject: tests: python3: avoid decoding errors
......................................................................
tests: python3: avoid decoding errors
We have one test which wants to feed libvirt with incorrect xml.
To make it work properly under python3, we need to read the data
as bytes (not as strings) and decode it to string when needed.
No intended changes in behaviour.
Change-Id: I5283854daf63ded0354d434e6e7d777a633664e3
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M tests/vmfakecon.py
1 file changed, 12 insertions(+), 6 deletions(-)
Approvals:
Jenkins CI: Passed CI tests
Dan Kenigsberg: Verified; Looks good to me, approved
--
To view, visit https://gerrit.ovirt.org/78044
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5283854daf63ded0354d434e6e7d777a633664e3
Gerrit-PatchSet: 12
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: Petr Horáček <phoracek(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
6 years, 10 months