Change in vdsm[master]: sp: Remove redundant validation
by sgotliv@redhat.com
Sergey Gotliv has uploaded a new change for review.
Change subject: sp: Remove redundant validation
......................................................................
sp: Remove redundant validation
Before deactivating storage domain we validate that this domain is a
member of the pool. It seems that we performed that validation twice,
first time by calling validatePoolSD and second time by checking in the
list of the pooled domains.
Change-Id: I7bd94c40655c08ace5262d39b3087edc542f94b1
Signed-off-by: Sergey Gotliv <sgotliv(a)redhat.com>
---
M vdsm/storage/sp.py
1 file changed, 1 insertion(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/53/24453/1
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index a020e1e..638dfc7 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -1052,10 +1052,6 @@
self.validatePoolSD(sdUUID)
self.log.info("sdUUID=%s spUUID=%s newMsdUUID=%s", sdUUID, self.spUUID,
newMsdUUID)
- domList = self.getDomains()
-
- if sdUUID not in domList:
- raise se.StorageDomainNotInPool(self.spUUID, sdUUID)
try:
dom = sdCache.produce(sdUUID)
@@ -1095,6 +1091,7 @@
self.log.error("Can't umount masterDir %s for domain "
"%s", masterDir, dom)
+ domList = self.getDomains()
domList[sdUUID] = sd.DOM_ATTACHED_STATUS
self._backend.setDomainsMap(domList)
self.updateMonitoringThreads()
--
To view, visit http://gerrit.ovirt.org/24453
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7bd94c40655c08ace5262d39b3087edc542f94b1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Sergey Gotliv <sgotliv(a)redhat.com>
9 years, 9 months
Change in vdsm[master]: make check: add a pylint check
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: make check: add a pylint check
......................................................................
make check: add a pylint check
pylint reports of plenty errors in our code, some of them are only style
issues in our code or code that we use, but some are real.
This patch follows Lukas Bednar suggestion, and starts adding pylint
check gradually. Please add more modules as they are cleaned up.
If pylint slows down you build too much, circumvent it with
make check-local PYLINT=true
Change-Id: Ie03052473caec201aa8ade7929ef1fce5fbc24a4
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M Makefile.am
M configure.ac
M debian/control
A pylint_blacklist
M vdsm.spec.in
5 files changed, 118 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/82/24382/1
diff --git a/Makefile.am b/Makefile.am
index 9b1a3c9..1539459 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -92,6 +92,13 @@
echo "Missing $${i%%.in} in .gitignore"; exit 1; fi; \
done; \
fi;
+ all=`mktemp`; \
+ find * -path './.git' -prune -type f -o \
+ -name '*.py' -o -name '*.py.in' | LC_ALL=C sort > $$all ; \
+ LC_ALL=C comm -2 -3 $$all pylint_blacklist | \
+ xargs $(PYLINT) -E --msg-template=\
+ "{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" ; \
+ rm $$all
all-local: \
vdsm.spec
diff --git a/configure.ac b/configure.ac
index 55879e7..dacb2e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -164,6 +164,11 @@
AC_MSG_WARN([python-pep8 not found])
fi
+AC_PATH_PROG([PYLINT], [pylint])
+if test "x$PYLINT" = "x"; then
+ AC_MSG_WARN([pylint not found])
+fi
+
# Checking for python-devel
AC_PATH_PROG([PYTHON_CONFIG], [python-config])
if test "x$PYTHON_CONFIG" = "x"; then
diff --git a/debian/control b/debian/control
index 45c2b1c..526a9a2 100644
--- a/debian/control
+++ b/debian/control
@@ -15,6 +15,7 @@
pep8,
psmisc (>= 22.6),
pyflakes,
+ pylint,
python (>=2.7.3),
python-dev,
python-cpopen (>= 1.3),
diff --git a/pylint_blacklist b/pylint_blacklist
new file mode 100644
index 0000000..5254349
--- /dev/null
+++ b/pylint_blacklist
@@ -0,0 +1,104 @@
+client/vdsClientGluster.py
+lib/vdsm/SecureXMLRPCServer.py
+lib/vdsm/ipwrapper.py
+lib/vdsm/netinfo.py
+lib/vdsm/tool/configurator.py
+lib/vdsm/tool/load_needed_modules.py.in
+lib/vdsm/tool/service.py
+lib/vdsm/tool/transient.py
+lib/vdsm/tool/upgrade.py
+lib/vdsm/tool/upgrade_300_networks.py
+lib/vdsm/tool/validate_ovirt_certs.py.in
+lib/vdsm/tool/vdsm-id.py
+lib/vdsm/vdscli.py.in
+lib/yajsonrpc/__init__.py
+tests/apiTests.py
+tests/cPopenTests.py
+tests/capsTests.py
+tests/configNetworkTests.py
+tests/fileUtilTests.py
+tests/fileVolumeTests.py
+tests/functional/momTests.py
+tests/functional/networkTests.py
+tests/functional/sosPluginTests.py
+tests/functional/storageTests.py
+tests/functional/supervdsmFuncTests.py
+tests/functional/utils.py
+tests/functional/virtTests.py
+tests/fuserTests.py
+tests/getAllVolumesTests.py
+tests/gluster_cli_tests.py
+tests/guestIFTests.py
+tests/hooksTests.py
+tests/ipwrapperTests.py
+tests/iscsiTests.py
+tests/jsonRpcTests.py
+tests/ksmTests.py
+tests/libvirtconnectionTests.py
+tests/lsblkTests.py
+tests/lvmTests.py
+tests/main.py
+tests/md_utils_tests.py
+tests/miscTests.py
+tests/mkimageTests.py
+tests/monkeypatchTests.py
+tests/mountTests.py
+tests/netconfTests.py
+tests/netconfpersistenceTests.py
+tests/netinfoTests.py
+tests/netmodelsTests.py
+tests/outOfProcessTests.py
+tests/parted_utils_tests.py
+tests/permutationTests.py
+tests/persistentDictTests.py
+tests/remoteFileHandlerTests.py
+tests/resourceManagerTests.py
+tests/schemaTests.py
+tests/sslTests.py
+tests/storageMailboxTests.py
+tests/tcTests.py
+tests/transportWrapperTests.py
+tests/utilsTests.py
+tests/vdsClientTests.py
+tests/vmTests.py
+tests/volumeTests.py
+vdsm/BindingXMLRPC.py
+vdsm/caps.py
+vdsm/clientIF.py
+vdsm/configNetwork.py
+vdsm/debugPluginClient.py
+vdsm/gluster/api.py
+vdsm/gluster/cli.py
+vdsm/gluster/hooks.py
+vdsm/gluster/services.py
+vdsm/gluster/tasks.py
+vdsm/guestIF.py
+vdsm/mkimage.py
+vdsm/momIF.py
+vdsm/netconf/ifcfg.py
+vdsm/netconf/iproute2.py
+vdsm/netmodels.py
+vdsm/sos/vdsm.py.in
+vdsm/sourceRoute.py
+vdsm/sourceRouteThread.py
+vdsm/storage/blockSD.py
+vdsm/storage/blockVolume.py
+vdsm/storage/fileSD.py
+vdsm/storage/fileVolume.py
+vdsm/storage/glusterSD.py
+vdsm/storage/glusterVolume.py
+vdsm/storage/hsm.py
+vdsm/storage/iscsi.py
+vdsm/storage/localFsSD.py
+vdsm/storage/misc.py
+vdsm/storage/nfsSD.py
+vdsm/storage/resourceManager.py
+vdsm/storage/sd.py
+vdsm/storage/sp.py
+vdsm/storage/storageServer.py
+vdsm/storage/volume.py
+vdsm/supervdsm.py
+vdsm/vm.py
+vdsm/vmChannels.py
+vdsm_reg/engine.py.in
+vdsm_reg/register-to-engine.py
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 7eff7c1..268a98e 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -94,6 +94,7 @@
%if !0%{?rhel}
BuildRequires: pyflakes
+BuildRequires: pylint
BuildRequires: python-pep8
%endif
--
To view, visit http://gerrit.ovirt.org/24382
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie03052473caec201aa8ade7929ef1fce5fbc24a4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
9 years, 9 months
Change in vdsm[master]: create VMs in a bulk
by ahadas@redhat.com
Arik Hadas has uploaded a new change for review.
Change subject: create VMs in a bulk
......................................................................
create VMs in a bulk
Change-Id: Ifd50b9fc694ec7c84b3b39f3d11edb1495842244
Signed-off-by: Arik Hadas <ahadas(a)redhat.com>
---
M vdsm/API.py
M vdsm/BindingXMLRPC.py
M vdsm_api/Bridge.py
M vdsm_api/vdsmapi-schema.json
4 files changed, 38 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/52/22452/1
diff --git a/vdsm/API.py b/vdsm/API.py
index 44d5817..391dc9a 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -1266,6 +1266,11 @@
for v in self._cif.vmContainer.values()
if not vmSet or v.id in vmSet]}
+ def createAll(self, vmsParams):
+ return {'status': doneCode,
+ 'vmList': [VM(v['vmId']).create(v)
+ for v in vmsParams]}
+
# Networking-related functions
def setupNetworks(self, networks, bondings, options):
"""Add a new network to this vds, replacing an old one."""
diff --git a/vdsm/BindingXMLRPC.py b/vdsm/BindingXMLRPC.py
index 5bcd84c..3078d73 100644
--- a/vdsm/BindingXMLRPC.py
+++ b/vdsm/BindingXMLRPC.py
@@ -214,6 +214,10 @@
vm = API.VM(vmParams['vmId'])
return vm.create(vmParams)
+ def createAll(self, vmsParams):
+ api = API.Global()
+ return api.createAll(vmsParams)
+
def getVMList(self, fullStatus=False, vmList=()):
api = API.Global()
return api.getVMList(fullStatus, vmList)
@@ -814,6 +818,7 @@
def getGlobalMethods(self):
return ((self.vmDestroy, 'destroy'),
(self.vmCreate, 'create'),
+ (self.createAll, 'createAll'),
(self.getVMList, 'list'),
(self.vmPause, 'pause'),
(self.vmCont, 'cont'),
diff --git a/vdsm_api/Bridge.py b/vdsm_api/Bridge.py
index f4d533c..f0b4653 100644
--- a/vdsm_api/Bridge.py
+++ b/vdsm_api/Bridge.py
@@ -232,6 +232,18 @@
return [v['vmId'] for v in ret['vmList']]
+#def Host_createAll_Call(api, args):
+# vmParams = args.get('vmParams', [])
+# return API.Global().createAll(vmParams)
+
+
+#def Host_createAll_Ret(ret):
+# """
+# Just return a list of VM UUIDs
+# """
+# return [v['vmId'] for v in ret['vmList']]
+
+
def StoragePool_getInfo_Ret(ret):
"""
The result contains two data structures which must be merged
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index 77ca409..33ef756 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -2941,6 +2941,22 @@
'returns': ['UUID']}
##
+# @Host.createAll:
+#
+# Get information about the current virtual machines.
+#
+# @vmParams: #optional Filter the results by a list of UUIDs
+#
+# Returns:
+# A list of VM UUIDs
+#
+# Since: 4.10.0
+##
+{'command': {'class': 'Host', 'name': 'createAll'},
+ 'data': { '*vmParams': 'VmParameters'},
+ 'returns': 'VmDefinition'}
+
+##
# @Host.ping:
#
# Test connectivity to vdsm.
--
To view, visit http://gerrit.ovirt.org/22452
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifd50b9fc694ec7c84b3b39f3d11edb1495842244
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Arik Hadas <ahadas(a)redhat.com>
9 years, 9 months
Change in vdsm[master]: virt: migration: use contextmanager for monitor
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: virt: migration: use contextmanager for monitor
......................................................................
virt: migration: use contextmanager for monitor
This patch factors the MigrationMonitorThread
control in a context manager to make code
clearer and less cluttered.
Change-Id: Ie7fcd0bedf4f30cc0bcab03339322df1fc5434e8
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/migration.py
1 file changed, 13 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/78/25978/1
diff --git a/vdsm/migration.py b/vdsm/migration.py
index 8c33f1e..73d29e8 100644
--- a/vdsm/migration.py
+++ b/vdsm/migration.py
@@ -18,6 +18,7 @@
# Refer to the README and COPYING files for full details of the license
#
+from contextlib import contextmanager
import pickle
import threading
import time
@@ -255,6 +256,17 @@
self._recover(str(e))
self.log.error("Failed to migrate", exc_info=True)
+ @contextmanager
+ def migrationMonitor(self, startTime):
+ self._monitorThread = MigrationMonitorThread(self._vm,
+ startTime,
+ int(self._downtime))
+ self._monitorThread.start()
+ try:
+ yield
+ finally:
+ self._monitorThread.stop()
+
def _startUnderlyingMigration(self, startTime):
if self._mode == 'file':
hooks.before_vm_hibernate(self._vm._dom.XMLDesc(0), self._vm.conf)
@@ -293,12 +305,7 @@
self._vm.log.debug('starting migration to %s '
'with miguri %s', duri, muri)
- self._monitorThread = MigrationMonitorThread(self._vm,
- startTime,
- int(self._downtime))
- self._monitorThread.start()
-
- try:
+ with self.migrationMonitor(startTime):
if ('qxl' in self._vm.conf['display'] and
self._vm.conf.get('clientIp')):
SPICE_MIGRATION_HANDOVER_TIME = 120
@@ -322,9 +329,6 @@
None, maxBandwidth)
else:
self._raiseAbortError()
-
- finally:
- self._monitorThread.stop()
def stop(self):
# if its locks we are before the migrateToURI2()
--
To view, visit http://gerrit.ovirt.org/25978
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie7fcd0bedf4f30cc0bcab03339322df1fc5434e8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
9 years, 9 months
Change in vdsm[master]: sd: fix volume path returned by linkBCImage
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: sd: fix volume path returned by linkBCImage
......................................................................
sd: fix volume path returned by linkBCImage
In a previous commit (c072945 One shot prepare) we involuntarily
changed the path used for virtual machine images from:
/rhev/data-center/<spUUID>/<sdUUID>/images/<imgUUID>/<volUUID>
to:
/rhev/data-center/mnt/blockSD/<sdUUID>/images/<imgUUID>/<volUUID>
This patch reverts to the previous path in order to minimize the
differences between different versions of vdsm that could lead to
live migration issues, e.g.
libvirtError: invalid argument: invalid path ... not assigned to
domain
Change-Id: Iea497b574d9a9a7e0e9b8e234e2bd9b9d983a60c
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1059482
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
M vdsm/storage/blockSD.py
M vdsm/storage/fileSD.py
M vdsm/storage/sd.py
3 files changed, 8 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/15/24315/1
diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py
index 5179c5a..587e617 100644
--- a/vdsm/storage/blockSD.py
+++ b/vdsm/storage/blockSD.py
@@ -1053,8 +1053,7 @@
return rems
def linkBCImage(self, imgPath, imgUUID):
- dst = os.path.join(self.mountpoint, self.sdUUID, sd.DOMAIN_IMAGES,
- imgUUID)
+ dst = self.getLinkBCImagePath(imgUUID)
try:
os.symlink(imgPath, dst)
except OSError as e:
diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py
index 180a43f..0f52718 100644
--- a/vdsm/storage/fileSD.py
+++ b/vdsm/storage/fileSD.py
@@ -422,8 +422,8 @@
for k, v in volumes.iteritems())
def linkBCImage(self, imgPath, imgUUID):
- return os.path.join(self.mountpoint, self.sdUUID, sd.DOMAIN_IMAGES,
- imgUUID)
+ # Nothing to do here other than returning the path
+ return self.getLinkBCImagePath(imgUUID)
def createImageLinks(self, srcImgPath, imgUUID):
"""
diff --git a/vdsm/storage/sd.py b/vdsm/storage/sd.py
index c9738e0..fd4c9db 100644
--- a/vdsm/storage/sd.py
+++ b/vdsm/storage/sd.py
@@ -25,6 +25,7 @@
from collections import namedtuple
import codecs
+import image
import storage_exception as se
import misc
import resourceFactories
@@ -643,6 +644,10 @@
# If it has a repo we don't have multiple domains. Assume single pool
return os.path.join(self.storage_repository, self.getPools()[0])
+ def getLinkBCImagePath(self, imgUUID):
+ return image.Image(self._getRepoPath()) \
+ .getImageDir(self.sdUUID, imgUUID)
+
def getIsoDomainImagesDir(self):
"""
Get 'images' directory from Iso domain
--
To view, visit http://gerrit.ovirt.org/24315
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iea497b574d9a9a7e0e9b8e234e2bd9b9d983a60c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
9 years, 10 months
Change in vdsm[master]: utilsTests: Avoiding returning in the middle of the method
by vvolansk@redhat.com
Vered Volansky has uploaded a new change for review.
Change subject: utilsTests: Avoiding returning in the middle of the method
......................................................................
utilsTests: Avoiding returning in the middle of the method
In RollbackContextTest there are some tests which returns in the first
except. This patch avoids that.
Change-Id: I877f65569f4304bdd4160bb9f84facf261e568e8
Signed-off-by: Vered Volansky <vvolansk(a)redhat.com>
---
M tests/utilsTests.py
1 file changed, 7 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/86/22886/1
diff --git a/tests/utilsTests.py b/tests/utilsTests.py
index bf27f30..7ce15dc 100644
--- a/tests/utilsTests.py
+++ b/tests/utilsTests.py
@@ -334,9 +334,8 @@
rollback.prependDefer(self._callDef)
except Exception:
self.assertEquals(self._called, 2)
- return
-
- self.fail("Exception was not raised")
+ else:
+ self.fail("Exception was not raised")
def testFirstException(self):
"""
@@ -353,11 +352,10 @@
rollback.prependDefer(self._callDef)
except RuntimeError:
self.assertEquals(self._called, 3)
- return
except Exception:
self.fail("Wrong exception was raised")
-
- self.fail("Exception was not raised")
+ else:
+ self.fail("Exception was not raised")
def testKeyErrorException(self):
"""
@@ -368,8 +366,8 @@
with utils.RollbackContext():
{}['aKey']
except KeyError:
- return
+ pass
except Exception:
self.fail("Wrong exception was raised")
-
- self.fail("Exception was not raised")
+ else:
+ self.fail("Exception was not raised")
--
To view, visit http://gerrit.ovirt.org/22886
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I877f65569f4304bdd4160bb9f84facf261e568e8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vered Volansky <vvolansk(a)redhat.com>
9 years, 10 months
Change in vdsm[master]: vm: spice support to agent file transfer disable
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: vm: spice support to agent file transfer disable
......................................................................
vm: spice support to agent file transfer disable
Spice has agent based file transfer support.
This option can be disabled in QEMU, and libvirt has support
to pass this flag to the underlying QEMU.
This patch expose this capability in VDSM, in the VM definition,
implementing the VDSM part of bz983019.
The new parameter is optional and enabled by default for backward
compatibility.
No XML changes are produced at all unless the new parameter is
specified.
Change-Id: I8cde372e6bf2f46b2ceac4e8660b5b05f02aaccb
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M tests/vmTests.py
M vdsm/vm.py
M vdsm_api/vdsmapi-schema.json
3 files changed, 40 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/70/23270/1
diff --git a/tests/vmTests.py b/tests/vmTests.py
index 6215041..2594dc2 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -304,6 +304,20 @@
<channel mode="secure" name="playback"/>
<channel mode="secure" name="record"/>
<channel mode="secure" name="display"/>
+ </graphics>""",
+
+ """
+ <graphics autoport="yes" listen="0" passwd="*****"
+ passwdValidTo="1970-01-01T00:00:01" port="-1"
+ tlsPort="-1" type="spice">
+ <filetransfer enable="no"/>
+ </graphics>""",
+
+ """
+ <graphics autoport="yes" listen="0" passwd="*****"
+ passwdValidTo="1970-01-01T00:00:01" port="-1"
+ tlsPort="-1" type="spice">
+ <channel mode="secure" name="main"/>
</graphics>"""]
spiceChannelXML = """
@@ -317,7 +331,13 @@
{'display': 'qxl', 'displayPort': '-1', 'displaySecurePort': '-1',
'spiceSecureChannels':
- "smain,sinputs,scursor,splayback,srecord,sdisplay"}]
+ "smain,sinputs,scursor,splayback,srecord,sdisplay"},
+
+ {'display': 'qxl', 'displayPort': '-1', 'displaySecurePort': '-1',
+ 'fileTransferEnable': 'false'},
+
+ {'display': 'qxl', 'displayPort': '-1', 'displaySecurePort': '-1',
+ 'fileTransferEnable': 'true', 'spiceSecureChannels': "smain"}]
for vmConf, xml in zip(vmConfs, expectedXMLs):
vmConf.update(self.conf)
diff --git a/vdsm/vm.py b/vdsm/vm.py
index bd5f6d5..ed11d82 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -1186,6 +1186,12 @@
<channel type='spicevmc'>
<target type='virtio' name='com.redhat.spice.0'/>
</channel>
+
+ or
+
+ <graphics autoport="yes" port="5910" tlsPort="5890" type="spice">
+ <filetransfer enable='no'/>
+ </graphics>
"""
graphicsAttrs = {'port': self.conf['displayPort'], 'autoport': 'yes'}
if self.conf['display'] == 'vnc':
@@ -1208,6 +1214,10 @@
graphics.appendChildWithArgs('channel', name=channel[1:],
mode='secure')
+ if not utils.tobool(self.conf.get('fileTransferEnable', True)):
+ filetransfer = XMLElement('filetransfer', enable='no')
+ graphics.appendChild(filetransfer)
+
vmc = XMLElement('channel', type='spicevmc')
vmc.appendChildWithArgs('target', type='virtio',
name='com.redhat.spice.0')
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index 564180a..3b258b2 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -2804,6 +2804,10 @@
#
# @emulatedMachine: #optional The machine specification being emulated
#
+# @fileTransferEnable: #optional Specify if file transfer is enabled.
+# Currently relevant for @qxl devices only.
+# (new in version 4.14.0)
+#
# @keyboardLayout: #optional The keyboard layout string (eg. 'en-us')
#
# @kvmEnable: Indicates if KVM hardware acceleration is enabled
@@ -2854,10 +2858,11 @@
'*cpuType': 'str', '*custom': 'StringMap', '*devices': ['VmDevice'],
'display': 'VmDisplayType', 'displayIp': 'str',
'displayPort': 'int', 'displaySecurePort': 'int',
- '*emulatedMachine': 'str', '*keyboardLayout': 'str',
- 'kvmEnable': 'bool', '*maxVCpus': 'uint', 'memSize': 'uint',
- 'memGuaranteedSize': 'uint', 'nicModel': 'str', 'nice': 'int',
- '*pauseCode': 'str', 'pid': 'uint', 'smp': 'uint', '*smpCoresPerSocket': 'uint',
+ '*emulatedMachine': 'str', '*fileTransferEnable': 'bool',
+ '*keyboardLayout': 'str', 'kvmEnable': 'bool',
+ '*maxVCpus': 'uint', 'memSize': 'uint', 'memGuaranteedSize': 'uint',
+ 'nicModel': 'str', 'nice': 'int', '*pauseCode': 'str', 'pid': 'uint',
+ 'smp': 'uint', '*smpCoresPerSocket': 'uint',
'*smpThreadsPerCore': 'uint', 'status': 'VmStatus',
'timeOffset': 'uint', 'transparentHugePages': 'bool',
'vmId': 'UUID', 'vmName': 'str', 'vmType': 'VmType',
--
To view, visit http://gerrit.ovirt.org/23270
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8cde372e6bf2f46b2ceac4e8660b5b05f02aaccb
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
9 years, 10 months
Change in vdsm[master]: Add hostusbdirect hook to vdsm_hooks.
by lyarwood@redhat.com
Lee Yarwood has uploaded a new change for review.
Change subject: Add hostusbdirect hook to vdsm_hooks.
......................................................................
Add hostusbdirect hook to vdsm_hooks.
This is a slight variation of the hostusb hook. This version uses the bus and
device IDs to attach host USB device to the guest using the following libvirt XML :
<hostdev mode='subsystem' type='usb' managed='yes'>
<source>
<address bus='001' device='003'/>
</source>
</hostdev>
In the future this could be merged with the hostusb hook.
Change-Id: I00b4b03993cd7290462b0e17457892b23dd41b31
Signed-off-by: Lee Yarwood <lyarwood(a)redhat.com>
---
M configure.ac
M vdsm.spec.in
M vdsm_hooks/Makefile.am
A vdsm_hooks/hostusbdirect/Makefile.am
A vdsm_hooks/hostusbdirect/README
A vdsm_hooks/hostusbdirect/after_vm_destroy.py
A vdsm_hooks/hostusbdirect/before_vm_migrate_source.py
A vdsm_hooks/hostusbdirect/before_vm_start.py
A vdsm_hooks/hostusbdirect/sudoers.vdsm_hook_hostusbdirect
9 files changed, 262 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/28/17428/1
diff --git a/configure.ac b/configure.ac
index 0ccca95..39e31f0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -225,6 +225,7 @@
vdsm_hooks/fileinject/Makefile
vdsm_hooks/floppy/Makefile
vdsm_hooks/hostusb/Makefile
+ vdsm_hooks/hostusbdirect/Makefile
vdsm_hooks/hugepages/Makefile
vdsm_hooks/isolatedprivatevlan/Makefile
vdsm_hooks/macspoof/Makefile
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 235d1db..c1b9431 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -389,6 +389,15 @@
Hook is getting vendor and product id of USB device
disconnect it from host and attach it to VM
+%package hook-hostusb-direct
+Summary: Allow attaching USB device from host by bus and device ids.
+BuildArch: noarch
+Requires: usbutils
+
+%description hook-hostusb-direct
+Hook is getting bus and device id of USB device
+disconnect it from host and attach it to VM
+
%package hook-hugepages
Summary: Huge pages enable user to handle VM with 2048KB page files.
BuildArch: noarch
diff --git a/vdsm_hooks/Makefile.am b/vdsm_hooks/Makefile.am
index 8a8d594..fb4052b 100644
--- a/vdsm_hooks/Makefile.am
+++ b/vdsm_hooks/Makefile.am
@@ -30,6 +30,7 @@
fileinject \
floppy \
hostusb \
+ hostusbdirect \
hugepages \
isolatedprivatevlan \
macspoof \
diff --git a/vdsm_hooks/hostusbdirect/Makefile.am b/vdsm_hooks/hostusbdirect/Makefile.am
new file mode 100644
index 0000000..9d0cdbc
--- /dev/null
+++ b/vdsm_hooks/hostusbdirect/Makefile.am
@@ -0,0 +1,52 @@
+#
+# Copyright 2013 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
+#
+
+EXTRA_DIST = \
+ after_vm_destroy.py \
+ before_vm_migrate_source.py \
+ before_vm_start.py \
+ sudoers.vdsm_hook_hostusbdirect
+
+install-data-hook:
+ chmod 440 $(DESTDIR)$(sysconfdir)/sudoers.d/50_vdsm_hook_hostusbdirect
+
+install-data-local: install-data-sudoers
+ $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start
+ $(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \
+ $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_hostusbdirect
+ $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/after_vm_destroy
+ $(INSTALL_SCRIPT) $(srcdir)/after_vm_destroy.py \
+ $(DESTDIR)$(vdsmhooksdir)/after_vm_destroy/50_hostusbdirect
+ $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_migrate_source
+ $(INSTALL_SCRIPT) $(srcdir)/before_vm_migrate_source.py \
+ $(DESTDIR)$(vdsmhooksdir)/before_vm_migrate_source/50_hostusbdirect
+
+uninstall-local: uninstall-data-sudoers
+ $(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_hostusbdirect
+ $(RM) $(DESTDIR)$(vdsmhooksdir)/after_vm_destroy/50_hostusbdirect
+ $(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_migrate_source/50_hostusbdirect
+
+install-data-sudoers:
+ $(MKDIR_P) $(DESTDIR)$(sysconfdir)/sudoers.d
+ $(INSTALL_DATA) $(srcdir)/sudoers.vdsm_hook_hostusbdirect \
+ $(DESTDIR)$(sysconfdir)/sudoers.d/50_vdsm_hook_hostusbdirect
+
+uninstall-data-sudoers:
+ $(RM) $(DESTDIR)$(sysconfdir)/sudoers.d/50_vdsm_hook_hostusbdirect
diff --git a/vdsm_hooks/hostusbdirect/README b/vdsm_hooks/hostusbdirect/README
new file mode 100644
index 0000000..297c559
--- /dev/null
+++ b/vdsm_hooks/hostusbdirect/README
@@ -0,0 +1,18 @@
+host usb hook direct
+====================
+add hosts usb device/s to VM using bus and device ids:
+
+<hostdev mode='subsystem' type='usb'>
+ <source>
+ <address bus='001' device='003'/>
+ </source>
+</hostdev>
+
+syntax:
+ hostusbdirect=001:003&001:002
+ i.e.
+ hostusb=bus:device (can add more then one with '&' separator)
+
+Note:
+ The VM must be pinned to host and this hook will
+ fail any migration attempt.
diff --git a/vdsm_hooks/hostusbdirect/after_vm_destroy.py b/vdsm_hooks/hostusbdirect/after_vm_destroy.py
new file mode 100755
index 0000000..3882347
--- /dev/null
+++ b/vdsm_hooks/hostusbdirect/after_vm_destroy.py
@@ -0,0 +1,64 @@
+#!/usr/bin/python
+
+import os
+import sys
+import traceback
+
+import hooking
+
+'''
+after_vm_destroy:
+return the original owner of the usb device
+'''
+
+HOOK_HOSTUSB_PATH = '/var/run/vdsm/hooks/hostusbdirect-permissions'
+
+
+def get_owner(devpath):
+ uid = pid = -1
+ content = ''
+
+ if not os.path.isfile(HOOK_HOSTUSB_PATH):
+ return uid, pid
+
+ f = file(HOOK_HOSTUSB_PATH, 'r')
+ for line in f:
+ if len(line) > 0 and line.split(':')[0] == devpath:
+ entry = line.split(':')
+ uid = entry[1]
+ pid = entry[2]
+ elif len(line) > 0:
+ content += line + '\n'
+
+ f.close()
+ if uid != -1:
+ f = file(HOOK_HOSTUSB_PATH, 'w')
+ f.writelines(content)
+ f.close()
+
+ return uid, pid
+
+
+def chown(bus, device):
+ devpath = '/dev/bus/usb/' + bus + '/' + device
+ uid, gid = get_owner(devpath)
+
+ owner = str(uid) + ':' + str(gid)
+ command = ['/bin/chown', owner, devpath]
+ retcode, out, err = hooking.execCmd(command, sudo=True, raw=True)
+ if retcode != 0:
+ sys.stderr.write('hostusbdirect: error chown %s to %s, err = %s\n' %
+ (devpath, owner, err))
+ sys.exit(2)
+
+
+if 'hostusbdirect' in os.environ:
+ try:
+ for usb in os.environ['hostusbdirect'].split('&'):
+ bus, device = usb.split(':')
+ chown(bus, device)
+
+ except:
+ sys.stderr.write('hostusb after_vm_destroy: [unexpected error]: %s\n' %
+ traceback.format_exc())
+ sys.exit(2)
diff --git a/vdsm_hooks/hostusbdirect/before_vm_migrate_source.py b/vdsm_hooks/hostusbdirect/before_vm_migrate_source.py
new file mode 100755
index 0000000..43a2eca
--- /dev/null
+++ b/vdsm_hooks/hostusbdirect/before_vm_migrate_source.py
@@ -0,0 +1,8 @@
+#!/usr/bin/python
+
+import os
+import sys
+
+if 'hostusbdirect' in os.environ:
+ sys.stderr.write("hostusbdirect: can't migrate VM with host usb devices\n")
+ sys.exit(2)
diff --git a/vdsm_hooks/hostusbdirect/before_vm_start.py b/vdsm_hooks/hostusbdirect/before_vm_start.py
new file mode 100755
index 0000000..57307aa
--- /dev/null
+++ b/vdsm_hooks/hostusbdirect/before_vm_start.py
@@ -0,0 +1,108 @@
+#!/usr/bin/python
+
+import os
+import sys
+import grp
+import pwd
+import traceback
+
+import hooking
+
+'''
+host usb hook direct
+====================
+
+syntax:
+ hostusbdirect=001:001&001:002
+ i.e.
+ hostusbdirect=bus:device (can add more then one with '&' separator)
+
+Note:
+ The VM must be pinned to host and this hook will
+ fail any migration attempt.
+'''
+
+HOOK_HOSTUSB_PATH = '/var/run/vdsm/hooks/hostusbdirect-permissions'
+
+
+def log_dev_owner(devpath, user, group):
+ entry = devpath + ":" + str(user) + ":" + str(group)
+
+ if not os.path.isdir(os.path.dirname(HOOK_HOSTUSB_PATH)):
+ os.mkdir(os.path.dirname(HOOK_HOSTUSB_PATH))
+
+ if os.path.isfile(HOOK_HOSTUSB_PATH):
+ f = file(HOOK_HOSTUSB_PATH, 'r')
+ for line in f:
+ if entry == line:
+ f.close()
+ return
+
+ f = file(HOOK_HOSTUSB_PATH, 'a')
+ f.writelines(entry)
+ f.close()
+
+
+def chown(bus, device):
+
+ devpath = '/dev/bus/usb/' + bus + '/' + device
+ stat = os.stat(devpath)
+
+ group = grp.getgrnam('qemu')
+ gid = group.gr_gid
+ user = pwd.getpwnam('qemu')
+ uid = user.pw_uid
+
+ owner = str(uid) + ':' + str(gid)
+ command = ['/bin/chown', owner, devpath]
+ retcode, out, err = hooking.execCmd(command, sudo=True, raw=True)
+ if retcode != 0:
+ sys.stderr.write('hostusbdirect: error chown %s to %s, err = %s\n' %
+ (devpath, owner, err))
+ sys.exit(2)
+
+ log_dev_owner(devpath, stat.st_uid, stat.st_gid)
+
+
+def add_devices(domxml, devices):
+ domain = domxml.getElementsByTagName('devices')[0]
+
+ for device in devices:
+ # Add the following for each device :
+ #<hostdev mode='subsystem' type='usb' managed='yes'>
+ # <source>
+ # <address bus='001' device='003'/>
+ # </source>
+ #</hostdev>
+
+ hostdev = domxml.createElement('hostdev')
+ hostdev.setAttribute('mode', 'subsystem')
+ hostdev.setAttribute('type', 'usb')
+ hostdev.setAttribute('managed', 'yes')
+
+ source = domxml.createElement('source')
+ hostdev.appendChild(source)
+
+ address = domxml.createElement('address')
+ address.setAttribute('bus', device['bus'])
+ address.setAttribute('device', device['device'])
+ source.appendChild(address)
+
+ domain.appendChild(hostdev)
+
+if 'usbhostdirect' in os.environ:
+ try:
+ domxml = hooking.read_domxml()
+ devices = []
+
+ for usb in os.environ['usbhostdirect'].split('&'):
+ bus, device = usb.split(':')
+ chown(bus, device)
+ devices.append({'bus': bus, 'device': device})
+
+ add_devices(domxml, devices)
+ hooking.write_domxml(domxml)
+ except:
+ sys.stderr.write('hostusbdirect: [unexpected error]: %s\n' %
+ traceback.format_exc())
+ sys.exit(2)
diff --git a/vdsm_hooks/hostusbdirect/sudoers.vdsm_hook_hostusbdirect b/vdsm_hooks/hostusbdirect/sudoers.vdsm_hook_hostusbdirect
new file mode 100644
index 0000000..cba601d
--- /dev/null
+++ b/vdsm_hooks/hostusbdirect/sudoers.vdsm_hook_hostusbdirect
@@ -0,0 +1 @@
+vdsm ALL=(ALL) NOPASSWD: /bin/chown
--
To view, visit http://gerrit.ovirt.org/17428
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I00b4b03993cd7290462b0e17457892b23dd41b31
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Lee Yarwood <lyarwood(a)redhat.com>
9 years, 10 months
Change in vdsm[master]: utils
by laravot@redhat.com
Liron Ar has uploaded a new change for review.
Change subject: utils
......................................................................
utils
Change-Id: Icbd049360a02ae98fa21756dc734c1da8ac3d11a
Signed-off-by: Liron Aravot <laravot(a)redhat.com>
---
M lib/vdsm/utils.py
1 file changed, 26 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/30/23130/1
diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index d593a73..e39a245 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -52,6 +52,7 @@
import threading
import time
import zombiereaper
+import inspect
from cpopen import CPopen
from . import constants
@@ -643,6 +644,31 @@
return False
+def traced(on=""):
+
+ def func_decorator(func, log):
+ def wrapper(self, *a, **kw):
+ log.debug("executing %s with a= %s,kw= %s", func.func_name, a, kw)
+ return func(self, *a, **kw)
+ return wrapper
+
+ def decorator(cls):
+ log = logging.getLogger(on)
+ log.debug("aasd")
+ for name in dir(cls):
+ value = getattr(cls, name)
+ log.debug(name)
+ log.debug(type(value))
+
+ if inspect.ismethod(value):
+ setattr(cls, name, func_decorator(value, log))
+ log.debug("name = %s , value = %s was wrapped", name, value)
+
+ return cls
+
+ return decorator
+
+
def _getAllMacs():
# (
--
To view, visit http://gerrit.ovirt.org/23130
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icbd049360a02ae98fa21756dc734c1da8ac3d11a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Liron Ar <laravot(a)redhat.com>
9 years, 10 months
Change in vdsm[master]: [WIP] Implement a process to do dangerous IO in C
by smizrahi@redhat.com
Saggi Mizrahi has uploaded a new change for review.
Change subject: [WIP] Implement a process to do dangerous IO in C
......................................................................
[WIP] Implement a process to do dangerous IO in C
This replaces the process pool with a process that can serve multiple
requests written in C.
This implementation is much more scalable and lightweight. Should solve
bugs related to running out of helpers, logging getting suck, python
forking deadlocking, running out of memory and other things as well.
The communication between VDSM and the IOProcess is done with json
objects.
The IOProcess starts with 3 thread:
1. requestReader - reads requests from the pipe, builds a DOM
representation of it and queues it up for handling
2. responseWriter - gets response DOMs from the queue converts them to a
JSON string and send it over the pipe
3. requestHandler - pops requests from the queue and provisions threads
for handling them. Currently we I just allocate a new thread per
request. If there is ever a need to have a thread pool this is where
the load balancing is going to sit.
Each request gets the are as a JsonNode and returns a response that is a
JsonNode as well. Most exported functions are pretty trivial and are a
good example on how to write new ones.
Unlink the ProcessPoolHelper, high level commands sit of the OopWrapper
and are run from the client side instead of being implemented in C on
the IOProcess side.
Change-Id: Ie4664d5330debbe38ba33b74ebb586ac42913b4a
Signed-off-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
M configure.ac
M tests/Makefile.am
A tests/ioprocessTests.py
A tests/outOfProcessTests.py
D tests/processPoolTests.py
M vdsm.spec.in
M vdsm/constants.py.in
M vdsm/storage/Makefile.am
M vdsm/storage/fileSD.py
M vdsm/storage/fileUtils.py
M vdsm/storage/fileVolume.py
A vdsm/storage/ioprocess.py
A vdsm/storage/ioprocess/.gitignore
A vdsm/storage/ioprocess/Makefile.am
A vdsm/storage/ioprocess/exported-functions.c
A vdsm/storage/ioprocess/exported-functions.h
A vdsm/storage/ioprocess/ioprocess.c
A vdsm/storage/ioprocess/json-dom-generator.c
A vdsm/storage/ioprocess/json-dom-generator.h
A vdsm/storage/ioprocess/json-dom-parser.c
A vdsm/storage/ioprocess/json-dom-parser.h
A vdsm/storage/ioprocess/json-dom.c
A vdsm/storage/ioprocess/json-dom.h
M vdsm/storage/misc.py
M vdsm/storage/nfsSD.py
M vdsm/storage/outOfProcess.py
D vdsm/storage/processPool.py
M vdsm/storage/sd.py
M vdsm/storage/sp.py
M vdsm/storage/task.py
30 files changed, 3,018 insertions(+), 666 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/46/3946/1
--
To view, visit http://gerrit.ovirt.org/3946
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie4664d5330debbe38ba33b74ebb586ac42913b4a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi(a)redhat.com>
9 years, 10 months