Change in vdsm[master]: Final separation of IOProcess and RFH
by ykaplan@redhat.com
Yeela Kaplan has uploaded a new change for review.
Change subject: Final separation of IOProcess and RFH
......................................................................
Final separation of IOProcess and RFH
>From now on vdsm will either fully use
remoteFileHandler implementation or
IOProcess implementation for out of process(oop).
Change-Id: Ief85d2dca2d22058c4ed2504e49dc3dd62547532
Signed-off-by: Yeela Kaplan <ykaplan(a)redhat.com>
---
M vdsm/storage/outOfProcess.py
1 file changed, 43 insertions(+), 36 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/88/28088/1
diff --git a/vdsm/storage/outOfProcess.py b/vdsm/storage/outOfProcess.py
index 68be884..b360e78 100644
--- a/vdsm/storage/outOfProcess.py
+++ b/vdsm/storage/outOfProcess.py
@@ -42,7 +42,6 @@
_procLock = threading.Lock()
_proc = {}
-_ioproc = {GLOBAL: None}
log = logging.getLogger('oop')
@@ -57,11 +56,13 @@
return _proc[clientName]
except KeyError:
with _procLock:
- if _oopImpl == IOPROC and _ioproc[GLOBAL] is None:
- _ioproc[GLOBAL] = IOProcess(DEFAULT_TIMEOUT)
-
- _proc[clientName] = OopWrapper(
- RemoteFileHandlerPool(HELPERS_PER_DOMAIN), _ioproc[GLOBAL])
+ if _oopImpl == IOPROC:
+ if _proc[GLOBAL] is None:
+ _proc[GLOBAL] = OopWrapper(IOProcess(DEFAULT_TIMEOUT))
+ _proc[clientName] = _proc[GLOBAL]
+ else:
+ _proc[clientName] = OopWrapper(
+ RemoteFileHandlerPool(HELPERS_PER_DOMAIN))
return _proc[clientName]
@@ -240,8 +241,33 @@
ioprocess.truncate(path, size, mode, creatExcl)
+class _IOProcWrapper(types.ModuleType):
+ def __init__(self, modname, ioproc):
+ self._modName = modname
+ self._ioproc = ioproc
+ self.glob = _IOProcessGlob(ioproc)
+ self.fileUtils.cleanupdir = \
+ _IOProcessFileUtils(ioproc).cleanupdir
+ self.fileUtils.createdir = \
+ _IOProcessFileUtils(ioproc).createdir
+ self.fileUtils.validateAccess = \
+ _IOProcessFileUtils(ioproc).validateAccess
+ self.fileUtils.pathExists = \
+ _IOProcessFileUtils(ioproc).pathExists
+ self.os.chmod = _IOProcessOs(ioproc).chmod
+ self.os.statvfs = _IOProcessOs(ioproc).statvfs
+ self.os.rename = _IOProcessOs(ioproc).rename
+ self.os.unlink = _IOProcessOs(ioproc).unlink
+ self.os.path = _IOProcessOs(ioproc).path
+ self.directReadLines = partial(directReadLines, ioproc)
+ self.writeLines = partial(writeLines, ioproc)
+ self.simpleWalk = partial(simpleWalk, ioproc)
+ self.directTouch = partial(directTouch, ioproc)
+ self.truncateFile = partial(truncateFile, ioproc)
+
+
class _ModuleWrapper(types.ModuleType):
- def __init__(self, modName, procPool, ioproc, timeout, subModNames=()):
+ def __init__(self, modName, procPool, timeout, subModNames=()):
self._modName = modName
self._procPool = procPool
self._timeout = timeout
@@ -256,31 +282,9 @@
setattr(self, subModName,
_ModuleWrapper(fullModName,
self._procPool,
- ioproc,
DEFAULT_TIMEOUT,
subSubModNames)
)
-
- if ioproc:
- self.glob = _IOProcessGlob(ioproc)
- self.fileUtils.cleanupdir = \
- _IOProcessFileUtils(ioproc).cleanupdir
- self.fileUtils.createdir = \
- _IOProcessFileUtils(ioproc).createdir
- self.fileUtils.validateAccess = \
- _IOProcessFileUtils(ioproc).validateAccess
- self.fileUtils.pathExists = \
- _IOProcessFileUtils(ioproc).pathExists
- self.os.chmod = _IOProcessOs(ioproc).chmod
- self.os.statvfs = _IOProcessOs(ioproc).statvfs
- self.os.rename = _IOProcessOs(ioproc).rename
- self.os.unlink = _IOProcessOs(ioproc).unlink
- self.os.path = _IOProcessOs(ioproc).path
- self.directReadLines = partial(directReadLines, ioproc)
- self.writeLines = partial(writeLines, ioproc)
- self.simpleWalk = partial(simpleWalk, ioproc)
- self.directTouch = partial(directTouch, ioproc)
- self.truncateFile = partial(truncateFile, ioproc)
def __getattr__(self, name):
# Root modules is fake, we need to remove it
@@ -290,10 +294,13 @@
fullName)
-def OopWrapper(procPool, ioproc=None):
- return _ModuleWrapper("oop", procPool, ioproc, DEFAULT_TIMEOUT,
- (("os",
- ("path",)),
- "glob",
- "fileUtils",
- "utils"))
+def OopWrapper(procPool):
+ if _oopImpl == IOPROC:
+ return _IOProcWrapper("oop", procPool)
+ else:
+ return _ModuleWrapper("oop", procPool, DEFAULT_TIMEOUT,
+ (("os",
+ ("path",)),
+ "glob",
+ "fileUtils",
+ "utils"))
--
To view, visit http://gerrit.ovirt.org/28088
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ief85d2dca2d22058c4ed2504e49dc3dd62547532
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan(a)redhat.com>
10 years
Change in vdsm[master]: [WIP] Additional oop functionality
by ykaplan@redhat.com
Yeela Kaplan has uploaded a new change for review.
Change subject: [WIP] Additional oop functionality
......................................................................
[WIP] Additional oop functionality
Functionality is still not implemented in IOProcess
and includes:
directTouch
cleanupdir
createdir
truncatefile
Change-Id: I438f01236767e807f010be7531678ee5b1a05056
Signed-off-by: Yeela Kaplan <ykaplan(a)redhat.com>
---
M vdsm/storage/outOfProcess.py
1 file changed, 20 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/41/27641/1
diff --git a/vdsm/storage/outOfProcess.py b/vdsm/storage/outOfProcess.py
index c0c7dee..ac98f65 100644
--- a/vdsm/storage/outOfProcess.py
+++ b/vdsm/storage/outOfProcess.py
@@ -81,6 +81,12 @@
def __init__(self, iop):
self._iop = iop
+ def cleanupdir(self, path):
+ self._iop.cleanupdir(path)
+
+ def createdir(self, path, mode=None):
+ self._iop.createdir(path, mode)
+
def validateAccess(self, targetPath, perms=(os.R_OK | os.W_OK | os.X_OK)):
if not self._iop.access(targetPath, perms):
log.warning("Permission denied for directory: %s with permissions:"
@@ -120,6 +126,10 @@
return self._iop.lexists(path)
+def directTouch(ioprocess, path):
+ ioprocess.touch(path, direct=True)
+
+
def directReadLines(ioprocess, path):
fileStr = ioprocess.readfile(path, direct=True)
lines = fileStr.split('\n')
@@ -131,6 +141,10 @@
for l in lines:
data += l
return ioprocess.writefile(path, data)
+
+
+def truncateFile(ioprocess, path, size, mode=None, creatExcl=False):
+ ioprocess.truncateFile(path, size, mode, creatExcl)
class _ModuleWrapper(types.ModuleType):
@@ -156,6 +170,10 @@
if ioproc:
self.glob = _IOProcessGlob(ioproc)
+ self.fileUtils.cleanupdir = \
+ _IOProcessFileUtils(ioproc).cleanupdir
+ self.fileUtils.createdir = \
+ _IOProcessFileUtils(ioproc).createdir
self.fileUtils.validateAccess = \
_IOProcessFileUtils(ioproc).validateAccess
self.fileUtils.pathExists = \
@@ -167,6 +185,8 @@
self.os.path = _IOProcessOs(ioproc).path
self.directReadLines = partial(directReadLines, ioproc)
self.writeLines = partial(writeLines, ioproc)
+ self.directTouch = partial(directTouch, ioproc)
+ self.truncateFile = partial(truncateFile, ioproc)
def __getattr__(self, name):
# Root modules is fake, we need to remove it
--
To view, visit http://gerrit.ovirt.org/27641
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I438f01236767e807f010be7531678ee5b1a05056
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan(a)redhat.com>
10 years
Change in vdsm[master]: [WIP]ioprocess implementation
by ykaplan@redhat.com
Yeela Kaplan has uploaded a new change for review.
Change subject: [WIP]ioprocess implementation
......................................................................
[WIP]ioprocess implementation
Change-Id: I132129315c73e880d998a13f84e822a9d4fec2a6
Signed-off-by: Yeela Kaplan <ykaplan(a)redhat.com>
---
M lib/vdsm/config.py.in
M vdsm/storage/outOfProcess.py
2 files changed, 14 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/67/26967/1
diff --git a/lib/vdsm/config.py.in b/lib/vdsm/config.py.in
index 437327b..63b4f70 100644
--- a/lib/vdsm/config.py.in
+++ b/lib/vdsm/config.py.in
@@ -294,7 +294,7 @@
('use_volume_leases', 'false',
'Whether to use the volume leases or not.'),
- ('oop_impl', 'rfh',
+ ('oop_impl', 'ioprocess',
'Whether to use RFH or ioprocess implementation for oop.'),
]),
diff --git a/vdsm/storage/outOfProcess.py b/vdsm/storage/outOfProcess.py
index fbd35fd..d6a43be 100644
--- a/vdsm/storage/outOfProcess.py
+++ b/vdsm/storage/outOfProcess.py
@@ -96,13 +96,25 @@
fullName)
+class _ioprocessGlob(object):
+ def __init__(self, iop):
+ self._iop = iop
+
+ def glob(self, pattern):
+ return self._iop.glob(pattern)
+
+
class _IOProcWrapper(object):
def __init(self, _oop, ioproc):
self._oop = _oop
self._iop = ioproc
+ self.glob = _ioprocessGlob(self._iop)
def __getattr__(self, name):
- return self._oop.__getattr__(name)
+ if name in self.__dict__:
+ return self.name
+ else:
+ return self._oop.__getattr__(name)
def OopWrapper(procPool, ioproc=None):
--
To view, visit http://gerrit.ovirt.org/26967
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I132129315c73e880d998a13f84e822a9d4fec2a6
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan(a)redhat.com>
10 years
Change in vdsm[master]: oop: Add an option to configure oop implementation
by ykaplan@redhat.com
Yeela Kaplan has uploaded a new change for review.
Change subject: oop: Add an option to configure oop implementation
......................................................................
oop: Add an option to configure oop implementation
The final goal is to replace remoteFileHandler implementation
for outOfProcess with ioprocess.
We will do this in a series of steps
The first step is to add an option to manually configure
which one of the two implementations is to be used:
rfh or ioproc.
Change-Id: Ibd756afd43d23631dc7ed4bac64bec9a81b358b4
Signed-off-by: Yeela Kaplan <ykaplan(a)redhat.com>
---
M lib/vdsm/config.py.in
M vdsm/storage/hsm.py
M vdsm/storage/outOfProcess.py
3 files changed, 43 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/76/26576/1
diff --git a/lib/vdsm/config.py.in b/lib/vdsm/config.py.in
index 591f268..437327b 100644
--- a/lib/vdsm/config.py.in
+++ b/lib/vdsm/config.py.in
@@ -293,6 +293,9 @@
('use_volume_leases', 'false',
'Whether to use the volume leases or not.'),
+
+ ('oop_impl', 'rfh',
+ 'Whether to use RFH or ioprocess implementation for oop.'),
]),
# Section: [addresses]
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 9040d79..5cca39a 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -360,6 +360,8 @@
self.__validateLvmLockingType()
+ oop.setDefaultImpl(config.get('irs', 'oop_impl'))
+
self.domainStateChangeCallbacks = set()
# cleanStorageRepoitory uses tasksDir value, this must be assigned
diff --git a/vdsm/storage/outOfProcess.py b/vdsm/storage/outOfProcess.py
index f3777a9..9897752 100644
--- a/vdsm/storage/outOfProcess.py
+++ b/vdsm/storage/outOfProcess.py
@@ -19,29 +19,45 @@
#
import types
+from ioprocess import IOProcess
+
from vdsm.config import config
import threading
from functools import partial
from remoteFileHandler import RemoteFileHandlerPool
+RFH = 'rfh'
+IOPROC = 'ioprocess'
+OOP_IMPL = RFH
+
DEFAULT_TIMEOUT = config.getint("irs", "process_pool_timeout")
HELPERS_PER_DOMAIN = config.getint("irs", "process_pool_max_slots_per_domain")
-_poolsLock = threading.Lock()
-_pools = {}
+_procLock = threading.Lock()
+_proc = {}
+
+
+def setDefaultImpl(impl):
+ global OOP_IMPL
+ OOP_IMPL = impl
def getProcessPool(clientName):
try:
- return _pools[clientName]
+ return _proc[clientName][OOP_IMPL]
except KeyError:
- with _poolsLock:
- if clientName not in _pools:
- _pools[clientName] = OopWrapper(
+ with _procLock:
+ if clientName not in _proc:
+ _proc[clientName][RFH] = OopWrapper(
RemoteFileHandlerPool(HELPERS_PER_DOMAIN))
+ if "Global" not in _proc:
+ _proc["Global"][IOPROC] = OopWrapper(
+ RemoteFileHandlerPool(HELPERS_PER_DOMAIN),
+ IOProcess(DEFAULT_TIMEOUT))
+ _proc[clientName][IOPROC] = _proc["Global"][IOPROC]
- return _pools[clientName]
+ return _proc[clientName][OOP_IMPL]
def getGlobalProcPool():
@@ -76,10 +92,23 @@
fullName)
-def OopWrapper(procPool):
- return _ModuleWrapper("oop", procPool, DEFAULT_TIMEOUT,
+class _IOProcWrapper(object):
+ def __init(self, _oop, ioproc):
+ self._oop = _oop
+ self._iop = ioproc
+
+ def __getattr__(self, name):
+ return self._oop.__getattr__(name)
+
+
+def OopWrapper(procPool, ioproc=None):
+ _oop = _ModuleWrapper("oop", procPool, DEFAULT_TIMEOUT,
(("os",
("path",)),
"glob",
"fileUtils",
"utils"))
+ if ioproc is None:
+ return _oop
+ else:
+ return _IOProcWrapper(_oop, ioproc)
--
To view, visit http://gerrit.ovirt.org/26576
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibd756afd43d23631dc7ed4bac64bec9a81b358b4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan(a)redhat.com>
10 years
Change in vdsm[master]: networkTests: Use bond5 in functional network tests.
by osvoboda@redhat.com
Ondřej Svoboda has uploaded a new change for review.
Change subject: networkTests: Use bond5 in functional network tests.
......................................................................
networkTests: Use bond5 in functional network tests.
bond0, originally used in the tests, is one of netinfo.REQUIRED_BONDINGS,
which are never deleted. In one approach to resetting bonding
options, this is done by deleting the bond -- bond0 would be unaffected.
Change-Id: I0adcd83658c6a6b744cb42faf4fb075e32e3b391
Signed-off-by: Ondřej Svoboda <osvoboda(a)redhat.com>
---
M tests/functional/networkTests.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/41/28141/1
diff --git a/tests/functional/networkTests.py b/tests/functional/networkTests.py
index a572a33..e17f2e4 100644
--- a/tests/functional/networkTests.py
+++ b/tests/functional/networkTests.py
@@ -49,7 +49,7 @@
NETWORK_NAME = 'test-network'
VLAN_ID = '27'
-BONDING_NAME = 'bond0'
+BONDING_NAME = 'bond5'
IP_ADDRESS = '240.0.0.1'
IP_NETWORK = '240.0.0.0'
IP_ADDRESS_IN_NETWORK = '240.0.0.50'
--
To view, visit http://gerrit.ovirt.org/28141
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0adcd83658c6a6b744cb42faf4fb075e32e3b391
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda <osvoboda(a)redhat.com>
10 years
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>
10 years
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>
10 years
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>
10 years
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>
10 years
Change in vdsm[master]: Avoid calling restorecon on a nonexistent dir.
by mtayer@redhat.com
mooli tayer has uploaded a new change for review.
Change subject: Avoid calling restorecon on a nonexistent dir.
......................................................................
Avoid calling restorecon on a nonexistent dir.
/var/log/core is only created when vdsm service goes up.
If vdsm never ran on the machine we might get:
restorecon: lstat(/var/log/core) failed: No such file or directory
Change-Id: Id7246b4947c0cdb52093c5fe0f60a690d72b1236
Signed-off-by: Mooli Tayer <mtayer(a)redhat.com>
---
M init/vdsmd_init_common.sh.in
M vdsm.spec.in
2 files changed, 4 insertions(+), 13 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/11/22211/1
diff --git a/init/vdsmd_init_common.sh.in b/init/vdsmd_init_common.sh.in
index 4b7d079..cc010fe 100644
--- a/init/vdsmd_init_common.sh.in
+++ b/init/vdsmd_init_common.sh.in
@@ -112,14 +112,6 @@
"@CHOWN_PATH@" @METADATAUSER@:@METADATAGROUP@ "${_DOM_METADATA_BACKUP_DIR}" > /dev/null 2>&1
}
-_mk_core_path() {
- local core_path=/var/log/core
- if ! [ -d "${core_path}" ]; then
- @MKDIR_P@ "${core_path}" > /dev/null 2>&1
- fi
- "@CHMOD_PATH@" a+tw "${core_path}" > /dev/null 2>&1
-}
-
_mk_run_path() {
local run_path
@@ -133,7 +125,6 @@
task_mkdirs(){
_mk_data_center
- _mk_core_path
_mk_dom_backup
_mk_run_path
"@CHMOD_PATH@" 1777 /dev/shm
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 7ee0218..a63e415 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -590,6 +590,10 @@
install -Dm 0644 vdsm/limits.conf \
%{buildroot}/etc/security/limits.d/99-vdsm.conf
+# This is not commonplace, but we want /var/log/core to be a world-writable
+# dropbox for core dumps
+install -dDm 1777 %{buildroot}%{_localstatedir}/log/core
+
%if 0%{?with_systemd}
install -Dm 0755 init/systemd/systemd-vdsmd %{buildroot}/lib/systemd/systemd-vdsmd
install -Dm 0644 init/systemd/vdsmd.service %{buildroot}%{_unitdir}/vdsmd.service
@@ -615,10 +619,6 @@
%endif
%if 0%{?rhel}
-# This is not commonplace, but we want /var/log/core to be a world-writable
-# dropbox for core dumps
-install -dDm 1777 %{buildroot}%{_localstatedir}/log/core
-%else
# Install the configuration sample
install -Dm 0644 lib/vdsm/vdsm.conf.sample \
%{buildroot}%{_sysconfdir}/vdsm/vdsm.conf
--
To view, visit http://gerrit.ovirt.org/22211
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id7246b4947c0cdb52093c5fe0f60a690d72b1236
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: mooli tayer <mtayer(a)redhat.com>
10 years