Change in vdsm[master]: libvirtvm: use <interface type='network'>
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: libvirtvm: use <interface type='network'>
......................................................................
libvirtvm: use <interface type='network'>
In the future, this would allow us to migrate a VM from a bridge-based
network to funkier types of networks defined in
http://libvirt.org/formatnetwork.html .
Change-Id: If173a6351b1033c3a1c821cbadd05a2cbdf3d76c
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M tests/libvirtvmTests.py
M vdsm/libvirtvm.py
2 files changed, 15 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/41/9441/1
diff --git a/tests/libvirtvmTests.py b/tests/libvirtvmTests.py
index 4293276..2a0f097 100644
--- a/tests/libvirtvmTests.py
+++ b/tests/libvirtvmTests.py
@@ -261,10 +261,10 @@
def testInterfaceXML(self):
interfaceXML = """
- <interface type="bridge"> <address %s/>
+ <interface type="network"> <address %s/>
<mac address="52:54:00:59:F5:3F"/>
<model type="virtio"/>
- <source bridge="ovirtmgmt"/>
+ <source network="vdsm-ovirtmgmt"/>
<filterref filter="no-mac-spoofing"/>
<boot order="1"/>
<driver name="vhost"/>
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index 3439dc3..7bbab95 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -982,16 +982,17 @@
"""
Create domxml for network interface.
- <interface type="bridge">
+ <interface type="network">
<mac address="aa:bb:dd:dd:aa:bb"/>
<model type="virtio"/>
- <source bridge="engine"/>
+ <source network="vdsm-engine"/>
[<filterref filter='filter name'/>]
[<tune><sndbuf>0</sndbuf></tune>]
</interface>
"""
doc = xml.dom.minidom.Document()
iface = self.createXmlElem('interface', self.device, ['address'])
+ iface.setAttribute('type', 'network')
m = doc.createElement('mac')
m.setAttribute('address', self.macAddr)
iface.appendChild(m)
@@ -999,7 +1000,7 @@
m.setAttribute('type', self.nicModel)
iface.appendChild(m)
m = doc.createElement('source')
- m.setAttribute('bridge', self.network)
+ m.setAttribute('network', netinfo.LIBVIRT_NET_PREFIX + self.network)
iface.appendChild(m)
if hasattr(self, 'filter'):
m = doc.createElement('filterref')
@@ -2790,10 +2791,15 @@
mac = x.getElementsByTagName('mac')[0].getAttribute('address')
alias = x.getElementsByTagName('alias')[0].getAttribute('name')
model = x.getElementsByTagName('model')[0].getAttribute('type')
- bridge = None
+
+ network = None
source = x.getElementsByTagName('source')
if source:
- bridge = source[0].getAttribute('bridge')
+ network = source[0].getAttribute('bridge')
+ if not network:
+ network = source[0].getAttribute('network')
+ network = network[len(netinfo.LIBVIRT_NET_PREFIX):]
+
# Get nic address
address = self._getUnderlyingDeviceAddress(x)
for nic in self._devices[vm.NIC_DEVICES]:
@@ -2819,8 +2825,8 @@
'address': address,
'alias': alias,
'name': name}
- if bridge:
- nicDev['network'] = bridge
+ if network:
+ nicDev['network'] = network
self.conf['devices'].append(nicDev)
def _setWriteWatermarks(self):
--
To view, visit http://gerrit.ovirt.org/9441
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If173a6351b1033c3a1c821cbadd05a2cbdf3d76c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
10 years, 2 months
Change in vdsm[master]: Sometimes the FD number can be reused in the child process
by smizrahi@redhat.com
Saggi Mizrahi has uploaded a new change for review.
Change subject: Sometimes the FD number can be reused in the child process
......................................................................
Sometimes the FD number can be reused in the child process
This makes sure that the fd is the file that we expected to be closed child
process
Change-Id: I7044936fba8923297c76d9a2123215ec2b793548
Signed-off-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
M tests/betterPopenTests.py
1 file changed, 7 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/91/9591/1
diff --git a/tests/betterPopenTests.py b/tests/betterPopenTests.py
index 6347460..eb129f4 100644
--- a/tests/betterPopenTests.py
+++ b/tests/betterPopenTests.py
@@ -59,8 +59,9 @@
def testCloseFDs(self):
fds = os.pipe()
+ rpath = os.path.realpath("/proc/%d/fds/%d" % (os.getpid(), fds[1]))
try:
- self._subTest("fds", [str(fds[1])], close_fds=True)
+ self._subTest("fds", [str(fds[1]), rpath], close_fds=True)
finally:
os.close(fds[0])
os.close(fds[1])
@@ -154,11 +155,11 @@
if __name__ == "__main__":
cmd = sys.argv[1]
if cmd == "fds":
- try:
- os.close(int(sys.argv[2]))
- print "False"
- except:
- print "True"
+ fdpath = "/proc/%d/fds/%d" % (os.getpid(), int(sys.argv[2]))
+ if not os.path.exists(fdpath):
+ print True
+ else:
+ print (open(fdpath).read().strip() == sys.argv[3])
elif cmd == "nofds":
try:
--
To view, visit http://gerrit.ovirt.org/9591
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7044936fba8923297c76d9a2123215ec2b793548
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi(a)redhat.com>
10 years, 2 months
Change in vdsm[master]: Misc storage exception class name style
by shuming@linux.vnet.ibm.com
Shu Ming has uploaded a new change for review.
Change subject: Misc storage exception class name style
......................................................................
Misc storage exception class name style
All the misc storage exception class name should
be prefixed with "Misc"
Change-Id: I2f6f279d13b92bbb8f573a0d772d7504860bbbe3
Signed-off-by: Shu Ming <shuming(a)linux.vnet.ibm.com>
---
M vdsm/storage/sp.py
M vdsm/storage/storage_exception.py
2 files changed, 5 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/47/8847/1
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index 4aa63c0..7622556 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -220,7 +220,7 @@
.. note::
if the SPM is already started the function will fail silently.
- :raises: :exc:`storage_exception.OperationInProgress` if called during an already running connection attempt.
+ :raises: :exc:`storage_exception.MiscOperationInProgress` if called during an already running connection attempt.
(makes the fact that it fails silently does not matter very much).
"""
with self.lock:
@@ -228,7 +228,7 @@
return True
# Since we added the lock the following should NEVER happen
if self.spmRole == SPM_CONTEND:
- raise se.OperationInProgress("spm start %s" % self.spUUID)
+ raise se.MiscOperationInProgress("spm start %s" % self.spUUID)
self.updateMonitoringThreads()
self.invalidateMetadata()
@@ -1934,7 +1934,7 @@
self.log.error("TODO: Implement")
self._maxHostID
self.spmMailer.setMaxHostID(maxID)
- raise se.NotImplementedException
+ raise se.MiscNotImplementedException
def detachAllDomains(self):
diff --git a/vdsm/storage/storage_exception.py b/vdsm/storage/storage_exception.py
index 54e64e6..a25a588 100644
--- a/vdsm/storage/storage_exception.py
+++ b/vdsm/storage/storage_exception.py
@@ -125,7 +125,7 @@
# Misc Exceptions
#################################################
-class NotImplementedException(GeneralException):
+class MiscNotImplementedException(GeneralException):
code = 2000
message = "Method not implemented"
@@ -154,7 +154,7 @@
message = "Internal block device write failure"
-class OperationInProgress(StorageException):
+class MiscOperationInProgress(StorageException):
code = 2005
message = "Operation is already in progress"
--
To view, visit http://gerrit.ovirt.org/8847
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2f6f279d13b92bbb8f573a0d772d7504860bbbe3
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Shu Ming <shuming(a)linux.vnet.ibm.com>
10 years, 2 months
Change in vdsm[master]: confNet: ifcfg's VLAN should be set only on vlan cfg
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: confNet: ifcfg's VLAN should be set only on vlan cfg
......................................................................
confNet: ifcfg's VLAN should be set only on vlan cfg
If a misguided script calls addNetwork with explicit VLAN option, it
sohuld not be blindly copied to the top-most device.
We set VLAN=yes on the ifcfg script for the vlan device, and that's
that.
Change-Id: Ia2c9d6c86e73104424ca8ac901bf09e4b98a47ab
Bug-Id: BZ#847733
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm/configNetwork.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/11/7411/1
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 3f99a66..2ef0a8a 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -384,7 +384,7 @@
if mtu:
cfg = cfg + 'MTU=%d\n' % mtu
cfg += 'NM_CONTROLLED=no\n'
- BLACKLIST = ['TYPE', 'NAME', 'DEVICE', 'bondingOptions',
+ BLACKLIST = ['TYPE', 'NAME', 'DEVICE', 'VLAN', 'bondingOptions',
'force', 'blockingdhcp',
'connectivityCheck', 'connectivityTimeout',
'implicitBonding']
--
To view, visit http://gerrit.ovirt.org/7411
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia2c9d6c86e73104424ca8ac901bf09e4b98a47ab
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
10 years, 2 months
Change in vdsm[master]: avoid redundant domain produce() in createStoragePool
by lvroyce@linux.vnet.ibm.com
Royce Lv has uploaded a new change for review.
Change subject: avoid redundant domain produce() in createStoragePool
......................................................................
avoid redundant domain produce() in createStoragePool
Change-Id: If1c236aa3043068ca8f3f376cb340e986cd484bb
Signed-off-by: Royce Lv<lvroyce(a)linux.vnet.ibm.com>
---
M vdsm/storage/hsm.py
M vdsm/storage/sp.py
2 files changed, 4 insertions(+), 13 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/47/7347/1
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 2227c03..b2c20c0 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -765,19 +765,6 @@
if msdType in sd.BLOCK_DOMAIN_TYPES and msdVersion in blockSD.VERS_METADATA_LV and len(domList) > sp.MAX_DOMAINS:
raise se.TooManyDomainsInStoragePoolError()
- for sdUUID in domList:
- try:
- dom = sdCache.produce(sdUUID=sdUUID)
- # TODO: consider removing validate() from here, as the domains
- # are going to be accessed much later, and may loose validity
- # until then.
- dom.validate()
- except:
- raise se.StorageDomainAccessError(sdUUID)
- #If you remove this condition, remove it from StoragePool.attachSD() too.
- if dom.isData() and (dom.getVersion() != msdVersion):
- raise se.MixedSDVersionError(dom.sdUUID, dom.getVersion(), msd.sdUUID, msdVersion)
-
vars.task.getExclusiveLock(STORAGE, spUUID)
for dom in sorted(domList):
vars.task.getExclusiveLock(STORAGE, dom)
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index ee45151..a5b65c7 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -549,6 +549,7 @@
domain.validate()
if sdUUID == msdUUID:
msd = domain
+ msdVersion = msd.getVersion()
except se.StorageException:
self.log.error("Unexpected error", exc_info=True)
raise se.StorageDomainAccessError(sdUUID)
@@ -560,6 +561,9 @@
# Non ISO domains have only 1 pool
if len(spUUIDs) > 0:
raise se.StorageDomainAlreadyAttached(spUUIDs[0], sdUUID)
+
+ if domain.isData() and (domain.getVersion() != msdVersion):
+ raise se.MixedSDVersionError(domain.sdUUID, domain.getVersion(), msd.sdUUID, msdVersion)
fileUtils.createdir(self.poolPath)
self._acquireTemporaryClusterLock(msdUUID, safeLease)
--
To view, visit http://gerrit.ovirt.org/7347
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If1c236aa3043068ca8f3f376cb340e986cd484bb
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
10 years, 3 months
Change in vdsm[master]: get max_tasks and thread_pool_size from config by getint()
by shaohef@linux.vnet.ibm.com
ShaoHe Feng has uploaded a new change for review.
Change subject: get max_tasks and thread_pool_size from config by getint()
......................................................................
get max_tasks and thread_pool_size from config by getint()
It is OK to get max_tasks and thread_pool_size by getfloat()
The max_tasks will be passed to the Queue as maxsize and the
thread_pool_size is the thread number of the task thread pool.
So int is more reasonable than float
Change-Id: I9fc719b1b4238b0df2d9c882777cb75d7a27d4df
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
M vdsm/storage/storage_mailbox.py
M vdsm/storage/taskManager.py
2 files changed, 6 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/35/9035/1
diff --git a/vdsm/storage/storage_mailbox.py b/vdsm/storage/storage_mailbox.py
index c537883..1c8700d 100644
--- a/vdsm/storage/storage_mailbox.py
+++ b/vdsm/storage/storage_mailbox.py
@@ -208,9 +208,9 @@
def __init__(self, inbox, outbox, hostID, queue, monitorInterval):
# Save arguments
- tpSize = config.getfloat('irs', 'thread_pool_size') / 2
+ tpSize = config.getint('irs', 'thread_pool_size') / 2
waitTimeout = 3
- maxTasks = config.getfloat('irs', 'max_tasks')
+ maxTasks = config.getint('irs', 'max_tasks')
self.tp = ThreadPool(tpSize, waitTimeout, maxTasks)
self._stop = False
self._flush = False
@@ -466,9 +466,9 @@
self._stopped = False
self._poolID = str(pool.spUUID)
self._spmStorageDir = pool.storage_repository
- tpSize = config.getfloat('irs', 'thread_pool_size') / 2
+ tpSize = config.getint('irs', 'thread_pool_size') / 2
waitTimeout = 3
- maxTasks = config.getfloat('irs', 'max_tasks')
+ maxTasks = config.getint('irs', 'max_tasks')
self.tp = ThreadPool(tpSize, waitTimeout, maxTasks)
# *** IMPORTANT NOTE: The SPM's inbox is the HSMs' outbox and vice versa *** #
self._inbox = os.path.join(self._spmStorageDir, self._poolID, "mastersd", sd.DOMAIN_META_DATA, "inbox")
diff --git a/vdsm/storage/taskManager.py b/vdsm/storage/taskManager.py
index 3bc12f3..f7a5da2 100644
--- a/vdsm/storage/taskManager.py
+++ b/vdsm/storage/taskManager.py
@@ -31,9 +31,9 @@
log = logging.getLogger('TaskManager')
def __init__(self,
- tpSize=config.getfloat('irs', 'thread_pool_size'),
+ tpSize=config.getint('irs', 'thread_pool_size'),
waitTimeout=3,
- maxTasks=config.getfloat('irs', 'max_tasks')):
+ maxTasks=config.getint('irs', 'max_tasks')):
self.storage_repository = config.get('irs', 'repository')
self.tp = ThreadPool(tpSize, waitTimeout, maxTasks)
self._tasks = {}
--
To view, visit http://gerrit.ovirt.org/9035
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9fc719b1b4238b0df2d9c882777cb75d7a27d4df
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
10 years, 3 months
Change in vdsm[master]: vdsm: fix RTC offset
by peet@redhat.com
Peter V. Saveliev has uploaded a new change for review.
Change subject: vdsm: fix RTC offset
......................................................................
vdsm: fix RTC offset
Upon RTC update (hwclock --systohc) on the guest side, libvirt sends the event
with RTC offset from the qemu start -rtc value in seconds. The received offset
should not replace the previous value, but should be added to it. Since the
time update event is relative to the qemu start time, we should store the
initial value and use it for the calculation.
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=956741
Change-Id: I27c70a53f64fb05607e93bffbac25fdee7d1cd2a
Signed-off-by: Peter V. Saveliev <peet(a)redhat.com>
---
M vdsm/vm.py
1 file changed, 4 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/50/14750/1
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 2b76662..bbc833a 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -351,6 +351,7 @@
self.id = self.conf['vmId']
self._volPrepareLock = threading.Lock()
self._initTimePauseCode = None
+ self._initTimeRTC = None
self.guestAgent = None
self._guestEvent = 'Powering up'
self._guestEventTime = 0
@@ -852,7 +853,9 @@
def _rtcUpdate(self, timeOffset):
self.log.debug('new rtc offset %s', timeOffset)
with self._confLock:
- self.conf['timeOffset'] = timeOffset
+ if self._initTimeRTC is None:
+ self._initTimeRTC = long(self.conf['timeOffset'])
+ self.conf['timeOffset'] = self._initTimeRTC + long(timeOffset)
def extendDriveVolume(self, vmDrive):
if not vmDrive.blockDev:
--
To view, visit http://gerrit.ovirt.org/14750
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I27c70a53f64fb05607e93bffbac25fdee7d1cd2a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Peter V. Saveliev <peet(a)redhat.com>
10 years, 3 months
Change in vdsm[master]: [poc] vm: do not pause during refreshVolume
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: [poc] vm: do not pause during refreshVolume
......................................................................
[poc] vm: do not pause during refreshVolume
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
Change-Id: I896993c00b94c3255ad2007486e0589bf10b3a98
---
M vdsm/vm.py
1 file changed, 2 insertions(+), 13 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/82/8382/1
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 64644f0..686a589 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -743,19 +743,8 @@
self.__extendDriveVolume(vmDrive, newSize)
def __refreshDriveVolume(self, volInfo):
- """ Stop vm before refreshing LV. """
-
- self._guestCpuLock.acquire()
- try:
- wasRunning = self._guestCpuRunning
- if wasRunning:
- self.pause(guestCpuLocked=True)
- self.cif.irs.refreshVolume(volInfo['domainID'],
- volInfo['poolID'], volInfo['imageID'], volInfo['volumeID'])
- if wasRunning:
- self.cont(guestCpuLocked=True)
- finally:
- self._guestCpuLock.release()
+ self.cif.irs.refreshVolume(volInfo['domainID'], volInfo['poolID'],
+ volInfo['imageID'], volInfo['volumeID'])
def __afterReplicaExtend(self, volInfo):
self.log.debug("Refreshing replica volume: %s", volInfo)
--
To view, visit http://gerrit.ovirt.org/8382
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I896993c00b94c3255ad2007486e0589bf10b3a98
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
10 years, 3 months
Change in vdsm[master]: add a json rpc funtional test which sets up a VM
by shaohef@linux.vnet.ibm.com
ShaoHe Feng has uploaded a new change for review.
Change subject: add a json rpc funtional test which sets up a VM
......................................................................
add a json rpc funtional test which sets up a VM
This test create a VM and destroy it.
It take full advantage of xml test.
Change-Id: I734614fdc9515e2883004aceafb36291ee44e59a
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
M tests/functional/Makefile.am
A tests/functional/jsonrpcTests.py
2 files changed, 140 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/86/11386/1
diff --git a/tests/functional/Makefile.am b/tests/functional/Makefile.am
index 98f0a60..80b1752 100644
--- a/tests/functional/Makefile.am
+++ b/tests/functional/Makefile.am
@@ -23,6 +23,7 @@
dist_vdsmfunctests_PYTHON = \
functionalUtils.py \
jsonrpcSeverClient.py \
+ jsonrpcTests.py \
momTests.py \
sosPluginTests.py \
xmlrpcTests.py \
diff --git a/tests/functional/jsonrpcTests.py b/tests/functional/jsonrpcTests.py
new file mode 100644
index 0000000..64c5bc8
--- /dev/null
+++ b/tests/functional/jsonrpcTests.py
@@ -0,0 +1,139 @@
+#
+# Copyright 2012 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+
+from vdsm.config import config
+from jsonrpcSeverClient import jsonRpcServerClient as jrpcClient
+from functionalUtils import kernelBootImages
+from functools import wraps
+from testrunner import VdsmTestCase as TestCaseBase
+from nose.plugins.skip import SkipTest
+
+if not config.getboolean('vars', 'jsonrpc_enable'):
+ raise SkipTest("JSON-RPC Bindings are disabled")
+
+ip = "127.0.0.1"
+port = config.getint('addresses', 'json_port')
+
+
+def skipNoKVM(method):
+ @wraps(method)
+ def wrapped(self, *args, **kwargs):
+ r = self.s.Host.getCapabilities()
+ self.assertVdsOK(r)
+ if r['result']['kvmEnabled'] != 'true':
+ raise SkipTest('KVM is not enabled')
+ return method(self, *args, **kwargs)
+ return wrapped
+
+
+class jsonRPCTest(TestCaseBase):
+ UPSTATES = frozenset(('Up', 'Powering up', 'Running'))
+
+ def setUp(self):
+ self.s = jrpcClient(ip, port)
+
+ def testHostPing(self):
+ r = self.s.Host.ping()
+ self.assertVdsOK(r)
+
+ def assertVmUp(self, vmid):
+ r = self.s.VM.getStats(vmid)
+ self.assertVdsOK(r)
+ self.myAssertIn(r['result'][0]['status'], self.UPSTATES)
+
+ def assertGuestUp(self, vmid):
+ r = self.s.VM.getStats(vmid)
+ self.assertVdsOK(r)
+ self.assertEquals(r['result'][0]['status'], 'Up')
+
+ def myAssertIn(self, member, container, msg=None):
+ "Poor man's reimplementation of Python2.7's unittest.assertIn"
+
+ if hasattr(self, 'assertIn'):
+ return self.assertIn(member, container, msg)
+
+ if msg is None:
+ msg = '%r not found in %r' % (member, container)
+
+ self.assertTrue(member in container, msg)
+
+ def assertVdsOK(self, vdsResult):
+ # according to json-rpc standard,
+ # either 'error' or 'result' can appear in the response but not both
+ # So success should be measured by the absence of the 'error' element
+ self.assertFalse('error' in vdsResult)
+
+ @skipNoKVM
+ def testStartEmptyVM(self):
+ VMID = '66666666-ffff-4444-bbbb-333333333333'
+ vmParams = {'memSize': '100', 'display': 'vnc',
+ 'vmId': VMID, 'vmName': 'foo'}
+ r = self.s.VM.create(VMID, vmParams)
+ self.assertVdsOK(r)
+ try:
+ self.retryAssert(lambda: self.assertVmUp(VMID), timeout=20)
+ finally:
+ # FIXME: if the server dies now, we end up with a leaked VM.
+ r = self.s.VM.destroy(VMID)
+ self.assertVdsOK(r)
+
+ @skipNoKVM
+ def testStartSmallVM(self):
+ customization = {'vmId': '77777777-ffff-3333-bbbb-222222222222',
+ 'vmName': 'vdsm_testSmallVM'}
+
+ self._runVMKernelBootTemplate(customization)
+
+ def _runVMKernelBootTemplate(self, vmDef={}, distro='fedora'):
+ kernelArgsDistro = {
+ # Fedora: The initramfs is generated by dracut. The following
+ # arguments will be interpreted by init scripts created by dracut.
+ 'fedora': 'rd.break=cmdline rd.shell rd.skipfsck'}
+ kernelArgsDistro['rhel'] = kernelArgsDistro['fedora']
+ if distro.lower() not in kernelArgsDistro:
+ raise SkipTest("Don't know how to perform direct kernel boot for "
+ "%s" % distro)
+
+ template = {'vmId': '11111111-abcd-2222-ffff-333333333333',
+ 'vmName': 'vdsmKernelBootVM',
+ 'display': 'vnc',
+ 'kvmEnable': 'true',
+ 'memSize': '256',
+ 'vmType': 'kvm',
+ 'kernelArgs': kernelArgsDistro[distro]}
+ template.update(vmDef)
+ vmid = template['vmId']
+
+ def assertVMAndGuestUp():
+ self.assertVmUp(vmid)
+ self.assertGuestUp(vmid)
+
+ with kernelBootImages() as (kernelPath, initramfsPath):
+ template.update(
+ {'kernel': kernelPath,
+ 'initrd': initramfsPath})
+ try:
+ self.assertVdsOK(self.s.VM.create(vmid, template))
+ # wait 65 seconds for VM to come up until timeout
+ self.retryAssert(assertVMAndGuestUp, timeout=65)
+ finally:
+ destroyResult = self.s.VM.destroy(vmid)
+
+ self.assertVdsOK(destroyResult)
--
To view, visit http://gerrit.ovirt.org/11386
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I734614fdc9515e2883004aceafb36291ee44e59a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
10 years, 3 months
Change in vdsm[master]: remove redundant libvirt call
by peet@redhat.com
Peter V. Saveliev has uploaded a new change for review.
Change subject: remove redundant libvirt call
......................................................................
remove redundant libvirt call
Checking UUIDString() adresses the bug #603494, which
is closed ages ago. While it is nice to support really
ancient libvirt versions, it costs us one extra
libvirt call. Given global libvirt driver lock, it
does matter in mass VM creation.
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=603494
Signed-off-by: Peter V. Saveliev <peet(a)redhat.com>
Change-Id: I06a71c2e44332f50b3203a0a8f1bfa799914b684
---
M vdsm/libvirtvm.py
1 file changed, 0 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/54/11054/1
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index d13dbb0..9376e5c 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -1539,8 +1539,6 @@
self._dom = NotifyingVirDomain(
self._connection.createXML(domxml, flags),
self._timeoutExperienced)
- if self._dom.UUIDString() != self.id:
- raise Exception('libvirt bug 603494')
hooks.after_vm_start(self._dom.XMLDesc(0), self.conf)
if not self._dom:
self.setDownStatus(ERROR, 'failed to start libvirt vm')
--
To view, visit http://gerrit.ovirt.org/11054
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I06a71c2e44332f50b3203a0a8f1bfa799914b684
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Peter V. Saveliev <peet(a)redhat.com>
10 years, 4 months