Change in vdsm[master]: gluster: fix brick devices are created with incorrect data a...
by tjeyasin@redhat.com
Timothy Asir has uploaded a new change for review.
Change subject: gluster: fix brick devices are created with incorrect data alignment
......................................................................
gluster: fix brick devices are created with incorrect data alignment
Removed make partition function and pv create will not create
any partition on the given device.
Change-Id: I58cc322cb5140de2d2006d59b4c1dceaba2e5968
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1270792
Signed-off-by: Timothy Asir Jeyasingh <tjeyasin(a)redhat.com>
---
M vdsm/gluster/storagedev.py
1 file changed, 28 insertions(+), 44 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/59/47959/1
diff --git a/vdsm/gluster/storagedev.py b/vdsm/gluster/storagedev.py
index 1e4402c..4da753e 100644
--- a/vdsm/gluster/storagedev.py
+++ b/vdsm/gluster/storagedev.py
@@ -76,7 +76,7 @@
'uuid': '',
'createBrick': createBrick}
if isinstance(device.size, blivet.size.Size):
- info['size'] = '%s' % device.size.convertTo(spec="MiB")
+ info['size'] = '%s' % device.size.convertTo(blivet.size.MiB)
else:
info['size'] = '%s' % device.size
if not info['bus'] and device.parents:
@@ -137,49 +137,24 @@
return [blivetEnv.devicetree.getDeviceByName(devName.split("/")[-1])
for devName in devNameList]
- def _makePartition(deviceList):
- pvDeviceList = []
- doPartitioning = False
- for dev in deviceList:
- if dev.type not in ['disk', 'dm-multipath']:
- pvDeviceList.append(dev)
- else:
- blivetEnv.initializeDisk(dev)
- part = blivetEnv.newPartition(fmt_type="lvmpv", grow=True,
- parents=[dev])
- blivetEnv.createDevice(part)
- pvDeviceList.append(part)
- doPartitioning = True
-
- if doPartitioning:
- blivet.partitioning.doPartitioning(blivetEnv)
- return pvDeviceList
-
def _createPV(deviceList, alignment=0):
- def _createAlignedPV(deviceList, alignment):
- for dev in deviceList:
- # bz#1178705: Blivet always creates pv with 1MB dataalignment
- # Workaround: Till blivet fixes the issue, we use lvm pvcreate
+ for dev in deviceList:
+ # bz#1178705: Blivet always creates pv with 1MB dataalignment
+ # Workaround: Till blivet fixes the issue, we use lvm pvcreate
+ if alignment:
rc, out, err = utils.execCmd([_pvCreateCommandPath.cmd,
'--dataalignment',
'%sk' % alignment,
dev.path])
- if rc:
- raise ge.GlusterHostStorageDevicePVCreateFailedException(
- dev.path, alignment, rc, out, err)
- _reset_blivet(blivetEnv)
- return _getDeviceList([dev.name for dev in deviceList])
+ else:
+ rc, out, err = utils.execCmd([_pvCreateCommandPath.cmd,
+ dev.path])
- if alignment:
- blivetEnv.doIt()
- return _createAlignedPV(deviceList, alignment)
-
- for dev in deviceList:
- lvmpv = blivet.formats.getFormat("lvmpv", device=dev.path)
- blivetEnv.formatDevice(dev, lvmpv)
-
- blivet.partitioning.doPartitioning(blivetEnv)
- return deviceList
+ if rc:
+ raise ge.GlusterHostStorageDevicePVCreateFailedException(
+ dev.path, alignment, rc, out, err)
+ _reset_blivet(blivetEnv)
+ return _getDeviceList([dev.name for dev in deviceList])
def _createVG(vgName, deviceList, stripeSize=0):
if stripeSize:
@@ -204,8 +179,11 @@
if not alignment:
# bz#1180228: blivet doesn't handle percentage-based sizes properly
# Workaround: Till the bz gets fixed, we take only 99% size from vg
+ vgSizeByte = (vg.size * 99 / 100).convertTo(blivet.size.B)
+ # calculate roundSize to avoid 'Size is not a multiple of 512' error
pool = LVMThinPoolDevice(poolName, parents=[vg],
- size=(vg.size * 99 / 100),
+ size=blivet.size.Size(
+ (vgSizeByte - vgSizeByte % 512)),
grow=True)
blivetEnv.createDevice(pool)
return pool
@@ -283,8 +261,7 @@
if inUseList:
raise ge.GlusterHostStorageDeviceInUseException(inUseList)
- pvDeviceList = _makePartition(deviceList)
- pvDeviceList = _createPV(pvDeviceList, alignment)
+ pvDeviceList = _createPV(deviceList, alignment)
vg = _createVG(vgName, pvDeviceList, raidParams.get('stripeSize', 0))
# The following calculation is based on the redhat storage performance doc
@@ -297,8 +274,8 @@
# and create data LV (poolDataSize) that has a size which is
# a multiple of stripe width
if alignment:
- vgSizeKib = int(vg.size.convertTo(spec="KiB"))
- if vg.size.convertTo(spec='MiB') < MIN_VG_SIZE:
+ vgSizeKib = int(vg.size.convertTo(blivet.size.KiB))
+ if vg.size.convertTo(blivet.size.MiB) < MIN_VG_SIZE:
metaDataSize = vgSizeKib * MIN_METADATA_PERCENT
poolDataSize = vgSizeKib - metaDataSize
metaDataSize = (metaDataSize - (metaDataSize % alignment))
@@ -308,8 +285,15 @@
# lvconvert --chunksize alignment --thinpool VOLGROUP/thin_pool
# --poolmetadata VOLGROUP/metadata_device_name
pool = _createThinPool(poolName, vg, chunkSize, metaDataSize, poolDataSize)
+
+ if alignment:
+ poolSize = pool.size
+ else:
+ # Calculate roundSize to avoid 'Size is not a multiple of 512' error
+ poolSize = pool.size.convertTo(blivet.size.B)/512 * 512
+
thinlv = LVMThinLogicalVolumeDevice(brickName, parents=[pool],
- size=pool.size, grow=True)
+ size=poolSize, grow=True)
blivetEnv.createDevice(thinlv)
blivetEnv.doIt()
--
To view, visit https://gerrit.ovirt.org/47959
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I58cc322cb5140de2d2006d59b4c1dceaba2e5968
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Timothy Asir <tjeyasin(a)redhat.com>
8 years, 6 months
Change in vdsm[master]: lib: grub2 module
by automation@ovirt.org
automation(a)ovirt.org has posted comments on this change.
Change subject: lib: grub2 module
......................................................................
Patch Set 4:
* Update tracker::IGNORE, no Bug-Url found
* Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url.
* Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
--
To view, visit https://gerrit.ovirt.org/47946
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I9e7e0b327882f64196a71fe20dcbd99017b80800
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Martin Betak <mbetak(a)redhat.com>
Gerrit-Reviewer: Martin Polednik <mpolednik(a)redhat.com>
Gerrit-Reviewer: Michal Skrivanek <mskrivan(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: No
8 years, 6 months
Change in vdsm[ovirt-3.6]: Adding policycoreutils-python-utils dependency for fedora 23...
by ybronhei@redhat.com
Yaniv Bronhaim has uploaded a new change for review.
Change subject: Adding policycoreutils-python-utils dependency for fedora 23 and above
......................................................................
Adding policycoreutils-python-utils dependency for fedora 23 and above
semanage utility has moved to policycoreutils-python-utils in f23 and
needs to be required as part of vdsm installation.
Change-Id: I4d0b9fbfd77419cbf885c7663d799f19213592f5
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1246626
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
Signed-off-by: Tomas Radej <tradej(a)redhat.com>
---
M vdsm.spec.in
1 file changed, 3 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/04/48004/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 95702c6..5f742d9 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -204,6 +204,9 @@
Requires: device-mapper-multipath >= 0.4.9-56
%endif
Requires: e2fsprogs >= 1.41.14
+%if 0%{?fedora} >= 23
+Requires: policycoreutils-python-utils
+%endif # fedora 23
Requires: policycoreutils-python
Requires: sed >= 4.2.1-10
Requires: ed
--
To view, visit https://gerrit.ovirt.org/48004
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4d0b9fbfd77419cbf885c7663d799f19213592f5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
8 years, 6 months
Change in vdsm[master]: jsonrpc cli: allow client to return compatible results
by ykaplan@redhat.com
Yeela Kaplan has uploaded a new change for review.
Change subject: jsonrpc cli: allow client to return compatible results
......................................................................
jsonrpc cli: allow client to return compatible results
to xmlrpc.
Bridge transforms the return value for different verbs
results returning from vdsm API.
Some code expects the old return results of API
compatible with xmlrpc.
The compat parameter allows us to return a value
that is compatible with the way xmlrpc is parsed
and we'll be able to remove this once we stop
supporting xmlrpc API.
Until then using this intermediate step is the most
straight-forward way and saves us the unnecessary
hassle of re-translating the bridge work
once its done parsing the result from API.
Change-Id: Id0bbbb46f622e60824cf5d25670fd16889f4fc51
Signed-off-by: Yeela Kaplan <ykaplan(a)redhat.com>
---
M lib/vdsm/jsonrpcvdscli.py
M lib/vdsm/response.py
2 files changed, 22 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/23/47923/1
diff --git a/lib/vdsm/jsonrpcvdscli.py b/lib/vdsm/jsonrpcvdscli.py
index c5a4df9..4fb197d 100644
--- a/lib/vdsm/jsonrpcvdscli.py
+++ b/lib/vdsm/jsonrpcvdscli.py
@@ -46,9 +46,10 @@
class _Server(object):
- def __init__(self, client):
+ def __init__(self, client, compat):
self._vdsmapi = vdsmapi.get_api()
self._client = client
+ self._compat = compat
def _prepare_args(self, className, methodName, args, kwargs):
sym = self._vdsmapi['commands'][className][methodName]
@@ -82,6 +83,9 @@
if resp.error is not None:
return response.error_raw(resp.error["code"],
resp.error["message"])
+
+ if not self._compat:
+ return response.success_raw(resp.result)
if resp.result and resp.result is not True:
# None is translated to True inside our JSONRPC implementation
@@ -126,7 +130,7 @@
def connect(requestQueue, stompClient=None,
host=None, port=None,
useSSL=None,
- responseQueue=None):
+ responseQueue=None, compat=True):
if not stompClient:
client = _create(requestQueue,
host, port, useSSL,
@@ -138,4 +142,4 @@
str(uuid4())
)
- return _Server(client)
+ return _Server(client, compat)
diff --git a/lib/vdsm/response.py b/lib/vdsm/response.py
index 62ed49e..160898f 100644
--- a/lib/vdsm/response.py
+++ b/lib/vdsm/response.py
@@ -41,6 +41,21 @@
return kwargs
+def success_raw(result=None, message=None):
+ ret = {
+ 'status':
+ {
+ "code": doneCode["code"],
+ "message": message or doneCode["message"],
+ }
+ }
+
+ if result:
+ ret['result'] = result
+
+ return ret
+
+
def error(name, message=None):
status = errCode[name]["status"]
return {
--
To view, visit https://gerrit.ovirt.org/47923
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id0bbbb46f622e60824cf5d25670fd16889f4fc51
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan(a)redhat.com>
8 years, 6 months
Change in vdsm[master]: jsonrpc cli: Allow setting timeout for long operations
by ykaplan@redhat.com
Yeela Kaplan has uploaded a new change for review.
Change subject: jsonrpc cli: Allow setting timeout for long operations
......................................................................
jsonrpc cli: Allow setting timeout for long operations
Current timeout for operations over jsonrpc is 15
seconds.
Some operations are slower and require
more time.
We want to allow those to set a timeout separately.
If no new timeout is supplied we use the default
jsonrpc timeout.
Change-Id: Ib71a5d58a9b6ba141492b2bcec5aebd5d6249179
Signed-off-by: Yeela Kaplan <ykaplan(a)redhat.com>
---
M lib/vdsm/jsonrpcvdscli.py
1 file changed, 6 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/22/47922/1
diff --git a/lib/vdsm/jsonrpcvdscli.py b/lib/vdsm/jsonrpcvdscli.py
index 7d35d62..c5a4df9 100644
--- a/lib/vdsm/jsonrpcvdscli.py
+++ b/lib/vdsm/jsonrpcvdscli.py
@@ -27,7 +27,8 @@
from yajsonrpc import stompreactor
from yajsonrpc import \
JsonRpcRequest, \
- JsonRpcNoResponseError
+ JsonRpcNoResponseError, \
+ CALL_TIMEOUT
from api import vdsmapi
from vdsm import response
@@ -68,8 +69,11 @@
class_name, method_name = method.split('.')
params = self._prepare_args(class_name, method_name, args, kwargs)
+ timeout = kwargs.pop('longOp', CALL_TIMEOUT)
+
req = JsonRpcRequest(method, params, reqId=str(uuid4()))
- responses = self._client.call(req)
+
+ responses = self._client.call(req, timeout=timeout)
if responses:
resp = responses[0]
else:
--
To view, visit https://gerrit.ovirt.org/47922
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib71a5d58a9b6ba141492b2bcec5aebd5d6249179
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan(a)redhat.com>
8 years, 6 months
Change in vdsm[master]: Renaming policycoreutils-python dependency for fedora 23 and...
by ybronhei@redhat.com
Yaniv Bronhaim has uploaded a new change for review.
Change subject: Renaming policycoreutils-python dependency for fedora 23 and above
......................................................................
Renaming policycoreutils-python dependency for fedora 23 and above
The utilities of policycoreutils-python is renamed to
policycoreutils-python-utils in fedora 23
Change-Id: I4d0b9fbfd77419cbf885c7663d799f19213592f5
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1246626
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
---
M vdsm.spec.in
1 file changed, 8 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/19/44019/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 4772416..aafd309 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -91,7 +91,11 @@
BuildRequires: m2crypto
BuildRequires: mom >= 0.4.5
BuildRequires: openssl
+%if 0%{?fedora} >= 23
+BuildRequires: policycoreutils-python-utils
+%else
BuildRequires: policycoreutils-python
+%endif # fedora 23
BuildRequires: psmisc
BuildRequires: python-cpopen >= 1.3
BuildRequires: python-inotify
@@ -197,7 +201,11 @@
Requires: initscripts >= 9.42.2-1
Requires: device-mapper-multipath >= 0.4.9-56
Requires: e2fsprogs >= 1.41.14
+%if 0%{?fedora} >= 23
+Requires: policycoreutils-python-utils
+%else
Requires: policycoreutils-python
+%endif # fedora 23
Requires: sed >= 4.2.1-10
Requires: ed
Requires: lvm2 >= 2.02.98-15
--
To view, visit https://gerrit.ovirt.org/44019
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4d0b9fbfd77419cbf885c7663d799f19213592f5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
8 years, 6 months
Change in vdsm[master]: init: compatible comment on upgrade
by ykaplan@redhat.com
Yeela Kaplan has uploaded a new change for review.
Change subject: init: compatible comment on upgrade
......................................................................
init: compatible comment on upgrade
Make comments compatible on upgrade from 4.16
and 4.10.
Change-Id: Ib9f86251ea9c4dc21b76b2898807744c3342d548
Signed-off-by: Yeela Kaplan <ykaplan(a)redhat.com>
---
M init/vdsmd_init_common.sh.in
1 file changed, 1 insertion(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/74/47974/1
diff --git a/init/vdsmd_init_common.sh.in b/init/vdsmd_init_common.sh.in
index 8dccec4..503b88e 100644
--- a/init/vdsmd_init_common.sh.in
+++ b/init/vdsmd_init_common.sh.in
@@ -255,8 +255,7 @@
if [ -f "${upgraded_ver_file}" ]; then
local ret=0
if grep -q '^vdsm-4\.10\.' "${upgraded_ver_file}"; then
- # We need to treat the upgrade from 4.10.x specifically
- # by running manual configure command
+ # REQUIRED_FOR upgrade from vdsm-4.10.x
"$VDSM_TOOL" configure --force
ret=$?
elif grep -q '^vdsm-4\.16\.' "${upgraded_ver_file}"; then
--
To view, visit https://gerrit.ovirt.org/47974
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib9f86251ea9c4dc21b76b2898807744c3342d548
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan(a)redhat.com>
8 years, 6 months
Change in vdsm[master]: tests: monkey patch architecture if unsupported
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: tests: monkey patch architecture if unsupported
......................................................................
tests: monkey patch architecture if unsupported
Following the effort to make vdsm no-arch depended,
some tests fails while running on unsupported platforms.
This patch monkeyPatch the tests, reporting a fake arch
(x86_64) if code is running on unsupported arch;
otherwise, the real arch is used, as before.
Change-Id: I2b7136e0269f39c8295714dee0be9604d7e2019c
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M tests/testlib.py
1 file changed, 28 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/12/48012/1
diff --git a/tests/testlib.py b/tests/testlib.py
index 3d00c0c..352a708 100644
--- a/tests/testlib.py
+++ b/tests/testlib.py
@@ -24,6 +24,7 @@
import logging
import os
import pickle
+import platform
import unittest
from functools import wraps
import shutil
@@ -39,6 +40,7 @@
import vdsm
+from monkeypatch import Patch
from testValidation import SlowTestsPlugin, StressTestsPlugin
# /tmp may use tempfs filesystem, not suitable for some of the test assuming a
@@ -46,6 +48,9 @@
TEMPDIR = '/var/tmp'
PERMUTATION_ATTR = "_permutations_"
+
+_ARCH_REAL = platform.machine()
+_ARCH_FAKE = 'x86_64'
def dummyTextGenerator(size):
@@ -153,12 +158,35 @@
f.truncate(size)
+def _vdsm_machine():
+ return (
+ _ARCH_REAL if _ARCH_REAL in (
+ # FIXME: this duplicates caps.Architecture, but
+ # we cannot import caps.py in this module.
+ 'x86_64', 'ppc64', 'ppc64le'
+ ) else _ARCH_FAKE
+ )
+
+
class VdsmTestCase(unittest.TestCase):
+
+ _patch_arch = Patch([
+ (platform, "machine", _vdsm_machine),
+ ])
+
def __init__(self, *args, **kwargs):
unittest.TestCase.__init__(self, *args, **kwargs)
self.log = logging.getLogger(self.__class__.__name__)
self.maxDiff = None # disable truncating diff in assert error messages
+ @classmethod
+ def setUpClass(cls):
+ cls._patch_arch.apply()
+
+ @classmethod
+ def tearDownClass(cls):
+ cls._patch_arch.revert()
+
def retryAssert(self, *args, **kwargs):
'''Keep retrying an assertion if AssertionError is raised.
See function utils.retry for the meaning of the arguments.
--
To view, visit https://gerrit.ovirt.org/48012
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2b7136e0269f39c8295714dee0be9604d7e2019c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
8 years, 6 months
Change in vdsm[master]: Monkey patch tests which calls to getTargetArch
by ybronhei@redhat.com
Yaniv Bronhaim has uploaded a new change for review.
Change subject: Monkey patch tests which calls to getTargetArch
......................................................................
Monkey patch tests which calls to getTargetArch
Following the effort to make vdsm no-arch depended, some tests fails
while running on unsupported platforms. This patch monkeyPatch those
tests to check only x86_64
Change-Id: I1dc65dfb15680ad018f83c2d51a6d1f09844aea2
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
---
M tests/clientifTests.py
M tests/deviceTests.py
M tests/devices/parsing/complex_vm_tests.py
M tests/numaUtilsTests.py
M tests/vmApiTests.py
M tests/vmMigrationTests.py
M tests/vmOperationsTests.py
M tests/vmTests.py
8 files changed, 95 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/77/47577/1
diff --git a/tests/clientifTests.py b/tests/clientifTests.py
index 30725cd..8c65085 100644
--- a/tests/clientifTests.py
+++ b/tests/clientifTests.py
@@ -23,6 +23,7 @@
from testlib import temporaryPath
from monkeypatch import MonkeyPatch
from virt.vm import VolumeError
+import caps
import clientIF
import vmfakelib as fake
@@ -204,6 +205,7 @@
cif = fake.ClientIF()
self.assertFalse(cif.getVMs())
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def test_with_vms(self):
cif = fake.ClientIF()
with fake.VM(params={'vmId': 'testvm1'}, cif=cif) as testvm1:
diff --git a/tests/deviceTests.py b/tests/deviceTests.py
index a248277..f1dcb76 100644
--- a/tests/deviceTests.py
+++ b/tests/deviceTests.py
@@ -26,10 +26,11 @@
from virt.vmdevices import hwclass
from virt.domain_descriptor import DomainDescriptor
-from monkeypatch import MonkeyPatchScope
+from monkeypatch import MonkeyPatchScope, MonkeyPatch
from testlib import permutations, expandPermutations
from testlib import VdsmTestCase as TestCaseBase
from testlib import XMLTestCase
+import caps
import vmfakelib as fake
@@ -121,6 +122,7 @@
self.confDeviceGraphics = (self.confDeviceGraphicsVnc +
self.confDeviceGraphicsSpice)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testGraphicsDeviceLegacy(self):
for conf in self.confDisplay:
conf.update(self.conf)
@@ -128,17 +130,20 @@
devs = testvm.devSpecMapFromConf()
self.assertTrue(devs['graphics'])
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testGraphicsDevice(self):
for dev in self.confDeviceGraphics:
with fake.VM(self.conf, dev) as testvm:
devs = testvm.devSpecMapFromConf()
self.assertTrue(devs['graphics'])
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testGraphicDeviceHeadless(self):
with fake.VM(self.conf) as testvm:
devs = testvm.devSpecMapFromConf()
self.assertFalse(devs['graphics'])
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testGraphicsDeviceMixed(self):
"""
if proper Graphics Devices are supplied, display* params must be
@@ -174,6 +179,7 @@
conf.update(self.conf)
self.assertTrue(vmdevices.graphics.isSupportedDisplayType(conf))
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testHasSpiceLegacy(self):
for conf in self.confDisplaySpice:
conf.update(self.conf)
@@ -185,6 +191,7 @@
with fake.VM(conf) as testvm:
self.assertFalse(testvm.hasSpice)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testHasSpice(self):
for dev in self.confDeviceGraphicsSpice:
with fake.VM(self.conf, dev) as testvm:
@@ -194,6 +201,7 @@
with fake.VM(self.conf, dev) as testvm:
self.assertFalse(testvm.hasSpice)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
@permutations([['vnc', 'spice'], ['spice', 'vnc']])
def testGraphicsDeviceMultiple(self, primary, secondary):
devices = [{'type': 'graphics', 'device': primary},
@@ -202,6 +210,7 @@
devs = testvm.devSpecMapFromConf()
self.assertTrue(len(devs['graphics']) == 2)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
@permutations([['vnc'], ['spice']])
def testGraphicsDeviceDuplicated(self, devType):
devices = [{'type': 'graphics', 'device': devType},
@@ -402,6 +411,7 @@
redir = vmdevices.core.Redir(self.conf, self.log, **dev)
self.assertXMLEqual(redir.getXML().toxml(), redirXML)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testGetUnderlyingGraphicsDeviceInfo(self):
port = '6000'
tlsPort = '6001'
@@ -435,6 +445,7 @@
self.assertEqual(graphDev.port, graphConf['port'])
self.assertEqual(graphDev.tlsPort, graphConf['tlsPort'])
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testLegacyGraphicsXML(self):
vmConfs = [
{'display': 'vnc', 'displayPort': '-1', 'displayNetwork':
@@ -456,6 +467,7 @@
for vmConf, xml in zip(vmConfs, self.GRAPHICS_XMLS):
self._verifyGraphicsXML(vmConf, xml, isLegacy=True)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testGraphicsDeviceXML(self):
vmConfs = [
{'devices': [{
@@ -518,6 +530,7 @@
memory = vmdevices.core.Memory(self.conf, self.log, **params)
self.assertXMLEqual(memory.getXML().toxml(), memoryXML)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testGraphicsNoDisplayNetwork(self):
with fake.VM() as testvm:
graphDev = vmdevices.graphics.Graphics(
@@ -525,6 +538,7 @@
self.assertNotIn('displayNetwork', graphDev.specParams)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testGraphicsDisplayNetworkFromSpecParams(self):
with fake.VM() as testvm:
graphDev = vmdevices.graphics.Graphics(
@@ -534,6 +548,7 @@
self.assertEqual(graphDev.specParams['displayNetwork'],
'vmDisplaySpecParams')
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testGraphicsDisplayNetworkFromVmConf(self):
conf = {'displayNetwork': 'vmDisplayConf'}
conf.update(self.conf)
@@ -544,6 +559,7 @@
self.assertEqual(graphDev.specParams['displayNetwork'],
'vmDisplayConf')
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testGraphicsDisplayNetworkFromSpecParamsOverridesVmConf(self):
conf = {'displayNetwork': 'vmDisplayConf'}
conf.update(self.conf)
diff --git a/tests/devices/parsing/complex_vm_tests.py b/tests/devices/parsing/complex_vm_tests.py
index 8eeb404..2ea3989 100644
--- a/tests/devices/parsing/complex_vm_tests.py
+++ b/tests/devices/parsing/complex_vm_tests.py
@@ -1,7 +1,8 @@
import os
+from monkeypatch import MonkeyPatch
from testlib import XMLTestCase
-
+import caps
from virt import domain_descriptor
import vmfakelib as fake
@@ -10,6 +11,7 @@
class TestVmDevicesXmlParsing(XMLTestCase, verify.DeviceMixin):
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def test_complex_vm(self):
params = {
'nicModel': 'rtl8139,pv', 'name': 'complexVm',
diff --git a/tests/numaUtilsTests.py b/tests/numaUtilsTests.py
index 3b6ae6f..ed8d478 100644
--- a/tests/numaUtilsTests.py
+++ b/tests/numaUtilsTests.py
@@ -60,6 +60,7 @@
self.assertEqual(vcpuPids, expectedVcpuPids)
@MonkeyPatch(numaUtils, 'supervdsm', fake.SuperVdsm())
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
@MonkeyPatch(caps,
'getNumaTopology',
lambda: {'0': {'cpus': [0, 1, 2, 3],
@@ -95,6 +96,7 @@
redundant.
"""
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def test_get_mapping_vcpu_to_pcpu(self):
# stolen from real libvirt
vcpu_output = (
diff --git a/tests/vmApiTests.py b/tests/vmApiTests.py
index fab799b..f3cf136 100644
--- a/tests/vmApiTests.py
+++ b/tests/vmApiTests.py
@@ -28,6 +28,7 @@
from rpc import vdsmapi
import API
+import caps
from clientIF import clientIF
from testValidation import brokentest
@@ -68,6 +69,7 @@
class TestVmStats(TestSchemaCompliancyBase):
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
@MonkeyPatch(vm.Vm, 'send_status_event', lambda x: None)
def testDownStats(self):
with fake.VM() as testvm:
diff --git a/tests/vmMigrationTests.py b/tests/vmMigrationTests.py
index 9f33296..25144d9 100644
--- a/tests/vmMigrationTests.py
+++ b/tests/vmMigrationTests.py
@@ -23,10 +23,11 @@
from vdsm.config import config
from virt import migration
-from monkeypatch import MonkeyPatchScope
+from monkeypatch import MonkeyPatchScope, MonkeyPatch
from testlib import VdsmTestCase as TestCaseBase
from testlib import permutations, expandPermutations
from testlib import make_config
+import caps
import vmfakelib as fake
@@ -51,16 +52,19 @@
# No special meaning, But steps just need to be >= 2
DOWNTIME = 1000
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
@permutations([[1], [2], [10]])
def test_update_downtime_using_n_steps(self, steps):
downtimes = _update_downtime_repeatedly(self.DOWNTIME, steps)
self.assertEqual(len(downtimes), steps)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
@permutations([[1], [2], [10]])
def test_update_downtime_monotonic_increasing(self, steps):
downtimes = _update_downtime_repeatedly(self.DOWNTIME, steps)
self.assertTrue(sorted(downtimes), downtimes)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
@permutations([[1], [2], [10]])
def test_update_downtime_converges(self, steps):
downtimes = _update_downtime_repeatedly(self.DOWNTIME, steps)
diff --git a/tests/vmOperationsTests.py b/tests/vmOperationsTests.py
index 79067bc..165656b 100644
--- a/tests/vmOperationsTests.py
+++ b/tests/vmOperationsTests.py
@@ -36,6 +36,7 @@
from monkeypatch import MonkeyPatch, MonkeyPatchScope
from testlib import VdsmTestCase as TestCaseBase
from testlib import permutations, expandPermutations
+import caps
import vmfakelib as fake
from testValidation import brokentest
@@ -75,6 +76,7 @@
GRAPHIC_DEVICES = [{'type': 'graphics', 'device': 'spice', 'port': '-1'},
{'type': 'graphics', 'device': 'vnc', 'port': '-1'}]
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
@MonkeyPatch(libvirtconnection, 'get', lambda x: fake.Connection())
@permutations([[define.NORMAL], [define.ERROR]])
def testTimeOffsetNotPresentByDefault(self, exitCode):
@@ -82,6 +84,7 @@
testvm.setDownStatus(exitCode, vmexitreason.GENERIC_ERROR)
self.assertFalse('timeOffset' in testvm.getStats())
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
@MonkeyPatch(libvirtconnection, 'get', lambda x: fake.Connection())
@permutations([[define.NORMAL], [define.ERROR]])
def testTimeOffsetRoundtrip(self, exitCode):
@@ -90,6 +93,7 @@
self.assertEqual(testvm.getStats()['timeOffset'],
self.BASE_OFFSET)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
@MonkeyPatch(libvirtconnection, 'get', lambda x: fake.Connection())
@permutations([[define.NORMAL], [define.ERROR]])
def testTimeOffsetRoundtriupAcrossInstances(self, exitCode):
@@ -104,6 +108,7 @@
# the field in getStats is str, not int
lastOffset = int(vmOffset)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
@MonkeyPatch(libvirtconnection, 'get', lambda x: fake.Connection())
@permutations([[define.NORMAL], [define.ERROR]])
def testTimeOffsetUpdateIfAbsent(self, exitCode):
@@ -116,6 +121,7 @@
self.assertEqual(testvm.getStats()['timeOffset'],
str(self.UPDATE_OFFSETS[-1]))
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
@MonkeyPatch(libvirtconnection, 'get', lambda x: fake.Connection())
@permutations([[define.NORMAL], [define.ERROR]])
def testTimeOffsetUpdateIfPresent(self, exitCode):
@@ -127,6 +133,7 @@
self.assertEqual(testvm.getStats()['timeOffset'],
str(self.BASE_OFFSET + self.UPDATE_OFFSETS[-1]))
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testUpdateSingleDeviceGraphics(self):
devXmls = (
'<graphics connected="disconnect" passwd="12345678"'
@@ -139,6 +146,7 @@
</devices>''' % device['device']
self._verifyDeviceUpdate(device, device, domXml, devXml)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testUpdateMultipleDeviceGraphics(self):
devXmls = (
'<graphics connected="disconnect" passwd="12345678"'
@@ -171,25 +179,30 @@
self.assertEquals(testvm._dom.devXml, devXml)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testDomainNotRunningWithoutDomain(self):
with fake.VM() as testvm:
self.assertFalse(testvm._isDomainRunning())
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testDomainNotRunningByState(self):
with fake.VM() as testvm:
testvm._dom = fake.Domain(domState=libvirt.VIR_DOMAIN_SHUTDOWN)
self.assertFalse(testvm._isDomainRunning())
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testDomainIsRunning(self):
with fake.VM() as testvm:
testvm._dom = fake.Domain(domState=libvirt.VIR_DOMAIN_RUNNING)
self.assertTrue(testvm._isDomainRunning())
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testDomainIsReadyForCommands(self):
with fake.VM() as testvm:
testvm._dom = fake.Domain()
self.assertTrue(testvm.isDomainReadyForCommands())
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testDomainDisappearedNotReadyForCommands(self):
def _fail(*args):
raise_libvirt_error(libvirt.VIR_ERR_NO_DOMAIN,
@@ -201,10 +214,12 @@
testvm._dom = dom
self.assertFalse(testvm.isDomainReadyForCommands())
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testDomainNoneNotReadyForCommands(self):
with fake.VM() as testvm:
self.assertFalse(testvm.isDomainReadyForCommands())
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testReadyForCommandsRaisesLibvirtError(self):
def _fail(*args):
# anything != NO_DOMAIN is good
@@ -218,11 +233,13 @@
self.assertRaises(libvirt.libvirtError,
testvm.isDomainReadyForCommands)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testReadPauseCodeDomainRunning(self):
with fake.VM() as testvm:
testvm._dom = fake.Domain(domState=libvirt.VIR_DOMAIN_RUNNING)
self.assertEqual(testvm._readPauseCode(), 'NOERR')
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testReadPauseCodeDomainPausedCrash(self):
# REQUIRED_FOR: el6
if not hasattr(libvirt, 'VIR_DOMAIN_PAUSED_CRASHED'):
@@ -236,6 +253,7 @@
testvm._dom = dom
self.assertNotEqual(testvm._readPauseCode(), 'ENOSPC')
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testReadPauseCodeDomainPausedENOSPC(self):
with fake.VM() as testvm:
dom = fake.Domain(domState=libvirt.VIR_DOMAIN_PAUSED,
@@ -245,6 +263,7 @@
testvm._dom = dom
self.assertEqual(testvm._readPauseCode(), 'ENOSPC')
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testReadPauseCodeDomainPausedEIO(self):
with fake.VM() as testvm:
dom = fake.Domain(domState=libvirt.VIR_DOMAIN_PAUSED,
@@ -254,6 +273,7 @@
testvm._dom = dom
self.assertEqual(testvm._readPauseCode(), 'EOTHER')
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
@permutations([[1000, 24], [900, 0], [1200, -128]])
def testSetCpuTuneQuote(self, quota, offset):
with fake.VM() as testvm:
@@ -265,6 +285,7 @@
self.assertEqual(quota + offset,
testvm._vcpuTuneInfo['vcpu_quota'])
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
@permutations([[100000, 128], [150000, 0], [9999, -99]])
def testSetCpuTunePeriod(self, period, offset):
with fake.VM() as testvm:
@@ -274,6 +295,7 @@
self.assertEqual(period + offset,
testvm._vcpuTuneInfo['vcpu_period'])
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
@brokentest("sometimes on CI tries to connect to libvirt")
@permutations([[libvirt.VIR_ERR_OPERATION_DENIED, 'setNumberOfCpusErr',
'Failed to set the number of cpus'],
@@ -294,6 +316,7 @@
self.assertEqual(res, response.error(vdsm_error))
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testUpdateDeviceGraphicsFailed(self):
with fake.VM(devices=self.GRAPHIC_DEVICES) as testvm:
message = 'fake timeout while setting ticket'
@@ -315,21 +338,25 @@
self.assertEqual(res,
response.error('ticketErr', message))
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testAcpiShutdownDisconnected(self):
with fake.VM() as testvm:
testvm._dom = virdomain.Disconnected(vmid='testvm')
self.assertTrue(response.is_error(testvm.acpiShutdown()))
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testAcpiShutdownConnected(self):
with fake.VM() as testvm:
testvm._dom = fake.Domain(vmId='testvm')
self.assertFalse(response.is_error(testvm.acpiShutdown()))
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testAcpiRebootDisconnected(self):
with fake.VM() as testvm:
testvm._dom = virdomain.Disconnected(vmid='testvm')
self.assertTrue(response.is_error(testvm.acpiReboot()))
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testAcpiRebootConnected(self):
with fake.VM() as testvm:
testvm._dom = fake.Domain(vmId='testvm')
diff --git a/tests/vmTests.py b/tests/vmTests.py
index fd381bc..0c7abb1 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -501,17 +501,20 @@
def testBuildCmdLinePPC64(self):
self.assertBuildCmdLine(CONF_TO_DOMXML_PPC64)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testGetVmPolicySucceded(self):
with fake.VM() as testvm:
testvm._dom = fake.Domain()
self.assertXMLEqual(testvm._getVmPolicy().toxml(), '<qos/>')
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testGetVmPolicyEmptyOnNoMetadata(self):
with fake.VM() as testvm:
testvm._dom = fake.Domain(
virtError=libvirt.VIR_ERR_NO_DOMAIN_METADATA)
self.assertXMLEqual(testvm._getVmPolicy().toxml(), '<qos/>')
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testGetVmPolicyFailOnNoDomain(self):
with fake.VM() as testvm:
testvm._dom = fake.Domain(virtError=libvirt.VIR_ERR_NO_DOMAIN)
@@ -520,6 +523,7 @@
def _xml_sanitizer(self, text):
return re.sub(">[\t\n ]+<", "><", text).strip()
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testUpdateVmPolicy(self):
with fake.VM() as machine:
dom = fake.Domain()
@@ -604,6 +608,7 @@
self.assertEqual(expected_xml, self._xml_sanitizer(dom._metadata))
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testCpuTune(self):
LIMIT = 50
with fake.VM(_VM_PARAMS) as machine:
@@ -615,6 +620,7 @@
stats = machine.getStats()
self.assertEqual(stats['vcpuUserLimit'], LIMIT)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testIoTuneParser(self):
with fake.VM() as machine:
dom = fake.Domain()
@@ -640,6 +646,7 @@
self.assertEqual(ioTuneValues, parsed)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testIoTuneMerge(self):
with fake.VM() as machine:
dom = fake.Domain()
@@ -692,6 +699,7 @@
self.assertEqual(ioTuneMerged, ioTuneExpectedValues)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testUpdateExistingVmPolicy(self):
with fake.VM() as machine:
dom = fake.Domain()
@@ -800,6 +808,7 @@
self.assertEqual(expected_xml, self._xml_sanitizer(dom._metadata))
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testGetIoTune(self):
with fake.VM() as machine:
dom = fake.Domain()
@@ -835,6 +844,7 @@
]
self.assertEqual(tunables, expected)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testSetIoTune(self):
drives = [
@@ -905,6 +915,7 @@
self.assertEqual(self._xml_sanitizer(drives[0]._deviceXML),
self._xml_sanitizer(expected_xml))
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testSdIds(self):
"""
Tests that VM storage domains in use list is in sync with the vm
@@ -956,12 +967,14 @@
self.assertEqual(machine.sdIds, set([domainID]))
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testVmGuestSocketFile(self):
with fake.VM(self.conf) as testvm:
self.assertEqual(
testvm._guestSocketFile,
testvm._makeChannelPath(vm._VMCHANNEL_DEVICE_NAME))
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def test_spice_restore_set_passwd(self):
# stolen from VDSM logs
conf = {
@@ -992,6 +1005,7 @@
@expandPermutations
class TestVmExit(TestCaseBase):
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
@permutations(VM_EXITS)
def testExitReason(self, exitCode, exitReason):
"""
@@ -1006,6 +1020,7 @@
self.assertEqual(stats['exitMessage'],
vmexitreason.exitReasons.get(exitReason))
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
@permutations(VM_EXITS)
def testExitReasonExplicitMessage(self, exitCode, exitReason):
"""
@@ -1030,6 +1045,7 @@
DEV_BALLOON = [{'type': 'balloon', 'specParams': {'model': 'virtio'}}]
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testGetNicStats(self):
GBPS = 10 ** 9 / 8
MAC = '52:54:00:59:F5:3F'
@@ -1071,6 +1087,7 @@
'rx': '0', 'tx': '625000000',
})
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testMultipleGraphicDeviceStats(self):
devices = [{'type': 'graphics', 'device': 'spice', 'port': '-1'},
{'type': 'graphics', 'device': 'vnc', 'port': '-1'}]
@@ -1086,6 +1103,7 @@
self.assertIn(statsDev['type'], confDev['device'])
self.assertIn('port', statsDev)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testDiskMappingHashInStatsHash(self):
with fake.VM(_VM_PARAMS) as testvm:
res = testvm.getStats()
@@ -1093,6 +1111,7 @@
self.assertNotEquals(res['hash'],
testvm.getStats()['hash'])
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
@MonkeyPatch(vm, 'config',
make_config([('vars', 'vm_command_timeout', '10')]))
def testMonitorTimeoutResponsive(self):
@@ -1102,6 +1121,7 @@
testvm._setUnresponsiveIfTimeout(stats, 1) # any value < timeout
self.assertEqual(stats['monitorResponse'], '0')
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
@MonkeyPatch(vm, 'config',
make_config([('vars', 'vm_command_timeout', '1')]))
def testMonitorTimeoutUnresponsive(self):
@@ -1112,6 +1132,7 @@
testvm._setUnresponsiveIfTimeout(stats, 10) # any value > timeout
self.assertEqual(stats['monitorResponse'], '-1')
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
@MonkeyPatch(vm, 'config',
make_config([('vars', 'vm_command_timeout', '10')]))
def testMonitorTimeoutOnAlreadyUnresponsive(self):
@@ -1126,6 +1147,7 @@
class TestLibVirtCallbacks(TestCaseBase):
FAKE_ERROR = 'EFAKERROR'
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def test_onIOErrorPause(self):
with fake.VM(_VM_PARAMS, runCpu=True) as testvm:
self.assertTrue(testvm._guestCpuRunning)
@@ -1134,6 +1156,7 @@
self.assertFalse(testvm._guestCpuRunning)
self.assertEqual(testvm.conf.get('pauseCode'), self.FAKE_ERROR)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def test_onIOErrorReport(self):
with fake.VM(_VM_PARAMS, runCpu=True) as testvm:
self.assertTrue(testvm._guestCpuRunning)
@@ -1142,6 +1165,7 @@
self.assertTrue(testvm._guestCpuRunning)
self.assertNotEquals(testvm.conf.get('pauseCode'), self.FAKE_ERROR)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def test_onIOErrorNotSupported(self):
"""action not explicitely handled, must be skipped"""
with fake.VM(_VM_PARAMS, runCpu=True) as testvm:
@@ -1189,18 +1213,21 @@
lambda: self._getAllDomains('novdsm'))]):
self.assertFalse(vm.getVDSMDomains())
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testGetPidNoFile(self):
with MonkeyPatchScope([(vm, 'supervdsm',
fake.SuperVdsm(exception=IOError))]):
with fake.VM() as testvm:
self.assertRaises(IOError, testvm._getPid)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testGetPidBadFile(self):
with MonkeyPatchScope([(vm, 'supervdsm',
fake.SuperVdsm(exception=ValueError))]):
with fake.VM() as testvm:
self.assertRaises(ValueError, testvm._getPid)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
@permutations([[-1], [0]])
def testGetPidBadFileContent(self, pid):
with MonkeyPatchScope([(vm, 'supervdsm',
@@ -1208,6 +1235,7 @@
with fake.VM() as testvm:
self.assertRaises(ValueError, testvm._getPid)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testGetPidSuccess(self):
pid = 42
with MonkeyPatchScope([(vm, 'supervdsm',
@@ -1256,6 +1284,7 @@
self.assertEqual(res['status']['code'],
define.errCode[specificErr]['status']['code'])
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testSucceed(self):
with fake.VM() as testvm:
testvm._dom = fake.Domain()
@@ -1265,14 +1294,17 @@
self.assertEqual(testvm._dom.__recording__,
[('setMemory', (target,), {})])
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testVmWithoutDom(self):
with fake.VM() as testvm:
self.assertAPIFailed(testvm.setBalloonTarget(128))
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testTargetValueNotInteger(self):
with fake.VM() as testvm:
self.assertAPIFailed(testvm.setBalloonTarget('foobar'))
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testLibvirtFailure(self):
with fake.VM() as testvm:
testvm._dom = fake.Domain(virtError=libvirt.VIR_ERR_INTERNAL_ERROR)
@@ -1282,19 +1314,23 @@
@expandPermutations
class TestVmSanity(TestCaseBase):
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testSmpPresentIfNotSpecified(self):
with fake.VM() as testvm:
self.assertEqual(int(testvm.conf['smp']), 1)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
@permutations([[1], [2], [4]])
def testSmpByParameters(self, cpus):
with fake.VM({'smp': cpus}) as testvm:
self.assertEqual(int(testvm.conf['smp']), cpus)
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testVmNameDefault(self):
with fake.VM(_VM_PARAMS) as testvm:
self.assertIn('vmName', testvm.getStats())
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def testVmNameExplicit(self):
NAME = 'not the default VM name'
params = {'vmName': NAME}
@@ -1305,6 +1341,7 @@
class ChangeBlockDevTests(TestCaseBase):
+ @MonkeyPatch(caps, 'getTargetArch', lambda: caps.Architecture.X86_64)
def test_change_cd_failure(self):
cif = fake.ClientIF()
with MonkeyPatchScope([(cif, 'prepareVolumePath',
--
To view, visit https://gerrit.ovirt.org/47577
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1dc65dfb15680ad018f83c2d51a6d1f09844aea2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
8 years, 6 months
Change in vdsm[master]: virt: un-memoize getNumaTopology
by Martin Polednik
Martin Polednik has uploaded a new change for review.
Change subject: virt: un-memoize getNumaTopology
......................................................................
virt: un-memoize getNumaTopology
The numa topology reflects which CPUs belong to which node. There is an
issue with memoization in this case:
If CPU is onlined or offlined while VDSM is running, the changes will
not be reflected. Anything attempting to get the CPUs from this call
(such as HostStatsThread) will not be updated and will try to sample
invalid CPUs.
Change-Id: I3e28688fabf8fc18252b3a35dfdd9a5a4071685b
Bug-Url: https://bugzilla.redhat.com/??????
Signed-off-by: Martin Polednik <mpolednik(a)redhat.com>
---
M vdsm/caps.py
1 file changed, 0 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/06/48006/1
diff --git a/vdsm/caps.py b/vdsm/caps.py
index 862f8cb..41b9b76 100644
--- a/vdsm/caps.py
+++ b/vdsm/caps.py
@@ -302,7 +302,6 @@
return True
-(a)utils.memoized
def getNumaTopology(capabilities=None):
if capabilities is None:
capabilities = _getCapsXMLStr()
--
To view, visit https://gerrit.ovirt.org/48006
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e28688fabf8fc18252b3a35dfdd9a5a4071685b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpolednik(a)redhat.com>
8 years, 6 months