Change in vdsm[ovirt-3.2]: adding getHardwareInfo API to vdsm
by ybronhei@redhat.com
Hello Shu Ming, Saggi Mizrahi, Barak Azulay,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/11171
to review the following change.
Change subject: adding getHardwareInfo API to vdsm
......................................................................
adding getHardwareInfo API to vdsm
Super vdsm retrieves system info about host hardware
parameters. This info will be shown as part of getHardwareInfo
API call in a structure called HardwareInformation.
This feature currently available only for x86 cpu platfroms, for other
platfroms the api call returns empty dictionary.
Feature-Description:
http://wiki.ovirt.org/wiki/Features/Design/HostHardwareInfo
Change-Id: I265645bc67c9bcf14b4479a1fab22c7bd5e865fd
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
Reviewed-on: http://gerrit.ovirt.org/9258
Reviewed-by: Barak Azulay <bazulay(a)redhat.com>
Reviewed-by: Shu Ming <shuming(a)linux.vnet.ibm.com>
Reviewed-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
M vdsm.spec.in
M vdsm/API.py
M vdsm/BindingXMLRPC.py
M vdsm/Makefile.am
M vdsm/define.py
A vdsm/dmidecodeUtil.py
M vdsm/supervdsmServer.py
M vdsm_api/vdsmapi-schema.json
M vdsm_cli/vdsClient.py
9 files changed, 166 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/71/11171/1
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 14381e5..5b13419 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -45,6 +45,9 @@
BuildRequires: genisoimage
BuildRequires: openssl
BuildRequires: m2crypto
+%ifarch x86_64
+BuildRequires: python-dmidecode
+%endif
%if 0%{?rhel} == 6
BuildRequires: python-ordereddict
%endif
@@ -77,6 +80,7 @@
Requires: %{name}-xmlrpc = %{version}-%{release}
%ifarch x86_64
+Requires: python-dmidecode
Requires: dmidecode
%endif
@@ -610,6 +614,7 @@
%{_datadir}/%{vdsm_name}/blkid.py*
%{_datadir}/%{vdsm_name}/caps.py*
%{_datadir}/%{vdsm_name}/clientIF.py*
+%{_datadir}/%{vdsm_name}/dmidecodeUtil.py*
%{_datadir}/%{vdsm_name}/API.py*
%{_datadir}/%{vdsm_name}/hooking.py*
%{_datadir}/%{vdsm_name}/hooks.py*
diff --git a/vdsm/API.py b/vdsm/API.py
index a1e3f2c..732f8a3 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -1119,6 +1119,17 @@
return {'status': doneCode, 'info': c}
+ def getHardwareInfo(self):
+ """
+ Report host hardware information
+ """
+ try:
+ hw = supervdsm.getProxy().getHardwareInfo()
+ return {'status': doneCode, 'info': hw}
+ except:
+ self.log.error("failed to retrieve hardware info", exc_info=True)
+ return errCode['hwInfoErr']
+
def getStats(self):
"""
Report host statistics.
diff --git a/vdsm/BindingXMLRPC.py b/vdsm/BindingXMLRPC.py
index 73185b9..f19a8bb 100644
--- a/vdsm/BindingXMLRPC.py
+++ b/vdsm/BindingXMLRPC.py
@@ -288,6 +288,10 @@
ret['info'].update(self.getServerInfo())
return ret
+ def getHardwareInfo(self):
+ api = API.Global()
+ return api.getHardwareInfo()
+
def getStats(self):
api = API.Global()
return api.getStats()
@@ -768,6 +772,7 @@
(self.vmGetMigrationStatus, 'migrateStatus'),
(self.vmMigrationCancel, 'migrateCancel'),
(self.getCapabilities, 'getVdsCapabilities'),
+ (self.getHardwareInfo, 'getVdsHardwareInfo'),
(self.getStats, 'getVdsStats'),
(self.vmGetStats, 'getVmStats'),
(self.getAllVmStats, 'getAllVmStats'),
diff --git a/vdsm/Makefile.am b/vdsm/Makefile.am
index dc0590e..88b3287 100644
--- a/vdsm/Makefile.am
+++ b/vdsm/Makefile.am
@@ -32,6 +32,7 @@
configNetwork.py \
debugPluginClient.py \
dummybr.py \
+ dmidecodeUtil.py \
guestIF.py \
hooking.py \
hooks.py \
diff --git a/vdsm/define.py b/vdsm/define.py
index efebea1..01b0c60 100644
--- a/vdsm/define.py
+++ b/vdsm/define.py
@@ -127,6 +127,9 @@
'updateDevice': {'status':
{'code': 56,
'message': 'Failed to update device'}},
+ 'hwInfoErr': {'status':
+ {'code': 57,
+ 'message': 'Failed to read hardware information'}},
'recovery': {'status':
{'code': 99,
'message':
diff --git a/vdsm/dmidecodeUtil.py b/vdsm/dmidecodeUtil.py
new file mode 100644
index 0000000..eb8d834
--- /dev/null
+++ b/vdsm/dmidecodeUtil.py
@@ -0,0 +1,99 @@
+#
+# Copyright 2012 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+
+import dmidecode
+from vdsm import utils
+
+
+# This function gets dict and returns new dict that includes only string
+# value for each key. Keys in d that their value is a dictionary will be
+# ignored because those keys define a lable for the sub dictionary
+# (and those keys are irrelevant for us in dmidecode output)
+def __leafDict(d):
+ ret = {}
+ for k, v in d.iteritems():
+ if isinstance(v, dict):
+ ret.update(__leafDict(v))
+ else:
+ ret[k] = v
+ return ret
+
+
+(a)utils.memoized
+def getAllDmidecodeInfo():
+ myLeafDict = {}
+ for k in ('system', 'bios', 'cache', 'processor', 'chassis', 'memory'):
+ myLeafDict[k] = __leafDict(getattr(dmidecode, k)())
+ return myLeafDict
+
+
+(a)utils.memoized
+def getHardwareInfoStructure():
+ dmiInfo = getAllDmidecodeInfo()
+ sysStruct = {}
+ for k1, k2 in (('system', 'Manufacturer'),
+ ('system', 'Product Name'),
+ ('system', 'Version'),
+ ('system', 'Serial Number'),
+ ('system', 'UUID'),
+ ('system', 'Family')):
+ sysStruct[(k1 + k2).replace(' ', '')] = dmiInfo[k1][k2]
+
+ return sysStruct
+
+
+def printInfo(d):
+
+ def formatData(data):
+ return '\n'.join(['%s - %s' % (k, v) for k, v in data.iteritems()])
+
+ print(
+ """
+ SYSTEM INFORMATION
+ ==================
+{system}
+
+ BIOS INFORMATION
+ ================
+{bios}
+
+ CACHE INFORMATION
+ =================
+{cache}
+
+ PROCESSOR INFO
+ ==============
+{processor}
+
+ CHASSIS INFO
+ ============
+{chassis}
+
+ MEMORY INFORMATION
+ ==================
+{memory}
+ """.format(
+ system=formatData(d['system']),
+ bios=formatData(d['bios']),
+ cache=formatData(d['cache']),
+ processor=formatData(d['processor']),
+ chassis=formatData(d['chassis']),
+ memory=formatData(d['memory']))
+ )
diff --git a/vdsm/supervdsmServer.py b/vdsm/supervdsmServer.py
index 5effd41..dc89218 100755
--- a/vdsm/supervdsmServer.py
+++ b/vdsm/supervdsmServer.py
@@ -17,6 +17,7 @@
# Refer to the README and COPYING files for full details of the license
#
+import platform
import logging
import logging.config
import sys
@@ -94,6 +95,15 @@
return True
@logDecorator
+ def getHardwareInfo(self, *args, **kwargs):
+ if platform.machine() in ('x86_64', 'i686'):
+ from dmidecodeUtil import getHardwareInfoStructure
+ return getHardwareInfoStructure()
+ else:
+ # not implemented over other architecture
+ return {}
+
+ @logDecorator
def getDevicePartedInfo(self, *args, **kwargs):
return _getDevicePartedInfo(*args, **kwargs)
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index 7c9ef22..b69d33e 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -690,6 +690,31 @@
'data': {'release': 'str', 'version': 'str', 'name': 'OSName'}}
##
+# @HardwareInformation:
+#
+# Host hardware fields.
+#
+# @systemManufacturer: Host manufacturer's name
+#
+# @systemProductName: Host's hardware module
+#
+# @systemSerialNumber: Hardware serial number
+#
+# @systemFamily: Processor type
+#
+# @systemUUID: Host's hardware UUID
+#
+# @systemVersion: Host's hardware version
+#
+# Since: 4.10.3
+##
+{'type': 'HardwareInformation',
+ 'data': {'systemManufacturer': 'str',
+ 'systemProductName': 'str', 'systemVersion': 'str',
+ 'systemSerialNumber': 'str', 'systemUUID': 'str',
+ 'systemFamily': 'str'}}
+
+##
# @SoftwarePackage:
#
# An enumeration of aliases for important software components.
diff --git a/vdsm_cli/vdsClient.py b/vdsm_cli/vdsClient.py
index c67e3fe..884dc5d 100644
--- a/vdsm_cli/vdsClient.py
+++ b/vdsm_cli/vdsClient.py
@@ -411,6 +411,9 @@
def do_getCap(self, args):
return self.ExecAndExit(self.s.getVdsCapabilities())
+ def do_getHardware(self, args):
+ return self.ExecAndExit(self.s.getVdsHardwareInfo())
+
def do_getVdsStats(self, args):
return self.ExecAndExit(self.s.getVdsStats())
@@ -1900,6 +1903,10 @@
('',
'Get Capabilities info of the VDS'
)),
+ 'getVdsHardwareInfo': (serv.do_getHardware,
+ ('',
+ 'Get hardware info of the VDS'
+ )),
'getVdsStats': (serv.do_getVdsStats,
('',
'Get Statistics info on the VDS'
--
To view, visit http://gerrit.ovirt.org/11171
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I265645bc67c9bcf14b4479a1fab22c7bd5e865fd
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.2
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: Barak Azulay <bazulay(a)redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>
Gerrit-Reviewer: Shu Ming <shuming(a)linux.vnet.ibm.com>
11 years, 5 months
Change in vdsm[master]: network_linking: Apply whitelist to net conf.
by asegurap@redhat.com
Antoni Segura Puimedon has uploaded a new change for review.
Change subject: network_linking: Apply whitelist to net conf.
......................................................................
network_linking: Apply whitelist to net conf.
Libvirt does not support updating through virDomainUpdateFlags some
of the allowed configuration parameters for network cards. This
patch introduces a whitelist that contains what is changeable and
what is necessary to identify the nic, so other parameters like boot
order are filtered out.
As more changes are supported by libvirt, this whitelist should grow.
Change-Id: Id567d05e98b2edd0595c762e706da425435cda3e
Bug-Url: https://bugzilla.redhat.com/895294
Signed-off-by: Antoni S. Puimedon <asegurap(a)redhat.com>
---
M vdsm/libvirtvm.py
1 file changed, 6 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/48/11148/1
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index d13dbb0..5f755aa 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -1650,6 +1650,12 @@
link = xml.dom.minidom.Element('link')
vnicXML.appendChild(link)
link.setAttribute('state', linkValue)
+ # Libvirt does not support changing boot order for net devices, nor
+ # specifying it in updateDeviceFlags.https://bugzilla.redhat.com/895294
+ badTags = [tag for tag in vnicXML.childNodes if tag.nodeName not in
+ ('address', 'mac', 'model', 'source', 'filterref', 'link')]
+ for tag in badTags:
+ vnicXML.removeChild(tag)
try:
try:
self._dom.updateDeviceFlags(vnicXML.toxml(encoding='utf-8'),
--
To view, visit http://gerrit.ovirt.org/11148
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id567d05e98b2edd0595c762e706da425435cda3e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap(a)redhat.com>
11 years, 5 months
Change in vdsm[master]: Add a flag to libvirtvm's status to report watchdog event
by shaohef@linux.vnet.ibm.com
ShaoHe Feng has uploaded a new change for review.
Change subject: Add a flag to libvirtvm's status to report watchdog event
......................................................................
Add a flag to libvirtvm's status to report watchdog event
This flag will be set once watchdog event is triggered.
And thie flag will be not cleanup after it is set unless the client
restart or shutdown VM. So add a timestamp in the message of this flag.
The timestamp is the time in seconds since the Epoch.
When the client poll this flag, it should record and check the timestamp
to make sure that the event is already triggered.
Change-Id: I7aa676299c748d761e216469569156140a79af65
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
M vdsm/libvirtvm.py
1 file changed, 4 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/29/9429/1
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index 3439dc3..15d3187 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -2225,6 +2225,8 @@
except IndexError:
return "Received unknown watchdog action(%s)" % action
+ self.watchdogEvent = "Time: %s, Action: %s" % (time.time(),
+ actionToString(action))
self.log.debug("Watchdog event comes from guest %s. "
"Action: %s", self.conf['vmName'],
actionToString(action))
@@ -2449,6 +2451,8 @@
def getStats(self):
stats = vm.Vm.getStats(self)
stats['hash'] = self._devXmlHash
+ if hasattr(self, "watchdogEvent"):
+ stats["watchdogEvent"] = self.watchdogEvent
return stats
def _getBalloonInfo(self):
--
To view, visit http://gerrit.ovirt.org/9429
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7aa676299c748d761e216469569156140a79af65
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
11 years, 5 months
Change in vdsm[master]: Use cp to copy sparse volumes when moving a vm
by ykaplan@redhat.com
Hello Lee Yarwood,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/10543
to review the following change.
Change subject: Use cp to copy sparse volumes when moving a vm
......................................................................
Use cp to copy sparse volumes when moving a vm
Previously all volumes were copied with dd, with sparse files this
would result in the destination volume being fully allocated.
Change-Id: I0c4c693884a225c868c18bdcb4930c2c1042db2c
Signed-off-by: Lee Yarwood <lyarwood(a)redhat.com>
Signed-off-by: Yeela Kaplan <ykaplan(a)redhat.com>
---
M vdsm/storage/image.py
M vdsm/storage/misc.py
2 files changed, 36 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/43/10543/1
diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py
index 4364c38..a8af04f 100644
--- a/vdsm/storage/image.py
+++ b/vdsm/storage/image.py
@@ -25,6 +25,7 @@
from contextlib import contextmanager
import volume
+import fileVolume
from sdc import sdCache
import sd
import misc
@@ -582,8 +583,16 @@
# Do the actual copy
try:
dstVol = destDom.produceVolume(imgUUID=imgUUID, volUUID=srcVol.volUUID)
- srcSize = srcVol.getVolumeSize(bs=1)
- misc.ddWatchCopy(srcVol.getVolumePath(), dstVol.getVolumePath(), vars.task.aborting, size=srcSize)
+ # Copy sparse files with cp.
+ if isinstance(dstVol, fileVolume.FileVolume):
+ misc.cpWatchCopy(srcVol.getVolumePath(),
+ dstVol.getVolumePath(), vars.task.aborting,
+ sparse=True)
+ else:
+ srcSize = srcVol.getVolumeSize(bs=1)
+ misc.ddWatchCopy(srcVol.getVolumePath(),
+ dstVol.getVolumePath(), vars.task.aborting,
+ size=srcSize)
except se.ActionStopped:
raise
except se.StorageException:
diff --git a/vdsm/storage/misc.py b/vdsm/storage/misc.py
index 81cb9e7..3cdac72 100644
--- a/vdsm/storage/misc.py
+++ b/vdsm/storage/misc.py
@@ -397,6 +397,31 @@
return "".join(random.sample(string.letters, strLen))
+def cpWatchCopy(src, dst, stop, sparse=False, recoveryCallback=None):
+ """
+ Copy src to dst using cp with stop abilities.
+ """
+ cmd = [constants.EXT_CP, src, dst]
+
+ if sparse:
+ cmd.append("--sparse=always")
+
+ cmd = constants.CMD_LOWPRIO + cmd
+
+ if not stop:
+ (rc, out, err) = execCmd(cmd, sudo=False, nice=NICENESS.LOW,
+ ioclass=IOCLASS.IDLE)
+ else:
+ (rc, out, err) = watchCmd(cmd, stop=stop,
+ recoveryCallback=recoveryCallback,
+ nice=NICENESS.LOW, ioclass=IOCLASS.IDLE)
+
+ if rc:
+ raise se.MiscFileWriteException()
+
+ return (rc, out, err)
+
+
def ddWatchCopy(src, dst, stop, size, offset=0, recoveryCallback=None):
"""
Copy src to dst using dd command with stop abilities
--
To view, visit http://gerrit.ovirt.org/10543
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0c4c693884a225c868c18bdcb4930c2c1042db2c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan(a)redhat.com>
Gerrit-Reviewer: Lee Yarwood <lyarwood(a)redhat.com>
11 years, 5 months
Change in vdsm[master]: fix the optional parameters error of api schema file
by shaohef@linux.vnet.ibm.com
ShaoHe Feng has uploaded a new change for review.
Change subject: fix the optional parameters error of api schema file
......................................................................
fix the optional parameters error of api schema file
some discrptions of optional parameters miss #optional
some definitions of optional parameters miss *
Change-Id: Ia596c38bcb46aa0798ac2147376e9132be292750
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
M vdsm_api/vdsmapi-schema.json
1 file changed, 12 insertions(+), 12 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/47/10447/1
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index 8837409..cfde542 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -294,9 +294,9 @@
#
# @action: The type of fencing operation to perform (from @FenceNodeAction)
#
-# @secure: Enable SSL communication
+# @secure: #optional Enable SSL communication
#
-# @options: Additional agent-specific parameters in space-separated
+# @options: #optional Additional agent-specific parameters in space-separated
# <var>=<val> pairs
#
# Returns:
@@ -2429,7 +2429,7 @@
# are reserved for host-passthrough and host-mode cpu
# mode
#
-# @custom: A dictionary of custom, free-form properties
+# @custom: #optional A dictionary of custom, free-form properties
#
# @devices: An array of VM devices present
#
@@ -2480,7 +2480,7 @@
##
{'type': 'VmDefinition',
'data': {'acpiEnable': 'bool', 'clientIp': 'str', 'cpuType': 'str',
- 'custom': 'StringMap', 'devices': ['VmDevice'],
+ '*custom': 'StringMap', 'devices': ['VmDevice'],
'display': 'VmDisplayType', 'displayIp': 'str',
'displayPort': 'uint', 'displaySecurePort': 'uint',
'emulatedMachine': 'str', 'keyboardLayout': 'str',
@@ -2498,7 +2498,7 @@
#
# @acpiEnable: Indicates if ACPI is enabled inside the VM
#
-# @custom: #opional A dictionary of custom, free-form properties
+# @custom: #optional A dictionary of custom, free-form properties
#
# @devices: #optional An array of VM devices requested
#
@@ -2982,9 +2982,9 @@
#
# @volumeList: A list of Volume UUIDs
#
-# @postZero: If True, overwrite Volume data with zeroes after deletion
+# @postZero: #optional If True, overwrite Volume data with zeroes after deletion
#
-# @force: Force the operation and do not perform any validation
+# @force: #optional Force the operation and do not perform any validation
#
# Returns:
# A task UUID
@@ -4261,9 +4261,9 @@
#
# @enableScsiFencing: This parameter is not used
#
-# @maxHostID: The maximum number of hosts that could be in the cluster
+# @maxHostID: #optional The maximum number of hosts that could be in the cluster
#
-# @domVersion: The expected Storage Domain version of the master domain
+# @domVersion: #optional The expected Storage Domain version of the master domain
#
# Returns:
# A task UUID
@@ -5313,10 +5313,10 @@
#
# @dstparams: Used only by the hibernate API. Ignored for @remote migration
#
-# @mode: The migration mode. Callers of this API should use @remote. For
+# @mode: #optional The migration mode. Callers of this API should use @remote. For
# @file migration use @VM.hibernate.
#
-# @method:
+# @method: #optional
#
# Since: 4.10.0
##
@@ -5499,7 +5499,7 @@
# Since: 4.10.0
##
{'command': {'class': 'VM', 'name': 'shutdown'},
- 'data': {'vmID': 'UUID', 'delay': 'int', 'message': 'str'}}
+ 'data': {'vmID': 'UUID', '*delay': 'int', '*message': 'str'}}
##
# @SnapshotVolumeDriveInfo:
--
To view, visit http://gerrit.ovirt.org/10447
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia596c38bcb46aa0798ac2147376e9132be292750
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
11 years, 5 months
Change in vdsm[master]: fix two parameters of VmParameters in vdsmapi schema
by shaohef@linux.vnet.ibm.com
ShaoHe Feng has uploaded a new change for review.
Change subject: fix two parameters of VmParameters in vdsmapi schema
......................................................................
fix two parameters of VmParameters in vdsmapi schema
from the comments of VmParameters, the two parameters are #optional
Change-Id: Id9bce789c1d33357e079ff47300a99a59025834e
Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
---
M vdsm_api/vdsmapi-schema.json
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/12/9112/1
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index d210c7d..6fa45de 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -2382,8 +2382,8 @@
'data': {'acpiEnable': 'bool',
'*custom': 'StringMap', '*devices': ['VmDevice'],
'display': 'VmDisplayType', 'kvmEnable': 'bool', 'memSize': 'uint',
- 'nice': 'int', 'smp': 'uint', 'smpCoresPerSocket': 'uint',
- 'smpThreadsPerCore': 'uint', 'timeOffset': 'uint',
+ 'nice': 'int', 'smp': 'uint', '*smpCoresPerSocket': 'uint',
+ '*smpThreadsPerCore': 'uint', 'timeOffset': 'uint',
'transparentHugePages': 'bool', 'vmId': 'UUID', 'vmName': 'str',
'vmType': 'VmType'}}
--
To view, visit http://gerrit.ovirt.org/9112
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id9bce789c1d33357e079ff47300a99a59025834e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
11 years, 5 months
Change in vdsm[ovirt-3.2]: Searching for both py and pyc file to start super vdsm
by ybronhei@redhat.com
Hello Douglas Schilling Landgraf, Dan Kenigsberg,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/11133
to review the following change.
Change subject: Searching for both py and pyc file to start super vdsm
......................................................................
Searching for both py and pyc file to start super vdsm
In oVirt Node we don't keep py files.
Change-Id: I36771ce46f5d00ad8befe33569252bdb8cffeaa1
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
Reviewed-on: http://gerrit.ovirt.org/10854
Reviewed-by: Douglas Schilling Landgraf <dougsland(a)redhat.com>
Reviewed-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm/supervdsm.py
1 file changed, 9 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/33/11133/1
diff --git a/vdsm/supervdsm.py b/vdsm/supervdsm.py
index 532d5ac..740a93e 100644
--- a/vdsm/supervdsm.py
+++ b/vdsm/supervdsm.py
@@ -35,19 +35,23 @@
_g_singletonSupervdsmInstance_lock = threading.Lock()
-def __supervdsmServerPath(serverFile):
+def __supervdsmServerPath():
base = os.path.dirname(__file__)
- serverPath = os.path.join(base, serverFile)
- if os.path.exists(serverPath):
- return os.path.abspath(serverPath)
+ # serverFile can be both the py or pyc file. In oVirt node we don't keep
+ # py files. this method looks for one of the two to calculate the absolute
+ # path of supervdsmServer
+ for serverFile in ("supervdsmServer.py", "supervdsmServer.pyc"):
+ serverPath = os.path.join(base, serverFile)
+ if os.path.exists(serverPath):
+ return os.path.abspath(serverPath)
raise RuntimeError("SuperVDSM Server not found")
PIDFILE = os.path.join(constants.P_VDSM_RUN, "svdsm.pid")
TIMESTAMP = os.path.join(constants.P_VDSM_RUN, "svdsm.time")
ADDRESS = os.path.join(constants.P_VDSM_RUN, "svdsm.sock")
-SUPERVDSM = __supervdsmServerPath("supervdsmServer.py")
+SUPERVDSM = __supervdsmServerPath()
extraPythonPathList = []
--
To view, visit http://gerrit.ovirt.org/11133
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I36771ce46f5d00ad8befe33569252bdb8cffeaa1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.2
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Douglas Schilling Landgraf <dougsland(a)redhat.com>
11 years, 5 months
Change in vdsm[master]: Changing threadName when using multiprocessing package
by ybronhei@redhat.com
Yaniv Bronhaim has uploaded a new change for review.
Change subject: Changing threadName when using multiprocessing package
......................................................................
Changing threadName when using multiprocessing package
multiprocessing.manager adds current process name in front of current
threadName. This patch changes the name back to Thread-[No].
Change-Id: I541beb63fd5e1a2f7d6eed7f66f4970bf37a6705
Bug-Id: https://bugzilla.redhat.com/show_bug.cgi?id=868663
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
---
M vdsm/supervdsmServer.py
1 file changed, 3 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/37/9037/1
diff --git a/vdsm/supervdsmServer.py b/vdsm/supervdsmServer.py
index a1bf8e6..a5bfc68 100755
--- a/vdsm/supervdsmServer.py
+++ b/vdsm/supervdsmServer.py
@@ -74,6 +74,9 @@
def wrapper(*args, **kwargs):
try:
+ threadName = threading.current_thread().name
+ if threadName.find('|') != -1:
+ _, threading.current_thread().name = threadName.split('|')
return func(*args, **kwargs)
except:
callbackLogger.error("Error in %s", func.__name__, exc_info=True)
--
To view, visit http://gerrit.ovirt.org/9037
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I541beb63fd5e1a2f7d6eed7f66f4970bf37a6705
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
11 years, 5 months
Change in vdsm[master]: Adding new resourceFactory that only opens fd
by ybronhei@redhat.com
Yaniv Bronhaim has uploaded a new change for review.
Change subject: Adding new resourceFactory that only opens fd
......................................................................
Adding new resourceFactory that only opens fd
Avoiding activate every time we try to access lv and only open fd
instead. This replace the refCounter and the call to lvchange anytime we
prepare volume.
Change-Id: Ic936c8959562a262de5ceba8ca4f68bc53b5cae2
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
---
M vdsm/storage/blockVolume.py
M vdsm/storage/resourceFactories.py
2 files changed, 51 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/84/8084/1
diff --git a/vdsm/storage/blockVolume.py b/vdsm/storage/blockVolume.py
index 38285c1..2324ee7 100644
--- a/vdsm/storage/blockVolume.py
+++ b/vdsm/storage/blockVolume.py
@@ -35,7 +35,7 @@
import resourceManager as rm
from threadLocal import vars
from sdc import sdCache
-from resourceFactories import LVM_ACTIVATION_NAMESPACE
+import resourceFactories as rf
import fileUtils
TAG_PREFIX_MD = "MD_"
@@ -75,8 +75,22 @@
def __init__(self, repoPath, sdUUID, imgUUID, volUUID):
self.metaoff = None
volume.Volume.__init__(self, repoPath, sdUUID, imgUUID, volUUID)
- self.lvmActivationNamespace = sd.getNamespace(self.sdUUID,
- LVM_ACTIVATION_NAMESPACE)
+ self._registerResourceNamespaces(sdUUID,volUUID)
+
+ def _registerResourceNamespaces(self, sdUUID, volUUID):
+ """
+ Register resources namespaces and create
+ factories for it.
+ """
+ rmanager = rm.ResourceManager.getInstance()
+ # Register lvm activation resource namespace for the underlying VG
+ volWatcherFactory = rf.VolumeWatcherFactory(sdUUID, volUUID)
+ self.volWatcherNamespace = rf.VOLUME_WATCHER_NAMESPACE
+ try:
+ rmanager.registerNamespace(self.volWatcherNamespace, volWatcherFactory)
+ except Exception:
+ self.log.warn("Resource namespace %s already registered", self.volWatcherNamespace)
+
def validate(self):
try:
@@ -356,8 +370,14 @@
if setrw:
self.setrw(rw=rw)
access = rm.LockType.exclusive if rw else rm.LockType.shared
- activation = rmanager.acquireResource(self.lvmActivationNamespace,
+
+ # active volume
+ self.activateVolumes(self.volUUID)
+
+ # acquireResource - open file
+ activation = rmanager.acquireResource(self.volWatcherNamespace,
self.volUUID, access)
+
activation.autoRelease = False
@classmethod
@@ -369,9 +389,10 @@
"""
cls.log.info("Tearing down volume %s/%s justme %s"
% (sdUUID, volUUID, justme))
- lvmActivationNamespace = sd.getNamespace(sdUUID,
- LVM_ACTIVATION_NAMESPACE)
- rmanager.releaseResource(lvmActivationNamespace, volUUID)
+
+ cls.deactivateVolumes(volUUID)
+
+ rmanager.releaseResource(cls.volWatcherNamespace, volUUID)
if not justme:
try:
pvolUUID = _getVolumeTag(sdUUID, volUUID, TAG_PREFIX_PARENT)
diff --git a/vdsm/storage/resourceFactories.py b/vdsm/storage/resourceFactories.py
index 02aba0f..8893f70 100644
--- a/vdsm/storage/resourceFactories.py
+++ b/vdsm/storage/resourceFactories.py
@@ -31,11 +31,34 @@
LVM_ACTIVATION_NAMESPACE = 'lvmActivationNS'
IMAGE_NAMESPACE = 'imageNS'
VOLUME_NAMESPACE = 'volumeNS'
+VOLUME_WATCHER_NAMESPACE = 'volWatchNS'
rmanager = rm.ResourceManager.getInstance()
log = logging.getLogger('Storage.ResourcesFactories')
+class VolumeWatcher(object):
+ def __init__(self, vgName, lvName):
+ self._path = lvm.lvPath(vgName, lvName)
+ try:
+ self._f = open(self._path)
+ except IOError:
+ log.error("Cannot open device %s", self._path)
+
+ def close(self):
+ try:
+ self._f.close()
+ except:
+ log.error("error closing device %s", self._path)
+
+class VolumeWatcherFactory(rm.SimpleResourceFactory):
+ def __init__(self, vgName, lvName):
+ rm.SimpleResourceFactory.__init__(self)
+ self._lv = lvName
+ self._vg = vgName
+
+ def createResource(self):
+ return VolumeWatcher(self._lv, self._vg)
class LvmActivation(object):
"""
--
To view, visit http://gerrit.ovirt.org/8084
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic936c8959562a262de5ceba8ca4f68bc53b5cae2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
11 years, 5 months
Change in vdsm[master]: prepare volume instead of prepare blockSD
by ybronhei@redhat.com
Yaniv Bronhaim has uploaded a new change for review.
Change subject: prepare volume instead of prepare blockSD
......................................................................
prepare volume instead of prepare blockSD
Bug-Id: https://bugzilla.redhat.com/show_bug.cgi?id=851837
change the call of activateVolume to llprepare volume, and
teardown instead of deactiveVolume, which sperates lv
syscall operation to only verifies that the lv is in used as
part of the volume. If the sd is in use by the checked volume,
we want to keep ref counter to sign this volume, and when we
teardown it, we verify that there are no references to the same
sd before deactivate it.
Change-Id: I25b9c260a7de5f883420a5322f90195b3379e80e
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
---
M vdsm/storage/image.py
1 file changed, 2 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/50/8050/1
diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py
index d004046..97112dc 100644
--- a/vdsm/storage/image.py
+++ b/vdsm/storage/image.py
@@ -383,8 +383,7 @@
chain.insert(0, tmplVolume)
# Activating the volumes
- sdCache.produce(sdUUID).activateVolumes(
- volUUIDs=[vol.volUUID for vol in chain])
+ sdCache.produce(sdUUID).llPrepare()
return chain
@@ -392,11 +391,8 @@
chain = self.getChain(sdUUID, imgUUID, volUUID)
# Deactivating the volumes
- sdCache.produce(sdUUID).deactivateVolumes(
- volUUIDs=[vol.volUUID for vol in chain])
-
# Do not deactivate the template yet (might be in use by an other vm)
- # TODO: reference counting to deactivate when unused
+ sdCache.produce(sdUUID).teardown(sdUUID, volUUIDs=[vol.volUUID for vol in chain])
def __templateRelink(self, destDom, imgUUID, volUUID):
"""
--
To view, visit http://gerrit.ovirt.org/8050
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I25b9c260a7de5f883420a5322f90195b3379e80e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
11 years, 5 months