Change in vdsm[master]: hostdev: prefer numa nodes close to device MMIO
by mzamazal@redhat.com
Milan Zamazal has posted comments on this change.
Change subject: hostdev: prefer numa nodes close to device MMIO
......................................................................
Patch Set 17: Code-Review+1
--
To view, visit https://gerrit.ovirt.org/60640
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I9bc795d2f5bad76ebf1e1bff391b3bc71037fffb
Gerrit-PatchSet: 17
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(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: 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
7 years, 9 months
Change in vdsm[master]: hostdev: prefer numa nodes close to device MMIO
by automation@ovirt.org
gerrit-hooks has posted comments on this change.
Change subject: hostdev: prefer numa nodes close to device MMIO
......................................................................
Patch Set 17:
* #1356161::Update tracker: OK
* Check Bug-Url::OK
* Check Public Bug::#1356161::OK, public bug
* Check Product::#1356161::OK, Correct classification oVirt
* Check TM::SKIP, not in a monitored branch (ovirt-3.6 ovirt-4.0)
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-4.0'])
--
To view, visit https://gerrit.ovirt.org/60640
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I9bc795d2f5bad76ebf1e1bff391b3bc71037fffb
Gerrit-PatchSet: 17
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(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: 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
7 years, 9 months
Change in vdsm[master]: hostdev: report device MMIO numa node
by automation@ovirt.org
gerrit-hooks has posted comments on this change.
Change subject: hostdev: report device MMIO numa node
......................................................................
Patch Set 15:
* #1356161::Update tracker: OK
* Check Bug-Url::OK
* Check Public Bug::#1356161::OK, public bug
* Check Product::#1356161::OK, Correct classification oVirt
* Check TM::SKIP, not in a monitored branch (ovirt-3.6 ovirt-4.0)
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-4.0'])
--
To view, visit https://gerrit.ovirt.org/60637
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I2995b68465caa52f6c721ed5af7d537748fa647a
Gerrit-PatchSet: 15
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Milan Zamazal <mzamazal(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
Gerrit-HasComments: No
7 years, 9 months
Change in vdsm[master]: hostdev: expose numa_node in host device
by automation@ovirt.org
gerrit-hooks has posted comments on this change.
Change subject: hostdev: expose numa_node in host device
......................................................................
Patch Set 15:
* #1356161::Update tracker: OK
* Check Bug-Url::OK
* Check Public Bug::#1356161::OK, public bug
* Check Product::#1356161::OK, Correct classification oVirt
* Check TM::SKIP, not in a monitored branch (ovirt-3.6 ovirt-4.0)
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-4.0'])
--
To view, visit https://gerrit.ovirt.org/60638
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I4584b99dfbff8b2e61f4f73ad58e3b67bf0c55ce
Gerrit-PatchSet: 15
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Milan Zamazal <mzamazal(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
Gerrit-HasComments: No
7 years, 9 months
Change in vdsm[master]: API: modernize VM methods
by mzamazal@redhat.com
Milan Zamazal has posted comments on this change.
Change subject: API: modernize VM methods
......................................................................
Patch Set 19: Code-Review+1
(2 comments)
https://gerrit.ovirt.org/#/c/61475/18/vdsm/API.py
File vdsm/API.py:
Line 125:
Line 126: @property
Line 127: def vm(self):
Line 128: v = self._cif.vmContainer.get(self._UUID)
Line 129: if not v:
> Yes, it could be
It's a good practice to use the idiomatic check for None (is / is not) whether the object can be false or not.
Line 130: raise exception.NoSuchVM()
Line 131: return v
Line 132:
Line 133: @api.method
https://gerrit.ovirt.org/#/c/61475/19/vdsm/API.py
File vdsm/API.py:
PS19, Line 338: to run
running ?
--
To view, visit https://gerrit.ovirt.org/61475
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I1e2e238fc632df97b63f7bb2a6293fe1c392a842
Gerrit-PatchSet: 19
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Arik Hadas <ahadas(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Irit Goihman <igoihman(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek(a)redhat.com>
Gerrit-Reviewer: Milan Zamazal <mzamazal(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>
Gerrit-HasComments: Yes
7 years, 9 months
Change in vdsm[ovirt-4.0]: docs: add README about logging configuration
by fromani@redhat.com
Hello Dan Kenigsberg,
I'd like you to do a code review. Please visit
https://gerrit.ovirt.org/64515
to review the following change.
Change subject: docs: add README about logging configuration
......................................................................
docs: add README about logging configuration
Most notably, document how to tune the logging
settings of Vdsm at runtime, using Vdsclient
Change-Id: I2653c2a68fcf42b1e085ae1ee703fb119a0cf1fc
Backport-To: 4.0
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
Reviewed-on: https://gerrit.ovirt.org/60533
Continuous-Integration: Jenkins CI
Reviewed-by: Dan Kenigsberg <danken(a)redhat.com>
---
M Makefile.am
A README.logging
M vdsm.spec.in
3 files changed, 64 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/15/64515/1
diff --git a/Makefile.am b/Makefile.am
index 9ac2515..1f1f0fe 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -39,6 +39,7 @@
# rpm from the tarball.
EXTRA_DIST = \
.gitignore \
+ README.logging \
autobuild.sh \
autogen.sh \
build-aux/pkg-version \
diff --git a/README.logging b/README.logging
new file mode 100644
index 0000000..c6ec567
--- /dev/null
+++ b/README.logging
@@ -0,0 +1,60 @@
+Logging in Vdsm
+===============
+
+Basic configuration
+-------------------
+
+Vdsm uses the python standard module[1] for logging.
+It can be configured using /etc/vdsm/logger.conf;
+the supervdsm logging is configured separately, using
+/etc/vdsm/svdsm.logger.conf
+
+
+Tuning the logging at runtime
+-----------------------------
+
+Vdsm logging could be configured extensively[2]
+using the configuration files, but this requires a restart of the daemon.
+
+You can also configure the logging to some extent at runtime, without
+any restart, using vdsClient as explained below.
+Please note that any change you make using vdsClient is not permanent, and
+will be lost once Vdsm is restarted.
+
+Using vdsClient, you can tune the log level of any logger Vdsm uses.
+The basic syntax is:
+
+# vdsClient [-s] SERVER setLogLevel LEVEL [LOGGER]
+
+`LEVEL` is one of DEBUG, INFO, WARNING
+`LOGGER` is any logger Vdsm uses. Please check the configuration file
+to learn about some predefined loggers.
+
+If no LOGGER is given, the root logger is used implicitely.
+
+Please note that the logging configuration of Vdsm is quite complex, so
+few trivial settings may yield surprising results.
+
+
+Examples of runtime tuning of logging
+-------------------------------------
+
+1. set everything to the DEBUG level:
+vdsClient -s 0 setLogLevel DEBUG
+
+2. silence virt logs, show only warnings, errors or worse:
+vdsClient -s 0 setLogLevel WARNING virt
+
+3. same as #2, for storage (case is significant here)
+vdsClient -s 0 setLogLevel WARNING Storage
+vdsClient -s 0 setLogLevel WARNING storage
+
+4. silence JSONRPC logs:
+vdsClient -s 0 setLogLevel WARNING jsonrpc
+
+
+Notes
+-----
+
+[1] https://docs.python.org/2/library/logging.html
+[2] https://docs.python.org/2/library/logging.config.html#logging-config-file...
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 50c01e8..13596d6 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -937,7 +937,9 @@
%files
%defattr(-, root, root, -)
-%doc README lib/vdsm/vdsm.conf.sample
+%doc README
+%doc lib/vdsm/vdsm.conf.sample
+%doc README.logging
%license COPYING
/usr/lib/systemd/systemd-vdsmd
/usr/lib/systemd/system-preset/85-vdsmd.preset
--
To view, visit https://gerrit.ovirt.org/64515
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2653c2a68fcf42b1e085ae1ee703fb119a0cf1fc
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-4.0
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: file_volume: Add qcow2_compat on create
by Maor Lipchuk
Maor Lipchuk has uploaded a new change for review.
Change subject: file_volume: Add qcow2_compat on create
......................................................................
file_volume: Add qcow2_compat on create
Pass qcow2 compat on create.
Change-Id: I81fd3a6e263980c1eabeea7f619c9a6b48991938
Signed-off-by: Maor Lipchuk <mlipchuk(a)redhat.com>
---
M vdsm/storage/fileVolume.py
1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/74/64374/1
diff --git a/vdsm/storage/fileVolume.py b/vdsm/storage/fileVolume.py
index ad62eec..334c08c 100644
--- a/vdsm/storage/fileVolume.py
+++ b/vdsm/storage/fileVolume.py
@@ -434,7 +434,8 @@
"sectors", sc.type2name(volFormat), volPath,
size)
if volFormat == sc.COW_FORMAT:
- qemuimg.create(volPath, sizeBytes, sc.fmt2str(volFormat))
+ qemuimg.create(volPath, sizeBytes, sc.fmt2str(volFormat),
+ qcow2_compat=dom.qcow2_compat())
else:
# Create hardlink to template and its meta file
cls.log.info("Request to create snapshot %s/%s of volume %s/%s",
--
To view, visit https://gerrit.ovirt.org/64374
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I81fd3a6e263980c1eabeea7f619c9a6b48991938
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Maor Lipchuk <mlipchuk(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: storage: Introduce VolumeManifest.datapath_session
by alitke@redhat.com
Adam Litke has uploaded a new change for review.
Change subject: storage: Introduce VolumeManifest.datapath_session
......................................................................
storage: Introduce VolumeManifest.datapath_session
When performing datapath operations on a volume (eg. copying data) we
mark the volume ILLEGAL before starting the operation and only mark the
volume LEGAL again once the operation is finished. As long as this is
all done with the volume lease held the engine can poll the volume from
any host to determine if the operation is running (lease held) and can
detect an interrupted/failed operation (lease free and volume ILLEGAL).
Later this contextmanager will be expanded to support volume generation
incrementation when exiting successfully which will also allow engine to
determine if an operation was completed successfully.
All metadata updates must be performed to a single block with one write
in order to ensure atomicity.
Change-Id: I30a3ac2971411778d24e007aac9fcb3009edb4c4
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M tests/storage_sdm_copy_data_test.py
M tests/storage_volume_test.py
M vdsm/storage/sdm/api/copy_data.py
M vdsm/storage/volume.py
4 files changed, 104 insertions(+), 8 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/62/64362/1
diff --git a/tests/storage_sdm_copy_data_test.py b/tests/storage_sdm_copy_data_test.py
index c0ec533..93f55c6 100644
--- a/tests/storage_sdm_copy_data_test.py
+++ b/tests/storage_sdm_copy_data_test.py
@@ -221,7 +221,40 @@
# Qemu pads the file to a 1k boundary with null bytes
self.assertTrue(f.read().startswith(vm_conf_data))
+ @permutations((('file',), ('block',)))
+ def test_datapath_session(self, env_type):
+ job_id = str(uuid.uuid4())
+ fmt = sc.RAW_FORMAT
+ with self.get_vols(env_type, fmt, fmt) as (src_chain, dst_chain):
+ src_vol = src_chain[0]
+ dst_vol = dst_chain[0]
+ source = dict(endpoint_type='div', sd_id=src_vol.sdUUID,
+ img_id=src_vol.imgUUID, vol_id=src_vol.volUUID)
+ dest = dict(endpoint_type='div', sd_id=dst_vol.sdUUID,
+ img_id=dst_vol.imgUUID, vol_id=dst_vol.volUUID)
+ self.assertEqual(sc.LEGAL_VOL, src_vol.getLegality())
+ self.assertEqual(sc.LEGAL_VOL, dst_vol.getLegality())
+ fake_convert = FakeQemuConvertChecker(src_vol, dst_vol)
+ with MonkeyPatchScope([(qemuimg, 'convert', fake_convert)]):
+ job = storage.sdm.api.copy_data.Job(job_id, 0, source, dest)
+ job.run()
+ wait_for_job(job)
+ self.assertEqual(jobs.STATUS.DONE, job.status)
+ self.assertEqual(sc.LEGAL_VOL, src_vol.getLegality())
+ self.assertEqual(sc.LEGAL_VOL, dst_vol.getLegality())
+
# TODO: Missing tests:
# Copy between 2 different domains
# Abort before copy
# Abort during copy
+
+
+class FakeQemuConvertChecker(object):
+ def __init__(self, src_vol, dst_vol):
+ self.src_vol = src_vol
+ self.dst_vol = dst_vol
+
+ def __call__(self, *args, **kwargs):
+ assert sc.LEGAL_VOL == self.src_vol.getLegality()
+ assert sc.ILLEGAL_VOL == self.dst_vol.getLegality()
+ return qemuimg.QemuImgOperation(['/bin/true'])
diff --git a/tests/storage_volume_test.py b/tests/storage_volume_test.py
index 79cae70..2231148 100644
--- a/tests/storage_volume_test.py
+++ b/tests/storage_volume_test.py
@@ -19,10 +19,12 @@
#
from __future__ import absolute_import
+import uuid
from monkeypatch import MonkeyPatchScope
from storagefakelib import FakeStorageDomainCache
from storagetestlib import FakeSD
+from storagetestlib import fake_env
from testlib import expandPermutations, permutations
from testlib import recorded
from testlib import VdsmTestCase
@@ -34,6 +36,7 @@
from storage import volume
HOST_ID = 1
+MB = 1048576
class FakeSDManifest(object):
@@ -92,3 +95,45 @@
self.assertEqual(expected[:1], manifest.__calls__)
lock.release()
self.assertEqual(expected, manifest.__calls__)
+
+
+@expandPermutations
+class VolumeManifestTest(VdsmTestCase):
+
+ def test_datapath_session(self):
+ img_id = str(uuid.uuid4())
+ vol_id = str(uuid.uuid4())
+
+ with fake_env('file') as env:
+ env.make_volume(MB, img_id, vol_id)
+ vol = env.sd_manifest.produceVolume(img_id, vol_id)
+ vol.setMetadata = CountedInstanceMethod(vol.setMetadata)
+ self.assertEqual(sc.LEGAL_VOL, vol.getLegality())
+ with vol.datapath_session():
+ self.assertEqual(sc.ILLEGAL_VOL, vol.getLegality())
+ self.assertEqual(1, vol.setMetadata.nr_calls)
+ self.assertEqual(sc.LEGAL_VOL, vol.getLegality())
+ self.assertEqual(2, vol.setMetadata.nr_calls)
+
+ def test_datapath_session_fail_inside_context(self):
+ img_id = str(uuid.uuid4())
+ vol_id = str(uuid.uuid4())
+
+ with fake_env('file') as env:
+ env.make_volume(MB, img_id, vol_id)
+ vol = env.sd_manifest.produceVolume(img_id, vol_id)
+ self.assertEqual(sc.LEGAL_VOL, vol.getLegality())
+ with self.assertRaises(ValueError):
+ with vol.datapath_session():
+ raise ValueError()
+ self.assertEqual(sc.ILLEGAL_VOL, vol.getLegality())
+
+
+class CountedInstanceMethod(object):
+ def __init__(self, method):
+ self._method = method
+ self.nr_calls = 0
+
+ def __call__(self, *args, **kwargs):
+ self.nr_calls += 1
+ return self._method(*args, **kwargs)
diff --git a/vdsm/storage/sdm/api/copy_data.py b/vdsm/storage/sdm/api/copy_data.py
index d55e651..0304fed 100644
--- a/vdsm/storage/sdm/api/copy_data.py
+++ b/vdsm/storage/sdm/api/copy_data.py
@@ -73,14 +73,15 @@
src_format = self._source.qemu_format
dst_format = self._dest.qemu_format
- self._operation = qemuimg.convert(
- self._source.path,
- self._dest.path,
- srcFormat=src_format,
- dstFormat=dst_format,
- backing=self._dest.backing_path,
- backingFormat=self._dest.backing_qemu_format)
- self._operation.wait_for_completion()
+ with self._dest.datapath_session():
+ self._operation = qemuimg.convert(
+ self._source.path,
+ self._dest.path,
+ srcFormat=src_format,
+ dstFormat=dst_format,
+ backing=self._dest.backing_path,
+ backingFormat=self._dest.backing_qemu_format)
+ self._operation.wait_for_completion()
def _create_endpoint(params, host_id, writable):
@@ -103,6 +104,7 @@
self._host_id = host_id
self._writable = writable
self._vol = None
+ self.datapath_session = None
@property
def locks(self):
@@ -146,7 +148,9 @@
dom = sdCache.produce_manifest(self.sd_id)
self._vol = dom.produceVolume(self.img_id, self.vol_id)
self._vol.prepare(rw=self._writable, justme=True)
+ self.datapath_session = self._vol.datapath_session
try:
yield
finally:
+ self.datapath_session = None
self._vol.teardown(self.sd_id, self.vol_id, justme=True)
diff --git a/vdsm/storage/volume.py b/vdsm/storage/volume.py
index 1339d95..0c01e1c 100644
--- a/vdsm/storage/volume.py
+++ b/vdsm/storage/volume.py
@@ -497,6 +497,20 @@
"""
pass
+ @contextmanager
+ def datapath_session(self):
+ """
+ Must be called with the Volume Lease held.
+
+ In order to detect interrupted datapath operations a volume should be
+ marked ILLEGAL prior to the first modification of data and subsequently
+ marked LEGAL again once the operation has completed. Thus, if an
+ interruption occurs the volume will remain in an ILLEGAL state.
+ """
+ self.setLegality(sc.ILLEGAL_VOL)
+ yield
+ self.setLegality(sc.LEGAL_VOL)
+
class Volume(object):
log = logging.getLogger('storage.Volume')
--
To view, visit https://gerrit.ovirt.org/64362
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I30a3ac2971411778d24e007aac9fcb3009edb4c4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: tests: Use make_uuid in storage tests
by alitke@redhat.com
Adam Litke has uploaded a new change for review.
Change subject: tests: Use make_uuid in storage tests
......................................................................
tests: Use make_uuid in storage tests
Change-Id: Ie86551f26d5cdd12e66516af3b069344c99588e8
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M tests/storageMailboxTests.py
M tests/storage_hsm_test.py
M tests/storage_sdm_copy_data_test.py
M tests/storage_sdm_create_volume_test.py
M tests/storage_volume_artifacts_test.py
M tests/storage_volume_metadata_test.py
M tests/storage_workarounds_test.py
M tests/storagetestlib.py
M tests/storagetestlibTests.py
9 files changed, 49 insertions(+), 50 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/43/64943/1
diff --git a/tests/storageMailboxTests.py b/tests/storageMailboxTests.py
index 1d5b45a..5de9652 100644
--- a/tests/storageMailboxTests.py
+++ b/tests/storageMailboxTests.py
@@ -18,11 +18,11 @@
# Refer to the README and COPYING files for full details of the license
#
-from uuid import uuid4
import threading
import os
import shutil
+from testlib import make_uuid
from testlib import VdsmTestCase as TestCaseBase
import storage.storage_mailbox as sm
@@ -33,7 +33,7 @@
class StoragePoolStub(object):
def __init__(self):
- self.spUUID = str(uuid4())
+ self.spUUID = make_uuid()
self.storage_repository = tempfile.mkdtemp(dir='/var/tmp')
self.__masterDir = os.path.join(self.storage_repository, self.spUUID,
"mastersd", DOMAIN_META_DATA)
diff --git a/tests/storage_hsm_test.py b/tests/storage_hsm_test.py
index e9e0448..b7e0e28 100644
--- a/tests/storage_hsm_test.py
+++ b/tests/storage_hsm_test.py
@@ -18,11 +18,11 @@
# Refer to the README and COPYING files for full details of the license
#
-import uuid
from contextlib import contextmanager
from monkeypatch import MonkeyPatchScope
from testlib import make_config
+from testlib import make_uuid
from testlib import VdsmTestCase
from testlib import permutations, expandPermutations
from storagetestlib import fake_file_env
@@ -112,8 +112,8 @@
@contextmanager
def fake_volume(self, vol_fmt):
with fake_file_env() as env:
- img_id = str(uuid.uuid4())
- vol_id = str(uuid.uuid4())
+ img_id = make_uuid()
+ vol_id = make_uuid()
make_file_volume(env.sd_manifest, self.SIZE, img_id, vol_id,
vol_format=vol_fmt)
yield env.sd_manifest.produceVolume(img_id, vol_id)
diff --git a/tests/storage_sdm_copy_data_test.py b/tests/storage_sdm_copy_data_test.py
index c0ec533..e770b7f 100644
--- a/tests/storage_sdm_copy_data_test.py
+++ b/tests/storage_sdm_copy_data_test.py
@@ -19,7 +19,6 @@
#
from __future__ import absolute_import
-import uuid
from contextlib import contextmanager
from fakelib import FakeScheduler
@@ -28,6 +27,7 @@
from storagetestlib import fake_env
from storagetestlib import make_qemu_chain, write_qemu_chain, verify_qemu_chain
from storagetestlib import ChainVerificationError
+from testlib import make_uuid
from testlib import VdsmTestCase, expandPermutations, permutations
from testlib import wait_for_job
@@ -130,7 +130,7 @@
def test_intra_domain_copy(self, env_type, src_fmt, dst_fmt):
src_fmt = sc.name2type(src_fmt)
dst_fmt = sc.name2type(dst_fmt)
- job_id = str(uuid.uuid4())
+ job_id = make_uuid()
with self.get_vols(env_type, src_fmt, dst_fmt) as (src_chain,
dst_chain):
@@ -173,7 +173,7 @@
dst_chain):
write_qemu_chain(src_chain)
for index in copy_seq:
- job_id = str(uuid.uuid4())
+ job_id = make_uuid()
src_vol = src_chain[index]
dst_vol = dst_chain[index]
source = dict(endpoint_type='div', sd_id=src_vol.sdUUID,
@@ -193,7 +193,7 @@
volume format may be set incorrectly due to an old bug. Check that the
workaround we have in place allows the copy to proceed without error.
"""
- job_id = str(uuid.uuid4())
+ job_id = make_uuid()
vm_conf_size = workarounds.VM_CONF_SIZE_BLK * sc.BLOCK_SIZE
vm_conf_data = "VM Configuration"
diff --git a/tests/storage_sdm_create_volume_test.py b/tests/storage_sdm_create_volume_test.py
index ebc2db0..f62f325 100644
--- a/tests/storage_sdm_create_volume_test.py
+++ b/tests/storage_sdm_create_volume_test.py
@@ -20,10 +20,10 @@
from __future__ import absolute_import
from contextlib import contextmanager
-import uuid
from monkeypatch import MonkeyPatchScope
from storagefakelib import FakeResourceManager
+from testlib import make_uuid
from testlib import VdsmTestCase, recorded, expandPermutations, permutations
from testlib import wait_for_job
@@ -84,17 +84,17 @@
def _get_vol_info():
- return dict(sd_id=str(uuid.uuid4()), img_id=str(uuid.uuid4()),
- vol_id=str(uuid.uuid4()), virtual_size=2048,
+ return dict(sd_id=make_uuid(), img_id=make_uuid(),
+ vol_id=make_uuid(), virtual_size=2048,
vol_format='RAW', disk_type='SYSTEM')
class CreateVolumeTests(VdsmTestCase):
def _get_args(self):
- job_id = str(uuid.uuid4())
+ job_id = make_uuid()
host_id = 1
- sd_manifest = FakeDomainManifest(str(uuid.uuid4()))
+ sd_manifest = FakeDomainManifest(make_uuid())
vol_info = _get_vol_info()
vol_info_obj = storage.sdm.api.create_volume.CreateVolumeInfo(vol_info)
return dict(job_id=job_id, host_id=host_id, sd_manifest=sd_manifest,
diff --git a/tests/storage_volume_artifacts_test.py b/tests/storage_volume_artifacts_test.py
index 36ea004..ee044f0 100644
--- a/tests/storage_volume_artifacts_test.py
+++ b/tests/storage_volume_artifacts_test.py
@@ -19,9 +19,9 @@
#
import os
-import uuid
from monkeypatch import MonkeyPatchScope
+from testlib import make_uuid
from testlib import VdsmTestCase
from testlib import permutations, expandPermutations
from testValidation import brokentest
@@ -62,8 +62,8 @@
class VolumeArtifactsTestsMixin(object):
def setUp(self):
- self.img_id = str(uuid.uuid4())
- self.vol_id = str(uuid.uuid4())
+ self.img_id = make_uuid()
+ self.vol_id = make_uuid()
def test_state_missing(self):
with self.fake_env() as env:
@@ -107,7 +107,7 @@
first.create(*BASE_PARAMS[sc.RAW_FORMAT])
first.commit()
second = env.sd_manifest.get_volume_artifacts(
- self.img_id, str(uuid.uuid4()))
+ self.img_id, make_uuid())
self.assertRaises(se.InvalidParameterException,
second.create, *BASE_PARAMS[sc.COW_FORMAT])
@@ -118,7 +118,7 @@
first.create(*BASE_PARAMS[sc.RAW_FORMAT])
first.commit()
second = env.sd_manifest.get_volume_artifacts(
- self.img_id, str(uuid.uuid4()))
+ self.img_id, make_uuid())
self.assertRaises(se.InvalidParameterException, second.create,
*BASE_PARAMS[sc.RAW_FORMAT])
@@ -329,8 +329,8 @@
class FileVolumeArtifactVisibilityTests(VdsmTestCase):
def setUp(self):
- self.img_id = str(uuid.uuid4())
- self.vol_id = str(uuid.uuid4())
+ self.img_id = make_uuid()
+ self.vol_id = make_uuid()
def test_getallimages(self):
# The current behavior of getAllImages is to report garbage image
@@ -563,8 +563,8 @@
class BlockVolumeArtifactVisibilityTests(VdsmTestCase):
def setUp(self):
- self.img_id = str(uuid.uuid4())
- self.vol_id = str(uuid.uuid4())
+ self.img_id = make_uuid()
+ self.vol_id = make_uuid()
def test_getallimages(self):
# The current behavior of getAllImages for block domains does not
diff --git a/tests/storage_volume_metadata_test.py b/tests/storage_volume_metadata_test.py
index b8f5873..86222ef 100644
--- a/tests/storage_volume_metadata_test.py
+++ b/tests/storage_volume_metadata_test.py
@@ -19,8 +19,8 @@
import textwrap
import time
-import uuid
+from testlib import make_uuid
from testlib import VdsmTestCase, permutations, expandPermutations
from monkeypatch import MonkeyPatchScope
@@ -35,9 +35,9 @@
def make_init_params(**kwargs):
res = dict(
- domain=str(uuid.uuid4()),
- image=str(uuid.uuid4()),
- puuid=str(uuid.uuid4()),
+ domain=make_uuid(),
+ image=make_uuid(),
+ puuid=make_uuid(),
size=1024 * MB,
format=sc.type2name(sc.RAW_FORMAT),
type=sc.type2name(sc.SPARSE_VOL),
diff --git a/tests/storage_workarounds_test.py b/tests/storage_workarounds_test.py
index 47728b4..fd659e5 100644
--- a/tests/storage_workarounds_test.py
+++ b/tests/storage_workarounds_test.py
@@ -19,8 +19,8 @@
#
from __future__ import absolute_import
-import uuid
+from testlib import make_uuid
from testlib import VdsmTestCase
from storagetestlib import fake_file_env
@@ -35,8 +35,8 @@
def make_volume(env, size, md_fmt, real_fmt):
- img_id = str(uuid.uuid4())
- vol_id = str(uuid.uuid4())
+ img_id = make_uuid()
+ vol_id = make_uuid()
env.make_volume(size, img_id, vol_id, vol_format=md_formats[md_fmt])
vol = env.sd_manifest.produceVolume(img_id, vol_id)
qemuimg.create(vol.getVolumePath(), size, qemu_formats[real_fmt])
diff --git a/tests/storagetestlib.py b/tests/storagetestlib.py
index 81b575c..24cd27e 100644
--- a/tests/storagetestlib.py
+++ b/tests/storagetestlib.py
@@ -17,10 +17,9 @@
# Refer to the README and COPYING files for full details of the license
#
import os
-import uuid
from contextlib import contextmanager
-from testlib import make_file, namedTemporaryDir
+from testlib import make_file, make_uuid, namedTemporaryDir
from storagefakelib import FakeLVM
from storagefakelib import FakeStorageDomainCache
from monkeypatch import MonkeyPatchScope
@@ -139,16 +138,16 @@
md[sd.DMDK_SDUUID] = sduuid
md[sd.DMDK_VERSION] = version
md[sd.DMDK_CLASS] = dom_class
- md[sd.DMDK_POOLS] = pools if pools is not None else [str(uuid.uuid4())]
+ md[sd.DMDK_POOLS] = pools if pools is not None else [make_uuid()]
return md
def make_blocksd_manifest(tmpdir, fake_lvm, sduuid=None, devices=None):
if sduuid is None:
- sduuid = str(uuid.uuid4())
+ sduuid = make_uuid()
if devices is None:
devices = get_random_devices()
- spuuid = str(uuid.uuid4())
+ spuuid = make_uuid()
fake_lvm.createVG(sduuid, devices, blockSD.STORAGE_DOMAIN_TAG,
blockSD.VG_METADATASIZE)
@@ -188,8 +187,8 @@
def make_filesd_manifest(tmpdir):
- spuuid = str(uuid.uuid4())
- sduuid = str(uuid.uuid4())
+ spuuid = make_uuid()
+ sduuid = make_uuid()
domain_path = os.path.join(tmpdir, spuuid, sduuid)
metafile = get_metafile_path(domain_path)
@@ -340,11 +339,11 @@
def make_qemu_chain(env, size, base_vol_fmt, chain_len):
vol_list = []
- img_id = str(uuid.uuid4())
+ img_id = make_uuid()
parent_vol_id = sc.BLANK_UUID
vol_fmt = base_vol_fmt
for i in range(chain_len):
- vol_id = str(uuid.uuid4())
+ vol_id = make_uuid()
if parent_vol_id != sc.BLANK_UUID:
vol_fmt = sc.COW_FORMAT
env.make_volume(size, img_id, vol_id,
diff --git a/tests/storagetestlibTests.py b/tests/storagetestlibTests.py
index addf340..a7d6a2c 100644
--- a/tests/storagetestlibTests.py
+++ b/tests/storagetestlibTests.py
@@ -18,9 +18,9 @@
#
import os
-import uuid
from testlib import expandPermutations, permutations
+from testlib import make_uuid
from testlib import namedTemporaryDir
from testlib import VdsmTestCase
from testlib import TEMPDIR
@@ -72,8 +72,8 @@
def test_volume_structure(self):
with fake_file_env() as env:
- img_id = str(uuid.uuid4())
- vol_id = str(uuid.uuid4())
+ img_id = make_uuid()
+ vol_id = make_uuid()
make_file_volume(env.sd_manifest, 0, img_id, vol_id)
image_dir = env.sd_manifest.getImagePath(img_id)
files = (vol_id, vol_id + sc.LEASE_FILEEXT,
@@ -85,8 +85,8 @@
def test_volume_metadata_io(self):
with fake_file_env() as env:
size = 1 * MB
- img_id = str(uuid.uuid4())
- vol_id = str(uuid.uuid4())
+ img_id = make_uuid()
+ vol_id = make_uuid()
make_file_volume(env.sd_manifest, size, img_id, vol_id)
vol = env.sd_manifest.produceVolume(img_id, vol_id)
desc = 'foo'
@@ -144,8 +144,8 @@
def test_volume_size_alignment(self, size_param):
with fake_block_env() as env:
sd_id = env.sd_manifest.sdUUID
- img_id = str(uuid.uuid4())
- vol_id = str(uuid.uuid4())
+ img_id = make_uuid()
+ vol_id = make_uuid()
make_block_volume(env.lvm, env.sd_manifest, size_param,
img_id, vol_id)
vol = env.sd_manifest.produceVolume(img_id, vol_id)
@@ -161,8 +161,8 @@
def test_volume_metadata_io(self):
with fake_block_env() as env:
sd_id = env.sd_manifest.sdUUID
- img_id = str(uuid.uuid4())
- vol_id = str(uuid.uuid4())
+ img_id = make_uuid()
+ vol_id = make_uuid()
size_mb = sc.VG_EXTENT_SIZE_MB
size = size_mb * MB
size_blk = size_mb * MB / sc.BLOCK_SIZE
@@ -182,8 +182,8 @@
def test_volume_accessibility(self):
with fake_block_env() as env:
sd_id = env.sd_manifest.sdUUID
- img_id = str(uuid.uuid4())
- vol_id = str(uuid.uuid4())
+ img_id = make_uuid()
+ vol_id = make_uuid()
make_block_volume(env.lvm, env.sd_manifest, 1 * MB, img_id, vol_id)
self.assertTrue(os.path.isfile(env.lvm.lvPath(sd_id, vol_id)))
--
To view, visit https://gerrit.ovirt.org/64943
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie86551f26d5cdd12e66516af3b069344c99588e8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
7 years, 9 months
Change in vdsm[master]: tests: Add gen_uuid test helper
by alitke@redhat.com
Adam Litke has uploaded a new change for review.
Change subject: tests: Add gen_uuid test helper
......................................................................
tests: Add gen_uuid test helper
The test code is sprinkled with lots of boilerplate code to generate
UUIDs in the proper format. Add a helper to testlib so we can reduce
this duplicated logic in tests.
Change-Id: I622928911c3f07739fd61f61a58cee2e692c7eeb
Signed-off-by: Adam Litke <alitke(a)redhat.com>
---
M tests/testlib.py
1 file changed, 8 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/42/64542/1
diff --git a/tests/testlib.py b/tests/testlib.py
index c341c24..b75e7a2 100644
--- a/tests/testlib.py
+++ b/tests/testlib.py
@@ -28,6 +28,7 @@
import pickle
import platform
import unittest
+import uuid
from functools import wraps
import shutil
import sys
@@ -588,3 +589,10 @@
"""
while job.active:
time.sleep(1)
+
+
+def gen_uuid():
+ """
+ Return a new UUID in the format used for all vdsm APIs that accept UUIDs.
+ """
+ return str(uuid.uuid4())
--
To view, visit https://gerrit.ovirt.org/64542
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I622928911c3f07739fd61f61a58cee2e692c7eeb
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke(a)redhat.com>
7 years, 9 months