Change in vdsm[master]: vdsm: export mininum kernel via caps
by Douglas Schilling Landgraf
Douglas Schilling Landgraf has uploaded a new change for review.
Change subject: vdsm: export mininum kernel via caps
......................................................................
vdsm: export mininum kernel via caps
Export to engine the minimum kernel required for vdsm.
Change-Id: I16c496e1a77639c39fae733e3a34c974b6f10b5c
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=966158
Signed-off-by: Douglas Schilling Landgraf <dougsland(a)redhat.com>
---
M .gitignore
M configure.ac
M vdsm.spec.in
M vdsm/Makefile.am
R vdsm/caps.py.in
5 files changed, 20 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/92/19792/1
diff --git a/.gitignore b/.gitignore
index 295e1fb..290bf67 100644
--- a/.gitignore
+++ b/.gitignore
@@ -50,6 +50,7 @@
vdsm.spec
vdsm/dsaversion.py
vdsm/dumpStorageTable.py
+vdsm/caps.py
vdsm/logger.conf
vdsm/mk_sysprep_floppy
vdsm/mom.conf
diff --git a/configure.ac b/configure.ac
index 93b6b96..694242d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -119,6 +119,10 @@
AC_SUBST([SNLKUSER], [sanlock])
AC_SUBST([SNLKGROUP], [sanlock])
+# Minimum Kernel
+AC_SUBST([KERNEL_MINIMUM_VERSION_EL6], [2.6.32-279.9.1])
+AC_SUBST([KERNEL_MINIMUM_UPSTREAM], [3.6])
+
# VDSM default paths
AC_SUBST([vdsmdir], ['${datarootdir}/vdsm'])
AC_SUBST([vdsmconfdir], ['${sysconfdir}/vdsm'])
diff --git a/vdsm.spec.in b/vdsm.spec.in
index e175ff8..942d417 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -150,7 +150,7 @@
Requires: device-mapper-multipath >= 0.4.9-52
Requires: e2fsprogs >= 1.41.12-11
Requires: fence-agents
-Requires: kernel >= 2.6.32-279.9.1
+Requires: kernel >= @KERNEL_MINIMUM_VERSION_EL6@
Requires: sanlock >= 2.3-4, sanlock-python
Requires: initscripts >= 9.03.31-2.el6_3.1
Requires: policycoreutils >= 2.0.83-19.30
@@ -179,7 +179,7 @@
Requires: iscsi-initiator-utils >= 6.2.0.872-14
Requires: device-mapper-multipath >= 0.4.9-18
Requires: e2fsprogs >= 1.41.14
-Requires: kernel >= 3.6
+Requires: kernel >= @KERNEL_MINIMUM_UPSTREAM@
Requires: sanlock >= 2.4-2, sanlock-python
Requires: policycoreutils-python
Requires: sed >= 4.2.1-10
diff --git a/vdsm/Makefile.am b/vdsm/Makefile.am
index 305ef6b..f135f73 100644
--- a/vdsm/Makefile.am
+++ b/vdsm/Makefile.am
@@ -27,7 +27,6 @@
API.py \
BindingXMLRPC.py \
blkid.py \
- caps.py \
clientIF.py \
configNetwork.py \
debugPluginClient.py \
@@ -64,6 +63,7 @@
$(NULL)
nodist_vdsm_PYTHON = \
+ caps.py \
dsaversion.py \
dumpStorageTable.py
@@ -94,6 +94,7 @@
vdsmd.8
CLEANFILES = \
+ caps.py \
config.log \
$(nodist_vdsm_SCRIPTS) \
$(nodist_vdsmlib_PYTHON) \
@@ -103,6 +104,7 @@
$(nodist_man8_MANS)
EXTRA_DIST = \
+ caps.py.in \
dsaversion.py.in \
dumpStorageTable.py.in \
libvirt_password \
diff --git a/vdsm/caps.py b/vdsm/caps.py.in
similarity index 96%
rename from vdsm/caps.py
rename to vdsm/caps.py.in
index 3a7a6a2..fd6d528 100644
--- a/vdsm/caps.py
+++ b/vdsm/caps.py.in
@@ -318,7 +318,16 @@
except:
logging.error('kernel build time not found', exc_info=True)
t = '0'
- return dict(version=ver, release=rel, buildtime=t)
+
+ # kernel minimum version
+ osname = getos()
+ if osname == OSName.RHEL:
+ kernel_min_version = '@KERNEL_MINIMUM_VERSION_EL6@'
+ else:
+ kernel_min_version = '@KERNEL_MINIMUM_UPSTREAM@'
+
+ return dict(version=ver, release=rel, buildtime=t,
+ kernel_minimum_version=kernel_min_version)
pkgs = {'kernel': kernelDict()}
--
To view, visit http://gerrit.ovirt.org/19792
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I16c496e1a77639c39fae733e3a34c974b6f10b5c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <dougsland(a)redhat.com>
10 years, 1 month
Change in vdsm[master]: lvm: refresh on mda permission mismatch
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: lvm: refresh on mda permission mismatch
......................................................................
lvm: refresh on mda permission mismatch
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=905665
Change-Id: I6a77b967a057329a90499d7707074befe756b68a
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
M vdsm/storage/lvm.py
1 file changed, 3 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/21/20121/1
diff --git a/vdsm/storage/lvm.py b/vdsm/storage/lvm.py
index 0c2964e..3686570 100644
--- a/vdsm/storage/lvm.py
+++ b/vdsm/storage/lvm.py
@@ -1299,6 +1299,9 @@
changelv(vg, lv, ("--permission", permission))
except se.StorageException:
l = getLV(vg, lv)
+ if l.attr.permission == 'R':
+ refreshLV(vg, lv)
+ l = getLV(vg, lv)
if l.writeable == rw:
# Ignore the error since lv is now rw, hoping that the error was
# because lv was already rw, see BZ#654691. We may hide here
--
To view, visit http://gerrit.ovirt.org/20121
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6a77b967a057329a90499d7707074befe756b68a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
10 years, 1 month
Change in vdsm[master]: hooks: macbind - This hook support binding specified mac add...
by hchiramm@redhat.com
humble devassy has uploaded a new change for review.
Change subject: hooks: macbind - This hook support binding specified mac address to custom/other bridge than the currently defined bridge in ovirt. This hook is also capable of binding a mac address to openvswitch bridge.
......................................................................
hooks: macbind - This hook support binding specified
mac address to custom/other bridge than the currently defined
bridge in ovirt. This hook is also capable of binding
a mac address to openvswitch bridge.
Change-Id: I0356dfab224a9082b44aae1c66df050f7456301c
Signed-off-by: Humble Chirammal <hchiramm(a)redhat.com>
---
A vdsm_hooks/macbind/Makefile.am
A vdsm_hooks/macbind/README
A vdsm_hooks/macbind/before_vm_start.py
3 files changed, 187 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/95/17895/1
diff --git a/vdsm_hooks/macbind/Makefile.am b/vdsm_hooks/macbind/Makefile.am
new file mode 100644
index 0000000..27dc5af
--- /dev/null
+++ b/vdsm_hooks/macbind/Makefile.am
@@ -0,0 +1,30 @@
+#
+# 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 = \
+ before_vm_start.py
+
+install-data-local:
+ $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start
+ $(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \
+ $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_macbind
+
+uninstall-local:
+ $(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_macbind
diff --git a/vdsm_hooks/macbind/README b/vdsm_hooks/macbind/README
new file mode 100644
index 0000000..15bcfeb
--- /dev/null
+++ b/vdsm_hooks/macbind/README
@@ -0,0 +1,39 @@
+macbind vdsm hook:
+============
+This hook goes through all of the VM's interfaces and manipulate its
+XML file acccording to the input. This can be used to attach a VM nic
+to a specific bridge which is available in the hypervisor for 'that' VM run
+or permanently.
+
+
+One specific use case being attach a virtual network interface to an
+openvswitch bridge. Other being, attach vm nic to a different bridge
+than the defined/default bridge for that NIC.
+
+
+Syntax:
+ macbind=macaddress-brName-portType,...
+
+where:
+
+macaddress: specify a macaddress which need to be attached to the VM
+brName : Bridge Name available in hypervisor
+portType : This have to either 'ovs' or 'lb' or ''
+
+For ex:
+
+macbind= 00:1a:4a:41:d2:5f-ovsbr0-ovs,00:1a:4a:41:d2:b8-br88-lb
+
+Installation:
+* Use the engine-config to append the appropriate custom property as such:
+ sudo engine-config -s UserDefinedVMProperties=
+ 'previousProperties;macbind=^.*$' --cver=3.2
+
+* Verify that the macbind custom property was properly added:
+ sudo engine-config -g UserDefinedVMProperties
+
+Usage:
+In the VM configuration window, open the custom properites tab
+and add macbind=
+
+NOTE: Live migration is **not** tested.
diff --git a/vdsm_hooks/macbind/before_vm_start.py b/vdsm_hooks/macbind/before_vm_start.py
new file mode 100755
index 0000000..5606614
--- /dev/null
+++ b/vdsm_hooks/macbind/before_vm_start.py
@@ -0,0 +1,118 @@
+#!/usr/bin/python
+
+import os
+import sys
+import hooking
+import traceback
+
+'''
+
+macbind:
+
+syntax:
+macbind=macaddress-brName-portType,...
+refer README for more details.
+
+
+if 'ovs' as portType:
+
+<interface type='bridge'>
+ <mac address='00:1a:4a:41:d2:5f'/>
+ <source bridge='ovsbr0'/>
+ <model type='virtio'/>
+ <virtualport type='openvswitch'/>
+ <filterref filter='vdsm-no-mac-spoofing'/>
+ <link state='up'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+</interface>
+
+If 'lb' or '' as portType:
+The given bridge will be replaced with current bridge:
+
+<interface type='bridge'>
+ <mac address='00:1a:4a:41:d2:b8'/>
+ <source bridge='br0'/>
+ <model type='virtio'/>
+ <filterref filter='vdsm-no-mac-spoofing'/>
+ <link state='up'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+</interface>
+
+'''
+
+
+def createVportElement(domxml, porttype):
+ vPort = domxml.createElement('virtualport')
+ vPort.setAttribute('type', 'openvswitch')
+ return vPort
+
+
+def createSbridgeElement(domxml, brName):
+ sBridge = domxml.createElement('source')
+ sBridge.setAttribute('bridge', brName)
+ return sBridge
+
+
+def removeElement(interface, Element):
+ interface.removeChild(Element)
+
+
+if 'macbind' in os.environ:
+ try:
+
+ macbinds = os.environ['macbind']
+ domxml = hooking.read_domxml()
+ macAddr = ''
+ brName = ''
+ pType = ''
+
+ for nic in macbinds.split(','):
+ try:
+ macAddr, brName, pType = nic.split('-')
+ macAddr = macAddr.strip()
+ brName = brName.strip()
+ pType = pType.strip()
+
+ except ValueError:
+ sys.stderr.write('macbind: input error, expected '
+ 'macbind:macAddr:brName:pType,'
+ 'where brName is bridgename'
+ 'pType can be ovs|lb')
+ sys.exit(2)
+ if pType == "ovs":
+ command = ['/usr/bin/ovs-vsctl', 'br-exists %s' % (brName)]
+ retcode, out, err = hooking.execCmd(
+ command, sudo=False, raw=True)
+ if retcode != 0:
+ sys.stderr.write('macbind: Error in finding ovsbridge:'
+ '%s: %s, err = %s' %
+ (brName, ' '.join(command), err))
+ continue
+ if pType == "lb" or pType == '':
+ command = ['/usr/sbin/brctl', 'show', brName]
+ retcode, out, err = hooking.execCmd(
+ command, sudo=False, raw=True)
+
+ if err or retcode != 0:
+ sys.stderr.write('macbind: Error in finding Linuxbridge:'
+ ' %s \n: %s, err = %s\n' %
+ (brName, ' '.join(command), err))
+ continue
+
+ for interface in domxml.getElementsByTagName('interface'):
+ for macaddress in interface.getElementsByTagName('mac'):
+ addr = macaddress.getAttribute('address')
+ if addr == macAddr:
+ for bridge in interface.getElementsByTagName('source'):
+ interface.removeChild(bridge)
+ interface.appendChild(
+ createSbridgeElement(domxml, brName))
+ if pType == "ovs":
+ interface.appendChild(
+ createVportElement(domxml, 'openvswitch'))
+
+ hooking.write_domxml(domxml)
+ except:
+ sys.stderr.write('macbind: [unexpected error]: %s\n' %
+ traceback.format_exc())
+ sys.exit(2)
--
To view, visit http://gerrit.ovirt.org/17895
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0356dfab224a9082b44aae1c66df050f7456301c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: humble devassy <hchiramm(a)redhat.com>
10 years, 1 month
Change in vdsm[master]: Improve logging on some filesystem operations
by xfrancis@redhat.com
Xavi Francisco has uploaded a new change for review.
Change subject: Improve logging on some filesystem operations
......................................................................
Improve logging on some filesystem operations
The rationale behind this patch is to increase the logging on some
filesystem operations. Before no trace was given when creating or
deleting symbolic links or removing or renaming files or folders in
storage operations. This patch tries to solve this adding debug
messages after those operations succeed.
This patch only includes the logging in the VDSM process so no OOP
log management is needed.
Change-Id: I3602513af123951f71091c03f799e36ea759aa61
Signed-off-by: Xavi Francisco <xfrancis(a)redhat.com>
---
M vdsm/storage/blockSD.py
M vdsm/storage/blockVolume.py
M vdsm/storage/fileSD.py
M vdsm/storage/fileUtils.py
M vdsm/storage/fileVolume.py
M vdsm/storage/sp.py
6 files changed, 20 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/46/26046/1
diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py
index cac59fa..9e73647 100644
--- a/vdsm/storage/blockSD.py
+++ b/vdsm/storage/blockSD.py
@@ -1056,6 +1056,7 @@
imgUUID)
try:
os.symlink(imgPath, dst)
+ self.log.debug("symlink created from %s to %s", imgPath, dst)
except OSError as e:
if e.errno == errno.EEXIST:
self.log.debug("path to image directory already exists: %s",
@@ -1085,6 +1086,8 @@
dstVol = os.path.join(imgRunDir, volUUID)
try:
os.symlink(srcVol, dstVol)
+ self.log.debug("symlink created from %s to %s", srcvol,
+ sdtvol)
except OSError as e:
if e.errno == errno.EEXIST:
self.log.debug("img run vol already exists: %s", dstVol)
@@ -1316,6 +1319,7 @@
if not os.path.lexists(dst):
src = lvm.lvPath(self.sdUUID, lvName)
os.symlink(src, dst)
+ self.log.debug("symlink created from %s to %s", src, dst)
def extendVolume(self, volumeUUID, size, isShuttingDown=None):
self._extendlock.acquire()
diff --git a/vdsm/storage/blockVolume.py b/vdsm/storage/blockVolume.py
index 36bfa1f..a438b09 100644
--- a/vdsm/storage/blockVolume.py
+++ b/vdsm/storage/blockVolume.py
@@ -110,6 +110,7 @@
if os.path.lexists(volPath):
os.unlink(volPath)
+ cls.log.debug("Unlinking half baked volume: %s", volPath)
@classmethod
def validateCreateVolumeParams(cls, volFormat, preallocate, srcVolUUID):
@@ -251,6 +252,7 @@
try:
os.unlink(vol_path)
+ self.log.debug("Unlinking %s", vol_path)
return True
except Exception as e:
eFound = e
@@ -433,6 +435,7 @@
volPath = os.path.join(self.imagePath, self.volUUID)
if not os.path.lexists(volPath):
os.symlink(lvm.lvPath(self.sdUUID, self.volUUID), volPath)
+ self.log.debug("Creating symlink to %s", volPath)
self.volumePath = volPath
def getVolumeTag(self, tagPrefix):
diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py
index 180a43f..d488706 100644
--- a/vdsm/storage/fileSD.py
+++ b/vdsm/storage/fileSD.py
@@ -357,6 +357,7 @@
self.oop.os.remove(volPath)
self.oop.os.remove(volPath + '.meta')
self.oop.os.remove(volPath + '.lease')
+ self.log.debug("Removed volume: %s", volPath)
except OSError:
self.log.error("vol: %s can't be removed.",
volPath, exc_info=True)
@@ -441,6 +442,8 @@
imgRunDir = os.path.join(sdRunDir, imgUUID)
try:
os.symlink(srcImgPath, imgRunDir)
+ self.log.debug("Created img run dir from %s to %s", srcImagePath,
+ imgRunDir)
except OSError as e:
if e.errno == errno.EEXIST:
self.log.debug("img run dir already exists: %s", imgRunDir)
@@ -537,6 +540,7 @@
masterdir = os.path.join(self.domaindir, sd.MASTER_FS_DIR)
if not self.oop.fileUtils.pathExists(masterdir):
self.oop.os.mkdir(masterdir, 0o755)
+ self.log.debug("Created master directory: %s", masterdir)
def unmountMaster(self):
"""
@@ -603,6 +607,7 @@
tLink = os.path.join(basePath, rImg, volFile)
tVol = os.path.join(basePath, templateImage, volFile)
self.oop.utils.forceLink(tVol, tLink)
+ self.log.debug("Relinking %s to %s", tVol, tLink)
def getMountsList(pattern="*"):
diff --git a/vdsm/storage/fileUtils.py b/vdsm/storage/fileUtils.py
index f1af44a..3e46a32 100644
--- a/vdsm/storage/fileUtils.py
+++ b/vdsm/storage/fileUtils.py
@@ -141,7 +141,7 @@
cleanupdir_errors.append('%s: %s' % (func.__name__, exc_info[1]))
shutil.rmtree(dirPath, onerror=logit)
-
+ log.debug("Removed directory: %s", dirPath)
if not ignoreErrors and cleanupdir_errors:
raise RuntimeError("%s %s" % (dirPath, cleanupdir_errors))
@@ -160,6 +160,7 @@
try:
os.makedirs(*params)
+ log.debug("Created directory: %s", dirPath)
except OSError as e:
if e.errno != errno.EEXIST:
raise
diff --git a/vdsm/storage/fileVolume.py b/vdsm/storage/fileVolume.py
index f2a93d6..df0d075 100644
--- a/vdsm/storage/fileVolume.py
+++ b/vdsm/storage/fileVolume.py
@@ -286,6 +286,7 @@
metaPath = self._getMetaVolumePath()
if self.oop.os.path.lexists(metaPath):
self.oop.os.unlink(metaPath)
+ self.log.debug("Removing metadada: %s", metaPath)
def getMetadataId(self):
"""
@@ -455,6 +456,7 @@
"renameVolumeRollback",
[volPath, self.volumePath]))
self.oop.os.rename(self.volumePath, volPath)
+ self.log.debug("Renamed %s to %s", self.volumePath, volPath)
if recovery:
name = "Rename meta-volume rollback: " + metaPath
vars.task.pushRecovery(task.Recovery(name, "fileVolume",
@@ -462,6 +464,7 @@
"renameVolumeRollback",
[metaPath, prevMetaPath]))
self.oop.os.rename(prevMetaPath, metaPath)
+ self.log.debug("Renamed %s to %s", prevMetaPath, metaPath)
if recovery:
name = "Rename lease-volume rollback: " + leasePath
vars.task.pushRecovery(task.Recovery(name, "fileVolume",
@@ -470,6 +473,7 @@
[leasePath, prevLeasePath]))
try:
self.oop.os.rename(prevLeasePath, leasePath)
+ self.log.debug("Renamed %s to %s", prevLeasePath, leasePath)
except OSError as e:
if e.errno != os.errno.ENOENT:
raise
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index a63d074..5b88551 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -1128,12 +1128,14 @@
str(uuid.uuid4()))
os.symlink(src, tmp_link_name) # make tmp_link
os.rename(tmp_link_name, linkName)
+ self.log.debug("Storage domain linked from %s to %s", src, linkName)
@unsecured
def _cleanupDomainLinks(self, domain):
linkPath = os.path.join(self.poolPath, domain)
try:
os.remove(linkPath)
+ self.log.debug("Removed domain link: %s", linkPath)
except (OSError, IOError):
pass
--
To view, visit http://gerrit.ovirt.org/26046
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3602513af123951f71091c03f799e36ea759aa61
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Xavi Francisco <xfrancis(a)redhat.com>
10 years, 1 month
Change in vdsm[master]: Adding remove\disable verbs to vdsm-tool for admin usages
by ybronhei@redhat.com
Yaniv Bronhaim has uploaded a new change for review.
Change subject: Adding remove\disable verbs to vdsm-tool for admin usages
......................................................................
Adding remove\disable verbs to vdsm-tool for admin usages
The spec will be modified separately to use vdsm-tool instead of hard-coded
operations
Change-Id: Ie7f2c031436a6d202f856c24d9c9420c8bfdf6df
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
---
M lib/vdsm/constants.py.in
M lib/vdsm/tool/configurator.py
M lib/vdsm/tool/passwd.py
M lib/vdsm/tool/seboolsetup.py
4 files changed, 118 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/72/21772/1
diff --git a/lib/vdsm/constants.py.in b/lib/vdsm/constants.py.in
index 790a3a0..43e13da 100644
--- a/lib/vdsm/constants.py.in
+++ b/lib/vdsm/constants.py.in
@@ -80,6 +80,15 @@
P_VDSM_EXEC = '@LIBEXECDIR@'
#
+# Configuration file definitions
+#
+SYSCONF_PATH = '@sysconfdir@'
+P_SYSTEMCTL_CONF = SYSCONF_PATH + '/sysctl.d/vdsm'
+P_VDSM_LCONF = SYSCONF_PATH + '/libvirt/libvirtd.conf'
+P_VDSM_LDCONF = SYSCONF_PATH + '/sysconfig/libvirtd'
+P_VDSM_QCONF = SYSCONF_PATH + '/libvirt/qemu.conf'
+
+#
# External programs (sorted, please keep in order).
#
EXT_BLKID = '@BLKID_PATH@'
diff --git a/lib/vdsm/tool/configurator.py b/lib/vdsm/tool/configurator.py
index 51eda80..a30827a 100644
--- a/lib/vdsm/tool/configurator.py
+++ b/lib/vdsm/tool/configurator.py
@@ -21,11 +21,13 @@
import sys
import grp
import argparse
+import tempfile
+import shutil
from .. import utils
from . import service, expose
-from ..constants import P_VDSM_EXEC, DISKIMAGE_GROUP
-from ..constants import QEMU_PROCESS_GROUP, VDSM_GROUP
+from ..constants import P_VDSM_EXEC, DISKIMAGE_GROUP, QEMU_PROCESS_GROUP, \
+ VDSM_GROUP, P_VDSM_LCONF, P_VDSM_QCONF, P_VDSM_LDCONF, P_SYSTEMCTL_CONF
class _ModuleConfigure(object):
@@ -47,6 +49,35 @@
def isconfigured(self):
return True
+ def removeConf(self, filename, beginField=None, endField=None):
+ newfile = []
+ if not beginField and not endField:
+ return
+ else:
+ with open(filename, 'r') as f:
+ skip = False
+ for line in f.readlines():
+ if beginField and endField:
+ if skip:
+ if line.startswith(endField):
+ skip = False
+ continue
+ if line.startswith(beginField):
+ skip = True
+ continue
+ elif beginField:
+ if line.startswith(beginField):
+ continue
+ else:
+ if line.endswith('%s\n' % endField):
+ continue
+ newfile.append(line)
+ tmp_file = tempfile.NamedTemporaryFile(delete=False)
+ tname = tmp_file.name
+ tmp_file.writelines(newfile)
+ tmp_file.close()
+ shutil.move(tname, filename)
+
class LibvirtModuleConfigure(_ModuleConfigure):
def __init__(self):
@@ -57,6 +88,28 @@
def getServices(self):
return ["supervdsmd", "vdsmd", "libvirtd"]
+
+ def removeConf(self):
+ vdsm_ver = '-4.9.10'
+ conf_prefix = '## beginning of configuration section by vdsm' + \
+ vdsm_ver
+ conf_suffix = '## end of configuration section by vdsm' + vdsm_ver
+
+ conf_paths = [
+ P_VDSM_LCONF,
+ P_VDSM_QCONF,
+ P_VDSM_LDCONF,
+ ]
+ for path in conf_paths:
+ try:
+ super(LibvirtModuleConfigure, self).removeConf(path,
+ conf_prefix,
+ conf_suffix)
+ except OSError, e:
+ if e.errno != os.errno.EEXIST:
+ raise
+
+ utils.rmFile(P_SYSTEMCTL_CONF)
def _exec_libvirt_configure(self, action):
"""
@@ -113,6 +166,9 @@
def getServices(self):
return ['sanlock']
+
+ def removeConf(self):
+ pass
def configure(self):
"""
@@ -257,6 +313,25 @@
raise RuntimeError("Config is not valid. Check conf files")
+@expose("remove-config")
+def remove_config(*args):
+ """
+ Remove vdsm configuration from conf files
+ """
+ args = _parse_args('remove-config')
+ m = [
+ c.getName() for c in __configurers
+ if c.getName() in args.modules and not c.removeConf()
+ ]
+ if m:
+ sys.stdout.write(
+ "Could not remove configuration for modules %s\n" % ','.join(m),
+ )
+ ret = False
+ if not ret:
+ raise RuntimeError("Remove configuration failed")
+
+
def _parse_args(action):
parser = argparse.ArgumentParser('vdsm-tool %s' % (action))
allModules = [n.getName() for n in __configurers]
diff --git a/lib/vdsm/tool/passwd.py b/lib/vdsm/tool/passwd.py
index 0b127c8..4e40948 100644
--- a/lib/vdsm/tool/passwd.py
+++ b/lib/vdsm/tool/passwd.py
@@ -43,4 +43,17 @@
stderr=subprocess.PIPE, close_fds=True)
output, err = p.communicate()
if p.returncode != 0:
- raise Exception("Set password failed: %s" % (err, ))
+ raise RuntimeError("Set password failed: %s" % (err, ))
+
+
+@expose("remove-saslpasswd")
+def remove_saslpasswd():
+ """
+ Remove vdsm password for libvirt connection
+ """
+ script = ['/usr/sbin/saslpasswd2', '-p', '-a', 'libvirt', '-d',
+ constants.SASL_USERNAME]
+ p = subprocess.Popen(script)
+ output, err = p.communicate()
+ if p.returncode != 0:
+ raise RuntimeError("Remove password failed: %s" % (err, ))
diff --git a/lib/vdsm/tool/seboolsetup.py b/lib/vdsm/tool/seboolsetup.py
index f664ecd..7c1effa 100644
--- a/lib/vdsm/tool/seboolsetup.py
+++ b/lib/vdsm/tool/seboolsetup.py
@@ -18,6 +18,7 @@
# Refer to the README and COPYING files for full details of the license
#
+import selinux
from . import expose
SEBOOL_ENABLED = "on"
@@ -63,3 +64,20 @@
def sebool_unconfig():
"""Disable the required selinux booleans"""
setup_booleans(False)
+
+
+@expose("clear-selinux-policy")
+def clear_selinux_policy():
+ """
+ Clear the changes of selinux policy
+ """
+ selinux_policys = [
+ 'virt_use_nfs',
+ 'virt_use_sanlock',
+ 'sanlock_use_nfs',
+ ]
+
+ if selinux.is_selinux_enabled():
+ for policy in selinux_policys:
+ selinux.security_set_boolean(policy, 0)
+ selinux.security_commit_booleans()
--
To view, visit http://gerrit.ovirt.org/21772
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie7f2c031436a6d202f856c24d9c9420c8bfdf6df
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
10 years, 1 month
Change in vdsm[master]: sp: Remove invalid validation of stale meta data
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: sp: Remove invalid validation of stale meta data
......................................................................
sp: Remove invalid validation of stale meta data
When refreshing a storage pool, we used to validate the the metadata
before refreshing the pool. This validation fail if the storage domain
was just upgraded from old format where metadata was storaged on the
medadata lv, to the new format keeping metadata in the lv tags.
The validation is pefromed now after the refresh, ensuring that the
metadata is correct after a successful refresh.
Change-Id: I27ab243a03f23b1155867f2eeec98b1481b5b72d
Bug-Url: https://bugzilla.redhat.com/954169
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/storage/hsm.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/68/24568/1
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index d6d0715..5720b17 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -872,8 +872,8 @@
pool = self.getPool(spUUID)
try:
- self.validateSdUUID(msdUUID)
pool.refresh(msdUUID, masterVersion)
+ self.validateSdUUID(msdUUID)
except:
self._disconnectPool(pool, pool.id, False)
raise
--
To view, visit http://gerrit.ovirt.org/24568
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I27ab243a03f23b1155867f2eeec98b1481b5b72d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
10 years, 1 month
Change in vdsm[master]: hooks: Add hook for fake VM stats
by dkuznets@redhat.com
Dima Kuznetsov has uploaded a new change for review.
Change subject: hooks: Add hook for fake VM stats
......................................................................
hooks: Add hook for fake VM stats
Added hook to generate random VmStats for fake (or real) VMs.
Added before and after get VM stats hook. Currently there is no use for
before hook and I cannot think of any way it can be useful, but added
for symmetry.
Change-Id: I6a6d13f43495170a5cb86ae0b0efc1ae85ef05ab
Signed-off-by: Dima Kuznetsov <dkuznets(a)redhat.com>
---
M configure.ac
M vdsm.spec.in
M vdsm/hooking.py
M vdsm/hooks.py
M vdsm/vm.py
M vdsm_hooks/Makefile.am
A vdsm_hooks/fakevmstats/Makefile.am
A vdsm_hooks/fakevmstats/after_vm_stats.py
8 files changed, 102 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/27/25927/1
diff --git a/configure.ac b/configure.ac
index 55879e7..6d73711 100644
--- a/configure.ac
+++ b/configure.ac
@@ -279,6 +279,7 @@
vdsm_hooks/checkimages/Makefile
vdsm_hooks/directlun/Makefile
vdsm_hooks/extnet/Makefile
+ vdsm_hooks/fakevmstats/Makefile
vdsm_hooks/faqemu/Makefile
vdsm_hooks/fileinject/Makefile
vdsm_hooks/floppy/Makefile
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 041deac..d6f5a71 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -584,6 +584,12 @@
%description hook-vmdisk
Hook adds additional disk image for a VM (raw or qcow2)
+%package hook-fakevmstats
+Summary: Generate random VM statistics
+BuildArch: noarch
+
+%description hook-fakevmstats
+Hook intercepts VM's stats and randomizes various fields.
%if 0%{?with_gluster}
%package gluster
Summary: Gluster Plugin for VDSM
@@ -1331,6 +1337,11 @@
%{_libexecdir}/%{vdsm_name}/hooks/before_device_create/50_vmfex
%{_libexecdir}/%{vdsm_name}/hooks/before_device_migrate_destination/50_vmfex
%{_libexecdir}/%{vdsm_name}/hooks/before_nic_hotplug/50_vmfex
+
+%files hook-fakevmstats
+%defattr(-, root, root, -)
+%{_libexecdir}/%{vdsm_name}/hooks/after_vm_stats/10_fakevmstats
+
%endif
%files debug-plugin
diff --git a/vdsm/hooking.py b/vdsm/hooking.py
index b6be7ca..a49032c 100644
--- a/vdsm/hooking.py
+++ b/vdsm/hooking.py
@@ -36,6 +36,7 @@
>2 - reserved
"""
+import json
import os
import sys
from xml.dom import minidom
@@ -56,6 +57,14 @@
file(os.environ['_hook_domxml'], 'w').write(domxml.toxml(encoding='utf-8'))
+def read_json():
+ return json.loads(file(os.environ['_hook_json']).read())
+
+
+def write_json(data):
+ file(os.environ['_hook_json'], 'w').write(json.dumps(data))
+
+
def exit_hook(message, return_code=2):
"""
Exit the hook with a given message, which will be printed to the standard
diff --git a/vdsm/hooks.py b/vdsm/hooks.py
index 75f33f9..1689eb9 100644
--- a/vdsm/hooks.py
+++ b/vdsm/hooks.py
@@ -339,6 +339,15 @@
raiseError=False, hookType=_JSON_HOOK)
+def before_vm_stats():
+ pass
+
+
+def after_vm_stats(stats):
+ return _runHooksDir(stats, 'after_vm_stats', raiseError=False,
+ hookType=_JSON_HOOK)
+
+
def _getScriptInfo(path):
try:
with file(path) as f:
diff --git a/vdsm/vm.py b/vdsm/vm.py
index c53f1d4..60e9e8c 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -2813,6 +2813,7 @@
stats['hash'] = self._devXmlHash
if self._watchdogEvent:
stats["watchdogEvent"] = self._watchdogEvent
+ stats = hooks.after_vm_stats(stats)
return stats
def _getStatsInternal(self):
diff --git a/vdsm_hooks/Makefile.am b/vdsm_hooks/Makefile.am
index ce4aa46..f6cffe6 100644
--- a/vdsm_hooks/Makefile.am
+++ b/vdsm_hooks/Makefile.am
@@ -29,6 +29,7 @@
directlun \
extnet \
fileinject \
+ fakevmstats \
floppy \
hostusb \
hugepages \
diff --git a/vdsm_hooks/fakevmstats/Makefile.am b/vdsm_hooks/fakevmstats/Makefile.am
new file mode 100644
index 0000000..8e416b0
--- /dev/null
+++ b/vdsm_hooks/fakevmstats/Makefile.am
@@ -0,0 +1,35 @@
+#
+# Copyright 2011-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
+#
+
+include $(top_srcdir)/build-aux/Makefile.subs
+
+CLEANFILES = \
+ config.log
+
+EXTRA_DIST = \
+ after_vm_stats.py
+
+install-data-local:
+ $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/after_vm_stats
+ $(INSTALL_SCRIPT) $(srcdir)/after_vm_stats.py \
+ $(DESTDIR)$(vdsmhooksdir)/after_vm_stats/10_fakevmstats
+
+uninstall-local:
+ $(RM) $(DESTDIR)$(vdsmhooksdir)/after_vm_stats/10_fakevmstats
diff --git a/vdsm_hooks/fakevmstats/after_vm_stats.py b/vdsm_hooks/fakevmstats/after_vm_stats.py
new file mode 100644
index 0000000..6ff0468
--- /dev/null
+++ b/vdsm_hooks/fakevmstats/after_vm_stats.py
@@ -0,0 +1,35 @@
+#!/usr/bin/python
+import hooking
+import random
+
+
+def randomizeRuntimeStats(stats):
+ cpuTotal = random.random() * 100.0
+ cpuUser = random.random() * cpuTotal
+ stats['cpuUser'] = '%.2f' % (cpuUser)
+ stats['cpuSys'] = '%.2f' % (cpuTotal - cpuUser)
+ stats['memUsage'] = str(random.randint(0, 100))
+
+ # Disks
+ for disk in stats['disks'].iterkeys():
+ # Simulate some supersonic disks:
+ stats['disks'][disk]['readRate'] = str(random.randint(0, 2**32))
+ stats['disks'][disk]['writeRate'] = str(random.randint(0, 2**32))
+ stats['disks'][disk]['readLatency'] = str(random.randint(0, 10**9))
+ stats['disks'][disk]['writeLatency'] = str(random.randint(0, 10**9))
+ stats['disks'][disk]['flushLatency'] = str(random.randint(0, 10**9))
+
+ # Network:
+ for net in stats['network'].iterkeys():
+ stats['network'][net]['rxRate'] = '%.1f' % (random.random() * 100)
+ stats['network'][net]['rxDropped'] = str(random.randint(0, 2*32))
+ stats['network'][net]['rxErrors'] = str(random.randint(0, 2*32))
+ stats['network'][net]['txRate'] = '%.1f' % (random.random() * 100)
+ stats['network'][net]['txDropped'] = str(random.randint(0, 2*32))
+ stats['network'][net]['txErrors'] = str(random.randint(0, 2*32))
+
+
+if __name__ == '__main__':
+ stats = hooking.read_json()
+ randomizeRuntimeStats(stats)
+ hooking.write_json(stats)
--
To view, visit http://gerrit.ovirt.org/25927
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6a6d13f43495170a5cb86ae0b0efc1ae85ef05ab
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dima Kuznetsov <dkuznets(a)redhat.com>
10 years, 1 month
Change in vdsm[master]: sp: setDomainRegularRole is implemented by backend
by Nir Soffer
Nir Soffer has uploaded a new change for review.
Change subject: sp: setDomainRegularRole is implemented by backend
......................................................................
sp: setDomainRegularRole is implemented by backend
Commit ab6014b394 factored out metadata access to pool backend, but left
one call to StoragePool.setDomainRegularRole() that is implemented now
by the backend. Detected by pylint.
Change-Id: Ia49e45ccab0b933a8f1abc988ea0bd60e7b99b7d
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M vdsm/storage/sp.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/95/24495/1
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index a020e1e..162f061 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -810,7 +810,7 @@
except Exception:
self.log.exception('migration to new master failed')
try:
- self.setDomainRegularRole(newmsd)
+ self._backend.setDomainRegularRole(newmsd)
except Exception:
self.log.exception('unable to mark domain %s as regular',
newmsd.sdUUID)
--
To view, visit http://gerrit.ovirt.org/24495
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia49e45ccab0b933a8f1abc988ea0bd60e7b99b7d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>
10 years, 1 month
Change in vdsm[master]: vdsm: [wip] modeling graphics as a device
by fkobzik@redhat.com
Frank Kobzik has uploaded a new change for review.
Change subject: vdsm: [wip] modeling graphics as a device
......................................................................
vdsm: [wip] modeling graphics as a device
naive impl
setvmticket
Signed-off-by: Frantisek Kobzik <fkobzik(a)redhat.com>
Change-Id: Ia59b933f4cd1e3ab562ad2ec1c237007c83f214c
---
M vdsm/vm.py
1 file changed, 126 insertions(+), 20 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/55/23555/1
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 7c2d496..7b51c3e 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -18,6 +18,7 @@
# Refer to the README and COPYING files for full details of the license
#
+from pprint import pprint
# stdlib imports
from contextlib import contextmanager
@@ -69,6 +70,7 @@
DISK_DEVICES = 'disk'
NIC_DEVICES = 'interface'
VIDEO_DEVICES = 'video'
+GRAPHICS_DEVICES = 'graphics'
SOUND_DEVICES = 'sound'
CONTROLLER_DEVICES = 'controller'
GENERAL_DEVICES = 'general'
@@ -1172,9 +1174,9 @@
commandLine.appendChildWithArgs('qemu:arg', value='keyboard')
self.dom.appendChild(commandLine)
- def appendGraphics(self):
+ def appendGraphicsFromDisplay(self):
"""
- Add graphics section to domain xml.
+ Legacy add graphics section to domain xml.
<graphics autoport="yes" listen="0" type="vnc"/>
@@ -1187,6 +1189,10 @@
<target type='virtio' name='com.redhat.spice.0'/>
</channel>
"""
+ for dev in self.conf['devices']:
+ if dev['type'] == GRAPHICS_DEVICES:
+ return # probably could be written more sane
+
graphicsAttrs = {'port': self.conf['displayPort'], 'autoport': 'yes'}
if self.conf['display'] == 'vnc':
graphicsAttrs['type'] = 'vnc'
@@ -1316,6 +1322,69 @@
video.appendChildWithArgs('model', type=self.device, **sourceAttrs)
return video
+
+
+class GraphicsDevice(VmDevice):
+
+ def getXML(self):
+ """
+ Create domxml for a graphics framebuffer.
+
+ <graphics type='spice' port='5900' tlsPort='5901' autoport='yes'
+ listen='0' keymap='en-us'
+ passwdValidTo='1970-01-01T00:00:01'>
+ <listen type='address' address='0'/>
+ <clipboard copypaste='no'/>
+ </graphics>
+ OR
+ <graphics type='vnc' port='5900' autoport='yes' listen='0'
+ keymap='en-us' passwdValidTo='1970-01-01T00:00:01'>
+ <listen type='address' address='0'/>
+ </graphics>
+
+ """
+ self.log.error("=========== Using new GraphicsDevice")
+ pprint(self.conf)
+ self.log.error("*********** ")
+ pprint(self.specParams)
+ self.log.error("=========== ")
+
+ specParams = self.specParams
+ graphicsAttrs = {'type': specParams['type'],
+ 'port': specParams['port'],
+ 'autoport': 'yes'
+ }
+
+ for key in ('tlsPort', 'keymap'):
+ if key in specParams:
+ graphicsAttrs[key] = specParams[key]
+
+ if specParams.get('disableTicketing', '').lower() != 'true':
+ graphicsAttrs['passwd'] = '*****'
+ graphicsAttrs['passwdValidTo'] = '1970-01-01T00:00:01'
+
+ graphics = XMLElement('graphics', **graphicsAttrs)
+
+ if graphicsAttrs['type'] == 'spice':
+ if specParams.get('spiceSecureChannels'):
+ for channel in specParams['spiceSecureChannels'].split(','):
+ graphics.appendChildWithArgs('channel', name=channel[1:],
+ mode='secure')
+
+ # this MUST be certainly handled as a separate device
+ #vmc = XMLElement('channel', type='spicevmc')
+ #vmc.appendChildWithArgs('target', type='virtio',
+ # name='com.redhat.spice.0')
+ #self._devices.appendChild(vmc)
+
+ if self.conf.get('displayNetwork'):
+ graphics.appendChildWithArgs('listen', type='network',
+ network=netinfo.LIBVIRT_NET_PREFIX +
+ self.conf.get('displayNetwork'))
+ else:
+ graphics.setAttrs(listen='0')
+
+ return graphics
class SoundDevice(VmDevice):
@@ -1857,6 +1926,7 @@
(NIC_DEVICES, NetworkInterfaceDevice),
(SOUND_DEVICES, SoundDevice),
(VIDEO_DEVICES, VideoDevice),
+ (GRAPHICS_DEVICES, GraphicsDevice),
(CONTROLLER_DEVICES, ControllerDevice),
(GENERAL_DEVICES, GeneralDevice),
(BALLOON_DEVICES, BalloonDevice),
@@ -2043,6 +2113,8 @@
devices[NIC_DEVICES] = self.getConfNetworkInterfaces()
devices[SOUND_DEVICES] = self.getConfSound()
devices[VIDEO_DEVICES] = self.getConfVideo()
+ # devices[GRAPHICS_DEVICES] = self.getConfVideo() - todo isn't it
+ # handled by appendGraphicsFromDisplay??
devices[CONTROLLER_DEVICES] = self.getConfController()
else:
for dev in self.conf.get('devices'):
@@ -2951,7 +3023,7 @@
self._qemuguestSocketFile.decode('utf-8'),
_QEMU_GA_DEVICE_NAME)
domxml.appendInput()
- domxml.appendGraphics()
+ domxml.appendGraphicsFromDisplay()
if self.arch == caps.Architecture.PPC64:
domxml.appendEmulator()
@@ -2995,6 +3067,7 @@
self._getUnderlyingDisplayPort()
self._getUnderlyingSoundDeviceInfo()
self._getUnderlyingVideoDeviceInfo()
+ self._getUnderlyingGraphicsDeviceInfo()
self._getUnderlyingControllerDeviceInfo()
self._getUnderlyingBalloonDeviceInfo()
self._getUnderlyingWatchdogDeviceInfo()
@@ -4463,25 +4536,39 @@
return {'status': doneCode, 'vmList': self.status()}
def setTicket(self, otp, seconds, connAct, params):
- graphics = _domParseStr(self._dom.XMLDesc(0)).childNodes[0]. \
- getElementsByTagName('graphics')[0]
- graphics.setAttribute('passwd', otp)
- if int(seconds) > 0:
- validto = time.strftime('%Y-%m-%dT%H:%M:%S',
- time.gmtime(time.time() + float(seconds)))
- graphics.setAttribute('passwdValidTo', validto)
- if graphics.getAttribute('type') == 'spice':
- graphics.setAttribute('connected', connAct)
- hooks.before_vm_set_ticket(self._lastXMLDesc, self.conf, params)
- try:
- self._dom.updateDeviceFlags(graphics.toxml(), 0)
- except TimeoutError as tmo:
+ # todo consider invalidating ticket for other devices
+ graphics = self._getFirstGraphicsOfType(params.get('graphicsType'))
+
+ if graphics is None:
res = {'status': {'code': errCode['ticketErr']['status']['code'],
- 'message': unicode(tmo)}}
+ 'message': 'VM has no graphics devices'}}
else:
- hooks.after_vm_set_ticket(self._lastXMLDesc, self.conf, params)
- res = {'status': doneCode}
+ graphics.setAttribute('passwd', otp)
+ if int(seconds) > 0:
+ validto = time.strftime('%Y-%m-%dT%H:%M:%S',
+ time.gmtime(time.time() + float(seconds)))
+ graphics.setAttribute('passwdValidTo', validto)
+ if graphics.getAttribute('type') == 'spice':
+ graphics.setAttribute('connected', connAct)
+ hooks.before_vm_set_ticket(self._lastXMLDesc, self.conf, params)
+ try:
+ self._dom.updateDeviceFlags(graphics.toxml(), 0)
+ except TimeoutError as tmo:
+ res = {'status': {'code': errCode['ticketErr']['status']['code'],
+ 'message': unicode(tmo)}}
+ else:
+ hooks.after_vm_set_ticket(self._lastXMLDesc, self.conf, params)
+ res = {'status': doneCode}
return res
+
+ def _getFirstGraphicsOfType(self, gtype=None):
+ all_graphics = _domParseStr(self._dom.XMLDesc(0)).childNodes[0]. \
+ getElementsByTagName('graphics')
+ for gxml in all_graphics:
+ if gtype is None or gxml.getAttribute('type') == gtype:
+ return gxml
+
+ return None
def _reviveTicket(self, newlife):
"""Revive an existing ticket, if it has expired or about to expire"""
@@ -5006,9 +5093,28 @@
self.log.debug('Found unknown drive: %s', diskDev)
self.conf['devices'].append(diskDev)
+ def _getUnderlyingGraphicsDeviceInfo(self):
+ """
+ Obtain graphics framebuffer devices info from libvirt.
+ Libvirt only allows 0 or 1 device of each type, so mapping between
+ _devices and conf.devices is based on this fact.
+
+ """
+ graphicsxml = _domParseStr(self._lastXMLDesc).childNodes[0]. \
+ getElementsByTagName('devices')[0].getElementsByTagName('graphics')
+
+ for gxml in graphicsxml:
+ graphics_type = gxml.getAttribute('type')
+
+ for dev in self.conf['devices']:
+ specParams = dev.get('specParams', {})
+ if specParams.get('type', '') == graphics_type:
+ specParams['port'] = gxml.getAttribute('port')
+ specParams['tlsPort'] = gxml.getAttribute('tlsPort')
+
def _getUnderlyingDisplayPort(self):
"""
- Obtain display port info from libvirt.
+ Obtain display port info from libvirt. Legacy.
"""
graphics = _domParseStr(self._lastXMLDesc).childNodes[0]. \
getElementsByTagName('graphics')[0]
--
To view, visit http://gerrit.ovirt.org/23555
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia59b933f4cd1e3ab562ad2ec1c237007c83f214c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Frank Kobzik <fkobzik(a)redhat.com>
10 years, 1 month
Change in vdsm[master]: gluster: Enhancing glusterVolumeStatus verb to include volum...
by dnarayan@redhat.com
Hello Bala.FA,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/23201
to review the following change.
Change subject: gluster: Enhancing glusterVolumeStatus verb to include volume stats info.
......................................................................
gluster: Enhancing glusterVolumeStatus verb to include volume stats info.
glusterVolumeStatus verb is enhanced to include volume stats info
along with the existing status information when the statusOption
is set as detail.
Change-Id: Idf978b25fa6c09097fdfbc65937056082c5bff10
Signed-off-by: ndarshan <dnarayan(a)redhat.com>
---
M vdsm/gluster/api.py
1 file changed, 10 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/01/23201/1
diff --git a/vdsm/gluster/api.py b/vdsm/gluster/api.py
index 3cc5493..62c7ba9 100644
--- a/vdsm/gluster/api.py
+++ b/vdsm/gluster/api.py
@@ -208,6 +208,16 @@
options=None):
status = self.svdsmProxy.glusterVolumeStatus(volumeName, brick,
statusOption)
+ if statusOption == 'detail':
+ statvfsData = self.svdsmProxy.glusterVolumeStatsInfoGet(volumeName)
+ total = ((statvfsData.f_blocks -
+ (statvfsData.f_bfree - statvfsData.f_bavail)) *
+ statvfsData.f_bsize)
+ free = statvfsData.f_bavail * statvfsData.f_bsize
+ used = total - free
+ status['volumeStatsInfo'] = {'total': str(total),
+ 'free': str(free),
+ 'used': str(used)}
return {'volumeStatus': status}
@exportAsVerb
--
To view, visit http://gerrit.ovirt.org/23201
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idf978b25fa6c09097fdfbc65937056082c5bff10
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Darshan N <dnarayan(a)redhat.com>
Gerrit-Reviewer: Bala.FA <barumuga(a)redhat.com>
10 years, 1 month