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 rollback to _runVMKernelBootTemplate
by lvroyce@linux.vnet.ibm.com
Royce Lv has uploaded a new change for review.
Change subject: add rollback to _runVMKernelBootTemplate
......................................................................
add rollback to _runVMKernelBootTemplate
This will enable us checking status of VM after it starts up.
Change-Id: I497d36bb051d904ae1e43bc8f565707f411a3851
Signed-off-by: Royce Lv<lvroyce(a)linux.vnet.ibm.com>
---
M tests/functional/xmlrpcTests.py
1 file changed, 10 insertions(+), 10 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/19/12819/1
diff --git a/tests/functional/xmlrpcTests.py b/tests/functional/xmlrpcTests.py
index b9ec45b..3eb65e4 100644
--- a/tests/functional/xmlrpcTests.py
+++ b/tests/functional/xmlrpcTests.py
@@ -166,9 +166,10 @@
customization = {'vmId': '77777777-ffff-3333-bbbb-222222222222',
'vmName': 'vdsm_testSmallVM'}
- self._runVMKernelBootTemplate(customization)
+ with RollbackContext() as rollback:
+ self._runVMKernelBootTemplate(rollback, customization)
- def _runVMKernelBootTemplate(self, vmDef={}, distro='fedora'):
+ def _runVMKernelBootTemplate(self, rollback, vmDef={}, distro='fedora'):
kernelArgsDistro = {
# Fedora: The initramfs is generated by dracut. The following
# arguments will be interpreted by init scripts created by dracut.
@@ -196,14 +197,13 @@
template.update(
{'kernel': kernelPath,
'initrd': initramfsPath})
- try:
- self.assertVdsOK(self.s.create(template))
- # wait 65 seconds for VM to come up until timeout
- self.retryAssert(assertVMAndGuestUp, timeout=65)
- finally:
- destroyResult = self.s.destroy(vmid)
- self.assertVdsOK(destroyResult)
+ self.assertVdsOK(self.s.create(template))
+ # wait 65 seconds for VM to come up until timeout
+ self.retryAssert(assertVMAndGuestUp, timeout=65)
+ undo = lambda vmid=vmid: \
+ self.assertVdsOK(self.s.destroy(vmid))
+ rollback.prependDefer(undo)
@permutations([['localfs'], ['iscsi'], ['glusterfs']])
def testStorage(self, backendType):
@@ -235,7 +235,7 @@
with RollbackContext() as rollback:
self._createVdsmStorageLayout(conf, rollback)
- self._runVMKernelBootTemplate(customization)
+ self._runVMKernelBootTemplate(rollback, customization)
def _createVdsmStorageLayout(self, conf, rollback):
backendServer = conf['server'](self.s, self)
--
To view, visit http://gerrit.ovirt.org/12819
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I497d36bb051d904ae1e43bc8f565707f411a3851
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]: 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
Change in vdsm[master]: Encapsulate vdsm-unregister into vdsm-tool function
by lilei@linux.vnet.ibm.com
Lei Li has uploaded a new change for review.
Change subject: Encapsulate vdsm-unregister into vdsm-tool function
......................................................................
Encapsulate vdsm-unregister into vdsm-tool function
Change-Id: I7348baeabbdcbb0c2da64170b6957430feaa1954
Signed-off-by: Lei Li <lilei(a)linux.vnet.ibm.com>
---
M vdsm-tool/Makefile.am
A vdsm-tool/register.py
M vdsm.spec.in
3 files changed, 43 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/27/4527/1
--
To view, visit http://gerrit.ovirt.org/4527
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7348baeabbdcbb0c2da64170b6957430feaa1954
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Lei Li <lilei(a)linux.vnet.ibm.com>
10 years, 4 months
Change in vdsm[master]: add a jsonrpcSeverClient for jsonRPC Server functional test
by shaohef@linux.vnet.ibm.com
ShaoHe Feng has uploaded a new change for review.
Change subject: add a jsonrpcSeverClient for jsonRPC Server functional test
......................................................................
add a jsonrpcSeverClient for jsonRPC Server functional test
This jsonrpcSeverClient is easy to call the jsonRPC server.
And it is an example for user to call the jsonRPC server.
The jsonrpcSeverClient will parser the vdsmapi-schema.json.
It will generate the method of vdsm-api dynamically.
Then we can easy call the vdsm-api, refer to vdsm-api.html.
vdsm-api.html is in the vdsm doc path.
Some comments tell us how to call the vdsm-api at the end of
jsonrpcSeverClient.py
Change-Id: Ib081e26203638114d7d632489432a50eeea45dd4
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
M tests/functional/Makefile.am
A tests/functional/jsonrpcSeverClient.py
2 files changed, 144 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/83/11283/1
diff --git a/tests/functional/Makefile.am b/tests/functional/Makefile.am
index 030242b..e3374e8 100644
--- a/tests/functional/Makefile.am
+++ b/tests/functional/Makefile.am
@@ -21,6 +21,7 @@
vdsmfunctestsdir = ${vdsmtestsdir}/functional
dist_vdsmfunctests_PYTHON = \
+ jsonrpcSeverClient.py \
momTests.py \
sosPluginTests.py \
xmlrpcTests.py \
diff --git a/tests/functional/jsonrpcSeverClient.py b/tests/functional/jsonrpcSeverClient.py
new file mode 100644
index 0000000..77af03b
--- /dev/null
+++ b/tests/functional/jsonrpcSeverClient.py
@@ -0,0 +1,143 @@
+#
+# 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
+#
+
+import json
+import os
+import socket
+import ssl
+import struct
+import vdsmapi
+from functools import partial
+from contextlib import closing
+from vdsm.config import config
+from vdsm import constants
+
+
+class ConnectionError(Exception):
+ pass
+
+
+class ProtocolError(Exception):
+ pass
+
+
+class jsonRpcServerClient(object):
+
+ #TODO: spport ssl
+ def __init__(self, ip, port, certReq=False, tsPath=None):
+ self._ip = ip
+ self._port = port
+ self._tsPath = tsPath
+ self._Size = struct.Struct("!Q")
+ self._cert_reqs = ssl.CERT_REQUIRED if certReq else ssl.CERT_NONE
+ schema = os.path.join(constants.P_VDSM, 'vdsmapi-schema.json')
+ self._dynamicAttribute(schema)
+
+ def buildMessage(self, data):
+ msg = json.dumps(data)
+ msg = msg.encode('utf-8')
+ msize = self._Size.pack(len(msg))
+ resp = msize + msg
+ return resp
+
+ def _createRequest(self, method, reqId=None, params=()):
+ return {'jsonrpc': '2.0', "id": reqId, "method": method,
+ "params": params}
+
+ def sendMessage(self, msg):
+ with closing(socket.socket(socket.AF_INET,
+ socket.SOCK_STREAM)) as tcp_sock:
+ if self._cert_reqs == ssl.CERT_REQUIRED:
+ if self._tsPath is None:
+ self._tsPath = config.get('vars', 'trust_store_path')
+ KEYFILE = self._tsPath + '/keys/vdsmkey.pem'
+ CERTFILE = self._tsPath + '/certs/vdsmcert.pem'
+ CACERT = self._tsPath + '/certs/cacert.pem'
+ sock = ssl.wrap_socket(tcp_sock,
+ keyfile=KEYFILE,
+ certfile=CERTFILE,
+ ca_certs=CACERT,
+ cert_reqs=self._cert_reqs)
+ else:
+ sock = tcp_sock
+ sock.settimeout(3) # TBD timeout
+ try:
+ sock.connect((self._ip, self._port))
+ except socket.error as 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)
+ try:
+ data = sock.recv(self._Size.size)
+ except socket.error as e:
+ raise ProtocolError("Unable to read response length: %s", e)
+ if not data:
+ raise ProtocolError("No data received")
+ msgLen = self._Size.unpack(data)[0]
+ try:
+ data = sock.recv(msgLen)
+ except socket.error as e:
+ raise ProtocolError("Unable to read response body: %s", e)
+ if len(data) != msgLen:
+ raise ProtocolError("Response body length mismatch")
+ return json.loads(data)
+
+ def call(self, method, reqId=None, params=()):
+ msg = self.buildMessage(self._createRequest(method, reqId, params))
+ reply = self.sendMessage(msg)
+ return reply
+
+ def _dynamicAttribute(self, schema):
+ self.dynamicAttr = {}
+ with open(schema) as f:
+ symbols = vdsmapi.parse_schema(f)
+ for s in symbols:
+ if 'command' in s:
+ className = s['command']['class']
+ functionName = s['command']['name']
+ if className not in self.dynamicAttr.keys():
+ self.dynamicAttr[className] = []
+ self.dynamicAttr[className].append(functionName)
+ for key, funs in self.dynamicAttr.items():
+ funDicts = {}
+ for fun in funs:
+ method = ".".join((key, fun))
+ funDicts[fun] = partial(self.call, method)
+ cls = type(key, (object,), funDicts)
+ setattr(self, key, cls())
+
+
+if __name__ == '__main__':
+ if not config.getboolean('vars', 'jsonrpc_enable'):
+ exit(1)
+
+ ip = "127.0.0.1"
+ port = config.getint('addresses', 'json_port')
+ rpcIns = jsonRpcServerClient(ip, port)
+
+ # test the RpcClient
+ # you can open vdsm-api.html by your browser, such as by firefox
+ # firefox /usr/share/doc/vdsm-*/vdsm-api.html
+ # vdsm-api.html is in the vdsm doc path.
+ # then can call the API show in vdsm-api.html as follow
+ print rpcIns.call("Host.getAllTasksInfo", 1)
+ print rpcIns.Host.getAllTasksInfo(1)
--
To view, visit http://gerrit.ovirt.org/11283
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib081e26203638114d7d632489432a50eeea45dd4
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]: [WIP] objectfs integration
by peet@redhat.com
Peter V. Saveliev has uploaded a new change for review.
Change subject: [WIP] objectfs integration
......................................................................
[WIP] objectfs integration
Export VM objects as files in runtime.
Signed-off-by: Peter V. Saveliev <peet(a)redhat.com>
Change-Id: I6dd2ca2245f3f5496eca9f8c14bed79d4638c189
---
M vdsm/vm.py
1 file changed, 7 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/83/8383/1
diff --git a/vdsm/vm.py b/vdsm/vm.py
index d49eef1..cd6c6ca 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -33,6 +33,7 @@
from logUtils import SimpleLogAdapter
import libvirt
from vdsm import vdscli
+from pyvfs.objectfs import export
DEFAULT_BRIDGE = config.get("vars", "default_bridge")
@@ -250,6 +251,12 @@
'Restoring state', 'Saving State',
'Up', 'WaitForLaunch')
+
+@export(blacklist=[
+ "/log",
+ "/MigrationSourceThreadClass",
+ "/cif",
+ ])
class Vm(object):
"""
Used for abstracting communication between various parts of the
--
To view, visit http://gerrit.ovirt.org/8383
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6dd2ca2245f3f5496eca9f8c14bed79d4638c189
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]: vdsm: catch timeout while starting VM
by peet@redhat.com
Peter V. Saveliev has uploaded a new change for review.
Change subject: vdsm: catch timeout while starting VM
......................................................................
vdsm: catch timeout while starting VM
If the requested VM does not start within given timeout,
set its status to «down» and throw an exception.
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=755528
Signed-off-by: Peter V. Saveliev <peet(a)redhat.com>
Change-Id: I233d3c6cf1e62e46d005b8a6d502a02438100daa
---
M vdsm/vm.py
1 file changed, 5 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/35/12235/1
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 8b2bbb6..19e6aa4 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -35,6 +35,7 @@
import libvirt
from vdsm import vdscli
+__timeout__ = 10
DEFAULT_BRIDGE = config.get("vars", "default_bridge")
DISK_DEVICES = 'disk'
@@ -657,6 +658,10 @@
def run(self):
self._creationThread.start()
+ self._creationThread.join(__timeout__)
+ if self._creationThread.is_alive():
+ self.setDownStatus(ERROR, 'timeout while starting vm')
+ raise Exception("timeout exception")
def memCommit(self):
"""
--
To view, visit http://gerrit.ovirt.org/12235
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I233d3c6cf1e62e46d005b8a6d502a02438100daa
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Peter V. Saveliev <peet(a)redhat.com>
10 years, 4 months