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]: [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, 4 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, 4 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
Change in vdsm[master]: storage: refactor nfsSD.py for posix storage
by gpadgett@redhat.com
Greg Padgett has uploaded a new change for review.
Change subject: storage: refactor nfsSD.py for posix storage
......................................................................
storage: refactor nfsSD.py for posix storage
NFS and PosixFs domains are no longer handled the same way, so logic
that differs between them should be appropriately separated into
classes for each connection type. This removes the need to have a
storageType parameter to NfsStorageDomain:_preCreateValidation().
For now, there's no reason to have a PosixFsStorageDomain class for
Posix storage (it would be empty), so just use MountableStorageDomain
until the need for a subclass arises.
Change-Id: Ic5788925f9c11b417aba713c652fc2a92f178830
Signed-off-by: Greg Padgett <gpadgett(a)redhat.com>
---
M Makefile.am
M vdsm.spec.in
M vdsm/storage/Makefile.am
M vdsm/storage/hsm.py
A vdsm/storage/mountableSD.py
M vdsm/storage/nfsSD.py
M vdsm/storage/sdc.py
7 files changed, 148 insertions(+), 114 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/88/9088/1
diff --git a/Makefile.am b/Makefile.am
index bd262af..a96d3f7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -83,6 +83,7 @@
vdsm/storage/lvm.py \
vdsm/storage/misc.py \
vdsm/storage/mount.py \
+ vdsm/storage/mountableSD.py \
vdsm/storage/multipath.py \
vdsm/storage/nfsSD.py \
vdsm/storage/outOfProcess.py \
diff --git a/vdsm.spec.in b/vdsm.spec.in
index c117ee5..d76495c 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -661,6 +661,7 @@
%{_datadir}/%{vdsm_name}/storage/lvm.py*
%{_datadir}/%{vdsm_name}/storage/misc.py*
%{_datadir}/%{vdsm_name}/storage/mount.py*
+%{_datadir}/%{vdsm_name}/storage/mountableSD.py*
%{_datadir}/%{vdsm_name}/storage/multipath.py*
%{_datadir}/%{vdsm_name}/storage/nfsSD.py*
%{_datadir}/%{vdsm_name}/storage/outOfProcess.py*
diff --git a/vdsm/storage/Makefile.am b/vdsm/storage/Makefile.am
index cff09be..cf8f768 100644
--- a/vdsm/storage/Makefile.am
+++ b/vdsm/storage/Makefile.am
@@ -41,6 +41,7 @@
lvm.py \
misc.py \
mount.py \
+ mountableSD.py \
multipath.py \
nfsSD.py \
outOfProcess.py \
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 259676b..f56c8b0 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -41,8 +41,9 @@
import sp
import sd
import blockSD
-import nfsSD
import localFsSD
+import mountableSD
+import nfsSD
import lvm
import fileUtils
import multipath
@@ -2251,16 +2252,18 @@
#getSharedLock(connectionsResource...)
#getExclusiveLock(sdUUID...)
- if storageType in sd.BLOCK_DOMAIN_TYPES:
- newSD = blockSD.BlockStorageDomain.create(sdUUID, domainName,
- domClass, typeSpecificArg, storageType, domVersion)
- elif storageType in (sd.NFS_DOMAIN, sd.POSIXFS_DOMAIN):
- newSD = nfsSD.NfsStorageDomain.create(sdUUID, domainName, domClass,
- typeSpecificArg, storageType, domVersion)
- elif storageType == sd.LOCALFS_DOMAIN:
- newSD = localFsSD.LocalFsStorageDomain.create(sdUUID, domainName,
- domClass, typeSpecificArg, storageType, domVersion)
- else:
+ sdConstructorMap = {
+ sd.NFS_DOMAIN : nfsSD.NfsStorageDomain,
+ sd.POSIXFS_DOMAIN : mountableSD.MountableStorageDomain,
+ sd.LOCALFS_DOMAIN : localFsSD.LocalFsStorageDomain,
+ }
+ for domType in sd.BLOCK_DOMAIN_TYPES:
+ sdConstructorMap[domType] = blockSD.BlockStorageDomain
+
+ try:
+ newSD = sdConstructorMap[storageType].create(sdUUID, domainName,
+ domClass, typeSpecificArg, storageType, domVersion)
+ except KeyError:
raise se.StorageDomainTypeError(storageType)
sdCache.manuallyAddDomain(newSD)
diff --git a/vdsm/storage/mountableSD.py b/vdsm/storage/mountableSD.py
new file mode 100644
index 0000000..05284ab
--- /dev/null
+++ b/vdsm/storage/mountableSD.py
@@ -0,0 +1,122 @@
+#
+# Copyright 2009-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
+#
+
+import os
+
+import sd
+import fileSD
+import fileUtils
+import storage_exception as se
+import outOfProcess as oop
+import mount
+import misc
+
+
+class MountableStorageDomain(fileSD.FileStorageDomain):
+
+ @classmethod
+ def _preCreateValidation(cls, sdUUID, domPath, typeSpecificArg, version):
+ # Some trivial resource validation
+ sd.validateDomainVersion(version)
+
+ # Make sure the underlying file system is mounted
+ if not mount.isMounted(domPath):
+ raise se.StorageDomainFSNotMounted(domPath)
+
+ fileSD.validateDirAccess(domPath)
+
+ # Make sure there are no remnants of other domain
+ mdpat = os.path.join(domPath, "*", sd.DOMAIN_META_DATA)
+ if len(oop.getProcessPool(sdUUID).glob.glob(mdpat)) > 0:
+ raise se.StorageDomainNotEmpty(typeSpecificArg)
+
+ @classmethod
+ def create(cls, sdUUID, domainName, domClass, remotePath, storageType,
+ version):
+ """
+ Create new storage domain.
+ 'sdUUID' - Storage Domain UUID
+ 'domainName' - storage domain name ("iso" or "data domain name")
+ 'domClass' - Data/Iso
+ 'remotePath' - server:/export_path
+ 'storageType' - NFS_DOMAIN, LOCALFS_DOMAIN, &etc.
+ 'version' - DOMAIN_VERSIONS
+ """
+ cls.log.info("sdUUID=%s domainName=%s remotePath=%s "
+ "domClass=%s", sdUUID, domainName, remotePath, domClass)
+
+ if not misc.isAscii(domainName) and not sd.supportsUnicode(version):
+ raise se.UnicodeArgumentException()
+
+ # Create local path
+ mntPath = fileUtils.transformPath(remotePath)
+
+ mntPoint = os.path.join(cls.storage_repository,
+ sd.DOMAIN_MNT_POINT, mntPath)
+
+ cls._preCreateValidation(sdUUID, mntPoint, remotePath, version)
+
+ domainDir = os.path.join(mntPoint, sdUUID)
+ cls._prepareMetadata(domainDir, sdUUID, domainName, domClass,
+ remotePath, storageType, version)
+
+ # create domain images folder
+ imagesDir = os.path.join(domainDir, sd.DOMAIN_IMAGES)
+ oop.getProcessPool(sdUUID).fileUtils.createdir(imagesDir)
+
+ # create special imageUUID for ISO/Floppy volumes
+ if domClass is sd.ISO_DOMAIN:
+ isoDir = os.path.join(imagesDir, sd.ISO_IMAGE_UUID)
+ oop.getProcessPool(sdUUID).fileUtils.createdir(isoDir)
+
+ fsd = cls(os.path.join(mntPoint, sdUUID))
+ fsd.initSPMlease()
+
+ return fsd
+
+ def selftest(self):
+ """
+ Run internal self test
+ """
+ if not mount.isMounted(self.mountpoint):
+ raise se.StorageDomainFSNotMounted(self.mountpoint)
+
+ # Run general part of selftest
+ fileSD.FileStorageDomain.selftest(self)
+
+ @staticmethod
+ def findDomainPath(sdUUID):
+ for tmpSdUUID, domainPath in fileSD.scanDomains("*"):
+ if tmpSdUUID == sdUUID and mount.isMounted(
+ os.path.join(domainPath, "..")):
+ return domainPath
+
+ raise se.StorageDomainDoesNotExist(sdUUID)
+
+ def getRealPath(self):
+ try:
+ return mount.getMountFromTarget(self.mountpoint).fs_spec
+ except mount.MountError:
+ return ""
+
+
+def findDomain(sdUUID):
+ return MountableStorageDomain(MountableStorageDomain
+ .findDomainPath(sdUUID))
diff --git a/vdsm/storage/nfsSD.py b/vdsm/storage/nfsSD.py
index 3a1c90e..15dd137 100644
--- a/vdsm/storage/nfsSD.py
+++ b/vdsm/storage/nfsSD.py
@@ -1,5 +1,5 @@
#
-# Copyright 2009-2011 Red Hat, Inc.
+# Copyright 2009-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
@@ -18,110 +18,16 @@
# Refer to the README and COPYING files for full details of the license
#
-import os
-
-import sd
-import fileSD
-import fileUtils
+import mountableSD
import storage_exception as se
-import outOfProcess as oop
-import mount
-import misc
-class NfsStorageDomain(fileSD.FileStorageDomain):
+class NfsStorageDomain(mountableSD.MountableStorageDomain):
@classmethod
- def _preCreateValidation(cls, sdUUID, domPath, typeSpecificArg,
- storageType, version):
- # Some trivial resource validation
- # TODO Checking storageType==nfs in the nfs class is not clean
- if storageType == sd.NFS_DOMAIN and ":" not in typeSpecificArg:
+ def _preCreateValidation(cls, sdUUID, domPath, typeSpecificArg, version):
+ if ":" not in typeSpecificArg:
raise se.StorageDomainIllegalRemotePath(typeSpecificArg)
- sd.validateDomainVersion(version)
-
- # Make sure the underlying file system is mounted
- if not mount.isMounted(domPath):
- raise se.StorageDomainFSNotMounted(domPath)
-
- fileSD.validateDirAccess(domPath)
-
- # Make sure there are no remnants of other domain
- mdpat = os.path.join(domPath, "*", sd.DOMAIN_META_DATA)
- if len(oop.getProcessPool(sdUUID).glob.glob(mdpat)) > 0:
- raise se.StorageDomainNotEmpty(typeSpecificArg)
-
- @classmethod
- def create(cls, sdUUID, domainName, domClass, remotePath, storageType,
- version):
- """
- Create new storage domain.
- 'sdUUID' - Storage Domain UUID
- 'domainName' - storage domain name ("iso" or "data domain name")
- 'domClass' - Data/Iso
- 'remotePath' - server:/export_path
- 'storageType' - NFS_DOMAIN, LOCALFS_DOMAIN, &etc.
- 'version' - DOMAIN_VERSIONS
- """
- cls.log.info("sdUUID=%s domainName=%s remotePath=%s "
- "domClass=%s", sdUUID, domainName, remotePath, domClass)
-
- if not misc.isAscii(domainName) and not sd.supportsUnicode(version):
- raise se.UnicodeArgumentException()
-
- # Create local path
- mntPath = fileUtils.transformPath(remotePath)
-
- mntPoint = os.path.join(cls.storage_repository,
- sd.DOMAIN_MNT_POINT, mntPath)
-
- cls._preCreateValidation(sdUUID, mntPoint, remotePath, storageType,
- version)
-
- domainDir = os.path.join(mntPoint, sdUUID)
- cls._prepareMetadata(domainDir, sdUUID, domainName, domClass,
- remotePath, storageType, version)
-
- # create domain images folder
- imagesDir = os.path.join(domainDir, sd.DOMAIN_IMAGES)
- oop.getProcessPool(sdUUID).fileUtils.createdir(imagesDir)
-
- # create special imageUUID for ISO/Floppy volumes
- if domClass is sd.ISO_DOMAIN:
- isoDir = os.path.join(imagesDir, sd.ISO_IMAGE_UUID)
- oop.getProcessPool(sdUUID).fileUtils.createdir(isoDir)
-
- fsd = cls(os.path.join(mntPoint, sdUUID))
- fsd.initSPMlease()
-
- return fsd
-
- def selftest(self):
- """
- Run internal self test
- """
- if not mount.isMounted(self.mountpoint):
- raise se.StorageDomainFSNotMounted(self.mountpoint)
-
- # Run general part of selftest
- fileSD.FileStorageDomain.selftest(self)
-
- @staticmethod
- def findDomainPath(sdUUID):
- for tmpSdUUID, domainPath in fileSD.scanDomains("*"):
- if tmpSdUUID == sdUUID and mount.isMounted(
- os.path.join(domainPath, "..")):
- return domainPath
-
- raise se.StorageDomainDoesNotExist(sdUUID)
-
- def getRealPath(self):
- try:
- return mount.getMountFromTarget(self.mountpoint).fs_spec
- except mount.MountError:
- return ""
-
-
-def findDomain(sdUUID):
- return NfsStorageDomain(NfsStorageDomain.findDomainPath(sdUUID))
+ mountableSD.MountableStorageDomain._preCreateValidation(sdUUID,
+ domPath, typeSpecificArg, version)
diff --git a/vdsm/storage/sdc.py b/vdsm/storage/sdc.py
index f2f4534..1064b5e 100644
--- a/vdsm/storage/sdc.py
+++ b/vdsm/storage/sdc.py
@@ -132,7 +132,7 @@
def _findDomain(self, sdUUID):
import blockSD
import localFsSD
- import nfsSD
+ import mountableSD
# The order is somewhat important, it's ordered
# by how quickly get can find the domain. For instance
@@ -140,7 +140,7 @@
# until it times out, this should affect fetching
# of block\local domains. If for any case in the future
# this changes, please update the order.
- for mod in (blockSD, localFsSD, nfsSD):
+ for mod in (blockSD, localFsSD, mountableSD):
try:
return mod.findDomain(sdUUID)
except se.StorageDomainDoesNotExist:
--
To view, visit http://gerrit.ovirt.org/9088
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic5788925f9c11b417aba713c652fc2a92f178830
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Greg Padgett <gpadgett(a)redhat.com>
10 years, 4 months
Change in vdsm[master]: Adding monitorPoolDomains replacing connectStoragePool.
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: Adding monitorPoolDomains replacing connectStoragePool.
......................................................................
Adding monitorPoolDomains replacing connectStoragePool.
Spliting the share storage and host views of the pool in order
to remove the pool concept.
Change-Id: I1db3aeb5d2c3ab5a4ad90c175bc3e576726f0336
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/hsm.py
M vdsm/storage/sp.py
M vdsm_cli/vdsClient.py
3 files changed, 58 insertions(+), 10 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/37/11937/1
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 29980f3..3b0d4e3 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -932,6 +932,30 @@
return self._connectStoragePool(spUUID, hostID, scsiKey, msdUUID,
masterVersion, options)
+ @public
+ def monitorPoolDomains(self, spUUID, hostID, scsiKey, msdUUID,
+ masterVersion, domains):
+ with rmanager.acquireResource(STORAGE, spUUID, rm.LockType.exclusive):
+ try:
+ pool = self.getPool(spUUID)
+ except se.StoragePoolUnknown:
+ pass # pool not connected yet
+ else:
+ return True
+
+ pool = sp.StoragePool(spUUID, self.taskMng)
+ pool.id = hostID
+ pool.scsiKey = scsiKey
+ # In memory list of domains
+ pool.domains = domains
+
+ pool.rebuild(msdUUID=msdUUID, masterVersion=masterVersion)
+
+ pool.createMailboxMonitor()
+
+ self.pools[spUUID] = pool
+ return True
+
def _connectStoragePool(self, spUUID, hostID, scsiKey, msdUUID,
masterVersion, options=None):
misc.validateUUID(spUUID, 'spUUID')
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index fb352e2..4897be8 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -463,7 +463,7 @@
kwargs={"__securityOverride": True}).start()
@unsecured
- def __createMailboxMonitor(self):
+ def createMailboxMonitor(self):
if self.hsmMailer:
return
@@ -613,7 +613,7 @@
# During 'master' marking we create pool metadata and each attached
# domain should register there
self.createMaster(poolName, msd, masterVersion, leaseParams)
- self.__rebuild(msdUUID=msdUUID, masterVersion=masterVersion)
+ self.rebuild(msdUUID=msdUUID, masterVersion=masterVersion)
# Attach storage domains to the storage pool
# Since we are creating the pool then attach is done from the hsm
# and not the spm therefore we must manually take the master domain
@@ -685,8 +685,8 @@
sdCache.invalidateStorage()
sdCache.refresh()
# Rebuild whole Pool
- self.__rebuild(msdUUID=msdUUID, masterVersion=masterVersion)
- self.__createMailboxMonitor()
+ self.rebuild(msdUUID=msdUUID, masterVersion=masterVersion)
+ self.createMailboxMonitor()
return True
@@ -1212,7 +1212,7 @@
domPoolMD[PMDK_MASTER_VER] = 0
@unsecured
- def __rebuild(self, msdUUID, masterVersion):
+ def rebuild(self, msdUUID, masterVersion):
"""
Rebuild storage pool.
"""
@@ -1291,7 +1291,7 @@
"""
sdCache.invalidateStorage()
sdCache.refresh()
- self.__rebuild(msdUUID=msdUUID, masterVersion=masterVersion)
+ self.rebuild(msdUUID=msdUUID, masterVersion=masterVersion)
def updateVM(self, vmList, sdUUID=None):
"""
@@ -1631,10 +1631,14 @@
@unsecured
def getDomains(self, activeOnly=False):
- return dict(
- (sdUUID, status) for sdUUID, status in
- self.getMetaParam(PMDK_DOMAINS).iteritems()
- if not activeOnly or status == sd.DOM_ACTIVE_STATUS)
+ if hasattr(self, "domains"):
+ domains = dict.fromkeys(self.domains, sd.DOM_ACTIVE_STATUS)
+ else:
+ domains = dict(
+ (sdUUID, status) for sdUUID, status in
+ self.getMetaParam(PMDK_DOMAINS).iteritems()
+ if not activeOnly or status == sd.DOM_ACTIVE_STATUS)
+ return domains
def checkBackupDomain(self):
domDict = self.getDomains(activeOnly=True)
diff --git a/vdsm_cli/vdsClient.py b/vdsm_cli/vdsClient.py
index fefc209..7cad88e 100644
--- a/vdsm_cli/vdsClient.py
+++ b/vdsm_cli/vdsClient.py
@@ -846,6 +846,19 @@
return pool['status']['code'], pool['status']['message']
return 0, ''
+ def monitorPoolDomains(self, args):
+ spUUID = args[0]
+ hostID = int(args[1])
+ scsiKey = args[2]
+ msdUUID = args[3]
+ masterVersion = args[4]
+ domains = args[5]
+ res = self.s.monitorPoolDomains(spUUID, hostID, scsiKey, msdUUID,
+ masterVersion, domains)
+ if res['status']['code']:
+ return res['status']['code'], res['status']['message']
+ return 0, ''
+
def connectStoragePool(self, args):
spUUID = args[0]
ID = int(args[1])
@@ -2047,6 +2060,13 @@
('<spUUID> <id> <scsi-key>',
'Destroy storage pool'
)),
+ 'monitorPoolDomains': (serv.monitorPoolDomains,
+ ('<spUUID> <id> <scsi-key> <masterUUID> '
+ '<masterVer> <domainsList>',
+ 'Connect a Host to specific storage pool'
+ 'starting domain monitoring. All the SDs'
+ 'in domains list are monitored.'
+ )),
'connectStoragePool': (serv.connectStoragePool,
('<spUUID> <id> <scsi-key> [masterUUID] '
'[masterVer]',
--
To view, visit http://gerrit.ovirt.org/11937
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1db3aeb5d2c3ab5a4ad90c175bc3e576726f0336
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
10 years, 4 months
Change in vdsm[master]: fix Exception message error in apiTests module
by shaohef@linux.vnet.ibm.com
ShaoHe Feng has uploaded a new change for review.
Change subject: fix Exception message error in apiTests module
......................................................................
fix Exception message error in apiTests module
Change-Id: Ic51b141047dc0490e50a050fd667f63d30f121f2
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
M tests/apiTests.py
1 file changed, 4 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/89/11289/1
diff --git a/tests/apiTests.py b/tests/apiTests.py
index 1c8699e..0ac3177 100644
--- a/tests/apiTests.py
+++ b/tests/apiTests.py
@@ -203,22 +203,22 @@
try:
sock.connect((ip, port))
except socket.error as e:
- raise ConnectionError("Unable to connect to server: %s", e)
+ raise ConnectionError("Unable to connect to server: %s" % e)
try:
sock.sendall(msg)
except (socket.error, socket.timeout), e:
- raise ProtocolError("Unable to send request: %s", e)
+ raise ProtocolError("Unable to send request: %s" % e)
try:
data = sock.recv(JsonRawTest._Size.size)
except socket.error as e:
- raise ProtocolError("Unable to read response length: %s", e)
+ raise ProtocolError("Unable to read response length: %s" % e)
if not data:
raise ProtocolError("No data received")
msgLen = JsonRawTest._Size.unpack(data)[0]
try:
data = sock.recv(msgLen)
except socket.error as e:
- raise ProtocolError("Unable to read response body: %s", e)
+ raise ProtocolError("Unable to read response body: %s" % e)
if len(data) != msgLen:
raise ProtocolError("Response body length mismatch")
return json.loads(data)
--
To view, visit http://gerrit.ovirt.org/11289
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic51b141047dc0490e50a050fd667f63d30f121f2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
10 years, 4 months
Change in vdsm[master]: add emulator pin support to create vm
by lvroyce@linux.vnet.ibm.com
Royce Lv has uploaded a new change for review.
Change subject: add emulator pin support to create vm
......................................................................
add emulator pin support to create vm
move cpupin to a seperate function 'appendTunable'
to add cputune(e.g.cpu_share),memtune limit def when create vm.
add emulator pin support to create vm,
then the cpuPinning dict changs to be:
{0:'1-4','emulator':'2'}
Change-Id: Ic616b825eca94682e1563ab51773d8a23351998d
Signed-off-by: Royce Lv<lvroyce(a)linux.vnet.ibm.com>
---
M vdsm/libvirtvm.py
1 file changed, 21 insertions(+), 12 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/11/8411/1
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index 64a3b6b..fd80c69 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -716,18 +716,6 @@
topo.setAttribute('threads', str(threads))
cpu.appendChild(topo)
- #CPU-pinning support
- # see http://www.ovirt.org/wiki/Features/Design/cpu-pinning
- if 'cpuPinning' in self.conf:
- cputune = self.doc.createElement('cputune')
- cpuPinning = self.conf.get('cpuPinning')
- for cpuPin in cpuPinning.keys():
- vcpupin = self.doc.createElement('vcpupin')
- vcpupin.setAttribute('vcpu', cpuPin)
- vcpupin.setAttribute('cpuset', cpuPinning[cpuPin])
- cputune.appendChild(vcpupin)
- self.dom.appendChild(cputune)
-
# This hack is for backward compatibility as the libvirt does not allow
# 'qemu64' guest on intel hardware
if model == 'qemu64' and not '+svm' in features:
@@ -747,6 +735,26 @@
f.setAttribute('name', feature[1:])
cpu.appendChild(f)
self.dom.appendChild(cpu)
+
+ def appendTunable(self):
+ #CPU-pinning support
+ # see http://www.ovirt.org/wiki/Features/Design/cpu-pinning
+ if 'cpuPinning' in self.conf:
+ cputune = self.doc.createElement('cputune')
+ cpuPinning = self.conf.get('cpuPinning')
+ try:
+ emulatorset = cpuPinning.pop('emulator')
+ emulatorpin = self.doc.createElement('emulatorpin')
+ emulatorpin.setAttribute('cpuset', emulatorset)
+ cputune.appendChild(emulatorpin)
+ except:
+ pass
+ for cpuPin in cpuPinning.keys():
+ vcpupin = self.doc.createElement('vcpupin')
+ vcpupin.setAttribute('vcpu', cpuPin)
+ vcpupin.setAttribute('cpuset', cpuPinning[cpuPin])
+ cputune.appendChild(vcpupin)
+ self.dom.appendChild(cputune)
def _appendAgentDevice(self, path, name):
"""
@@ -1230,6 +1238,7 @@
domxml.appendClock()
domxml.appendFeatures()
domxml.appendCpu()
+ domxml.appendTunable()
if utils.tobool(self.conf.get('vmchannel', 'true')):
domxml._appendAgentDevice(
self._guestSocketFile.decode('utf-8'),
--
To view, visit http://gerrit.ovirt.org/8411
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic616b825eca94682e1563ab51773d8a23351998d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
10 years, 4 months
Change in vdsm[master]: force reload udev rules to avoid LUN device permission error
by lvroyce@linux.vnet.ibm.com
Royce Lv has uploaded a new change for review.
Change subject: force reload udev rules to avoid LUN device permission error
......................................................................
force reload udev rules to avoid LUN device permission error
udev rules creat symlink for LUN device making it usable for qemu
but the rules are not instantly loaded by udev
result in LUN device symlink not created before vm run
force reload to make the rules take effect instantly
Change-Id: I718d62e67b0a228f2510233c5dd9d1d94c4a736c
Signed-off-by: Royce Lv<lvroyce(a)linux.vnet.ibm.com>
---
M vdsm/storage/hsm.py
M vdsm/supervdsmServer.py
2 files changed, 9 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/80/6780/1
--
To view, visit http://gerrit.ovirt.org/6780
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I718d62e67b0a228f2510233c5dd9d1d94c4a736c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
10 years, 4 months