Change in vdsm[master]: hsm: encapsulate devPath in appropriateDevice
by derez@redhat.com
Daniel Erez has uploaded a new change for review.
Change subject: hsm: encapsulate devPath in appropriateDevice
......................................................................
hsm: encapsulate devPath in appropriateDevice
As a continuation of Ie0d4d805ca333990ea1f612eb03a87f4a505f4a8,
appropriateDevice method now returns devPath as well.
Change-Id: Iaf8f53999bde70eb4b2b1b0a927c9412d4597134
Signed-off-by: Daniel Erez <derez(a)redhat.com>
---
M vdsm/clientIF.py
M vdsm/storage/hsm.py
2 files changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/06/24406/1
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index 464d6e1..fe339bb 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -271,7 +271,7 @@
drive["truesize"] = res['truesize']
drive["apparentsize"] = res['apparentsize']
- volPath = os.path.join("/dev/mapper", drive["GUID"])
+ volPath = res['devPath']
# UUID drive format
elif "UUID" in drive:
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 9420931..18e6555 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -3112,7 +3112,7 @@
# that use it to overcome xmlrpc integer size limitation issues.
size = str(multipath.getDeviceSize(devicemapper.getDmId(guid)))
- return dict(truesize=size, apparentsize=size)
+ return dict(truesize=size, apparentsize=size, devPath=devPath)
@public
def inappropriateDevices(self, thiefId):
--
To view, visit http://gerrit.ovirt.org/24406
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaf8f53999bde70eb4b2b1b0a927c9412d4597134
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Daniel Erez <derez(a)redhat.com>
10 years, 4 months
Change in vdsm[master]: [WIP]vdsm: add support for TPM device passthrough
by mpoledni@redhat.com
Martin Polednik has uploaded a new change for review.
Change subject: [WIP]vdsm: add support for TPM device passthrough
......................................................................
[WIP]vdsm: add support for TPM device passthrough
This patch adds basic support for TPM (to be expanded)
passthrough, which allows VM to be given access directly
to host's TPM module.
Currently missing: reporting host's tpm status (nonexistant /
passed to VM / available)
Engine constraints: vm with assigned TPM cannot be allowed to
migrate, host cannot pass single TPM to multiple VMs using
passthrough protocol (currently only supported protocol
http://wiki.qemu.org/Features/TPM)
Change-Id: I53a77a0977d367d1066e85590dd35b18bb5fa32a
Signed-off-by: Martin Polednik <mpoledni(a)redhat.com>
---
M tests/vmTests.py
M vdsm/vm.py
M vdsm_api/vdsmapi-schema.json
3 files changed, 90 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/49/20649/1
diff --git a/tests/vmTests.py b/tests/vmTests.py
index 1f69f0a..b879e5f 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -114,6 +114,20 @@
smartcard = vm.SmartCardDevice(self.conf, self.log, **dev)
self.assertXML(smartcard.getXML(), smartcardXML)
+ def testTpmXML(self):
+ tpmXML = """
+ <tpm model="tpm-tis">
+ <backend type="passthrough">
+ <device path="/dev/tpm0"/>
+ </backend>
+ </tpm>
+ """
+ dev = {'device': 'tpm',
+ 'specParams': {'type': 'passthrough',
+ 'path': '/dev/tpm0', 'model': 'tpm-tis'}}
+ tpm = vm.TpmDevice(self.conf, self.log, **dev)
+ self.assertXML(tpm.getXML(), tpmXML)
+
def testFeaturesXML(self):
featuresXML = """
<features>
diff --git a/vdsm/vm.py b/vdsm/vm.py
index 0c12334..d73e83e 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -1673,6 +1673,26 @@
return card
+class TpmDevice(VmDevice):
+ def getXML(self):
+ """
+ Add tpm section to domain xml
+
+ <tpm model='tpm-tis'>
+ <backend type='passthrough'>
+ <device path='/dev/tpm0'>
+ </backend>
+ </tpm>
+ """
+ tpm = self.createXmlElem(self.device, None)
+ tpm.setAttrs(**{'model': self.specParams['model']})
+ backend = tpm.appendChildWithArgs('backend',
+ type=self.specParams['type'])
+ backend.appendChildWithArgs('device',
+ path=self.specParams['path'])
+ return tpm
+
+
class RedirDevice(VmDevice):
def getXML(self):
"""
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index 73889d1..1be8e9d 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -1832,7 +1832,7 @@
##
{'enum': 'VmDeviceType',
'data': ['disk', 'interface', 'video', 'sound', 'controller', 'balloon',
- 'channel', 'console', 'smartcard']}
+ 'channel', 'console', 'tpm', 'smartcard']}
##
# @VmDiskDeviceType:
@@ -2590,6 +2590,61 @@
'address': 'VmDeviceAddress', 'alias': 'str', 'deviceId': 'UUID'}}
##
+# @VmTpmDeviceType:
+#
+# An enumeration of VM tpm device types.
+#
+# @passthrough: use hosts TPM
+#
+# Since: 4.10.3
+##
+{'enum': 'VmTpmDeviceType', 'data': ['passthrough']}
+
+##
+# @VmTpmDeviceModel:
+#
+# An enumeration of VM tpm device modes.
+#
+# @tpm-tis: TODO
+#
+# Since: 4.10.3
+##
+{'enum': 'VmTpmDeviceModel', 'data': ['tpm-tis']}
+
+##
+# @VmTpmDeviceSpecParams:
+#
+# Additional VM tpm device parameters.
+#
+# @type: #optional Protocol used by tpmdevice (defaults to @passthrough)
+#
+# @model: #optional Model of TPM device (defaults to @tpm-tis)
+#
+# @path: #optional Path to hosts device TPM (defaults to /dev/tpm0)
+#
+# Since: 4.10.3
+##
+{'type': 'VmTpmDeviceSpecParams',
+ 'data': {'*model': 'VmTpmDeviceModel',
+ '*path': 'str',
+ '*type': 'VmTpmDeviceType'}}
+
+##
+# @VmTpmDevice:
+#
+# Properties of a VM tpm device.
+#
+# @deviceType: The device type (always @tpm)
+#
+# @specParams: #optional Additional device parameters
+#
+# Since: 4.10.3
+##
+{'type': 'VmTpmDevice',
+ 'data': {'deviceType': 'VmDeviceType',
+ '*specParams': 'VmTpmDeviceSpecParams'}}
+
+##
# @VmSmartcardDeviceProtocol:
#
# An enumeration of VM smartcard device protocols.
--
To view, visit http://gerrit.ovirt.org/20649
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I53a77a0977d367d1066e85590dd35b18bb5fa32a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpoledni(a)redhat.com>
10 years, 4 months
Change in vdsm[master]: tests: validate cdrom path sent to/received from vdsm
by mpoledni@redhat.com
Martin Polednik has uploaded a new change for review.
Change subject: tests: validate cdrom path sent to/received from vdsm
......................................................................
tests: validate cdrom path sent to/received from vdsm
related to http://gerrit.ovirt.org/#/c/20074/
Tests prepareVolumePath for cdrom by verifying that path and
specParams['path'] remains unchanged during creation of VM
Change-Id: I620c481056f7ee3b4d3270ba1f4bc45cbb132ebb
Signed-off-by: Martin Polednik <mpoledni(a)redhat.com>
---
M tests/functional/utils.py
M tests/functional/virtTests.py
2 files changed, 41 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/94/22194/1
diff --git a/tests/functional/utils.py b/tests/functional/utils.py
index 5713db3..8bdd978 100644
--- a/tests/functional/utils.py
+++ b/tests/functional/utils.py
@@ -210,6 +210,11 @@
else:
return result['status']['code'], result['status']['message']
+ def getVmList(self, vmId):
+ result = self.vdscli.list('true', [vmId])
+ return result['status']['code'], result['status']['message'],\
+ result['vmList'][0]
+
def getVdsCapabilities(self):
result = self.vdscli.getVdsCapabilities()
return result['status']['code'], result['status']['message'],\
diff --git a/tests/functional/virtTests.py b/tests/functional/virtTests.py
index bd54621..e799eb1 100644
--- a/tests/functional/virtTests.py
+++ b/tests/functional/virtTests.py
@@ -271,3 +271,39 @@
deviceDef['hotplugDisk']), timeout=10)
self.retryAssert(partial(self.vdsm.hotunplugDisk,
deviceDef['hotplugDisk']), timeout=10)
+
+ @permutations([['self'], ['specParams'], ['both']])
+ def testVmWithCdrom(self, pathLocation):
+ fd, path = tempfile.mkstemp()
+ os.chmod(path, 0o644)
+
+ cdrom = {'index': '2', 'iface': 'ide', 'specParams':
+ {'path': ''}, 'readonly': 'true', 'path':
+ '', 'device': 'cdrom', 'shared':
+ 'false', 'type': 'disk'}
+
+ if pathLocation == 'self':
+ cdrom['path'] = path
+ elif pathLocation == 'specParams':
+ cdrom['specParams']['path'] = path
+ else:
+ # we can use the same path to avoid having to generate another
+ # tmpfile
+ cdrom['path'] = path
+ cdrom['specParams']['path'] = path
+
+ customization = {'vmId': '77777777-ffff-3333-bbbb-222222222222',
+ 'vmName': 'testVm', 'devices': [cdrom]}
+
+ with RunningVm(self.vdsm, customization) as vm:
+ self._waitForStartup(vm, 10)
+
+ status, msg, stats = self.vdsm.getVmList(vm)
+ self.assertEqual(status, SUCCESS, msg)
+ for device in stats['devices']:
+ if device['device'] == 'cdrom':
+ self.assertEqual(device['path'], cdrom['path'])
+ self.assertEqual(device['specParams']['path'],
+ cdrom['specParams']['path'])
+
+ os.unlink(path)
--
To view, visit http://gerrit.ovirt.org/22194
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I620c481056f7ee3b4d3270ba1f4bc45cbb132ebb
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpoledni(a)redhat.com>
10 years, 4 months
Change in vdsm[master]: tests: add missing attribute
by fromani@redhat.com
Francesco Romani has uploaded a new change for review.
Change subject: tests: add missing attribute
......................................................................
tests: add missing attribute
when running volTests, the following AttributeError
pops out:
Exception AttributeError: "FileDomainMockObject instance has no
attribute 'stat'" in <bound method FileDomainMockObject.__del__ of
<volumeTests.FileDomainMockObject instance at 0x1f0eef0>> ignored
This is caused by the __del__ method of the StorageDomain class,
which does cleanup depending on the value of the `stat` attribute.
This patch adds the missing attribute.
Change-Id: I874bed6aff0b3dc4199a5870a293cf05e57986c9
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M tests/volumeTests.py
1 file changed, 1 insertion(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/90/23790/1
diff --git a/tests/volumeTests.py b/tests/volumeTests.py
index 0ec05e5..6e4a3b2 100644
--- a/tests/volumeTests.py
+++ b/tests/volumeTests.py
@@ -31,6 +31,7 @@
def __init__(self, mountpoint, sdUUID):
self.mountpoint = mountpoint
self.sdUUID = sdUUID
+ self.stat = None
@property
def oop(self):
--
To view, visit http://gerrit.ovirt.org/23790
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I874bed6aff0b3dc4199a5870a293cf05e57986c9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>
10 years, 4 months
Change in vdsm[master]: typo in guest agent channel timeout handling
by michal.skrivanek@redhat.com
Michal Skrivanek has uploaded a new change for review.
Change subject: typo in guest agent channel timeout handling
......................................................................
typo in guest agent channel timeout handling
Change-Id: I63a8a5aa098101ebb3e3c4de2b2dddae4c158490
Signed-off-by: Michal Skrivanek <michal.skrivanek(a)redhat.com>
---
M vdsm/guestIF.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/56/17456/1
diff --git a/vdsm/guestIF.py b/vdsm/guestIF.py
index 0f831da..0132692 100644
--- a/vdsm/guestIF.py
+++ b/vdsm/guestIF.py
@@ -316,7 +316,7 @@
@staticmethod
def _onChannelTimeout(self):
self.guestInfo['memUsage'] = 0
- if self.guestStatus not in ("Powered down", "RebootInProgress"):
+ if self.guestStatus not in ("Powering down", "RebootInProgress"):
self.log.log(logging.TRACE, "Guest connection timed out")
self.guestStatus = None
--
To view, visit http://gerrit.ovirt.org/17456
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I63a8a5aa098101ebb3e3c4de2b2dddae4c158490
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Michal Skrivanek <michal.skrivanek(a)redhat.com>
10 years, 4 months
Change in vdsm[master]: Validate conf in configure only if not forcing overriding
by ybronhei@redhat.com
Yaniv Bronhaim has uploaded a new change for review.
Change subject: Validate conf in configure only if not forcing overriding
......................................................................
Validate conf in configure only if not forcing overriding
When --force flag is sent to configure the conf might be overrided.
Therefore, checking validate conf before overriding can lead to a fail
while the current configuration is not relevant.
Change-Id: Ibd9e95c06b1437074f37248e77bb086a3c3bad63
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
---
M lib/vdsm/tool/configurator.py
1 file changed, 3 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/32/24132/1
diff --git a/lib/vdsm/tool/configurator.py b/lib/vdsm/tool/configurator.py
index dfc4115..26eb627 100644
--- a/lib/vdsm/tool/configurator.py
+++ b/lib/vdsm/tool/configurator.py
@@ -195,11 +195,12 @@
sys.stdout.write("\nChecking configuration status...\n\n")
for c in __configurers:
if c.getName() in args.modules:
- if not c.validate():
+ override = args.force and c.reconfigureOnForce()
+ if not override and not c.validate():
raise RuntimeError(
"Configuration of %s is invalid" % c.getName()
)
- if (args.force and c.reconfigureOnForce()) or not c.isconfigured():
+ if override or not c.isconfigured():
configurer_to_trigger.append(c)
services = []
--
To view, visit http://gerrit.ovirt.org/24132
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibd9e95c06b1437074f37248e77bb086a3c3bad63
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
10 years, 4 months
Change in vdsm[master]: Fixing ssl config validation
by ybronhei@redhat.com
Yaniv Bronhaim has uploaded a new change for review.
Change subject: Fixing ssl config validation
......................................................................
Fixing ssl config validation
Currently we verify only the config of livbirtd.conf and qemu.conf
when ssl=False in vdsm.conf. If ssl=True we assumed the validation
passes. This patch add a check also to ssl=True.
Except that, the validation function is not general and checks only ssl
configuration. This patch splits to specific test_conflict functions and
allow adding more test_conflict functions in the future.
Change-Id: I3d9ada1b81d275b8cac9391c15ab903ec9552184
Signed-off-by: Yaniv Bronhaim <ybronhei(a)redhat.com>
---
M lib/vdsm/tool/libvirt_configure.sh.in
1 file changed, 31 insertions(+), 14 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/25/24425/1
diff --git a/lib/vdsm/tool/libvirt_configure.sh.in b/lib/vdsm/tool/libvirt_configure.sh.in
index 8a70be5..e2256a3 100755
--- a/lib/vdsm/tool/libvirt_configure.sh.in
+++ b/lib/vdsm/tool/libvirt_configure.sh.in
@@ -52,6 +52,11 @@
}
test_conflicting_conf() {
+ test_ssl_conflict_conf
+ # add here additional conf checks
+}
+
+test_ssl_conflict_conf() {
local lconf="$1"
local qconf="$2"
@@ -61,26 +66,38 @@
return 3
fi
- if [ "${ssl}" = "true" ]; then
- echo "SUCCESS: ssl configured to true. No conflicts"
- return 0
- fi
-
local listen_tcp="$(get_libvirt_conf_item "${lconf}" listen_tcp)"
local auth_tcp="$(get_libvirt_conf_item "${lconf}" auth_tcp)"
local spice_tls="$(get_libvirt_conf_item "${qconf}" spice_tls)"
- if [ "${listen_tcp}" = "1" -a \
- "${auth_tcp}" = '"none"' -a \
- "${spice_tls}" = "0" ]; then
- echo "SUCCESS: No conflicts between configuration files"
+ if [ "${ssl}" = "true" ]; then
+ if [ "${listen_tcp}" != "1" -a \
+ "${auth_tcp}" != '"none"' -a \
+ "${spice_tls}" = "1" ]; then
+ echo "SUCCESS: ssl configured to true. No conflicts"
+ return 0
+ else
+ echo "FAILED: conflicting vdsm and libvirt-qemu tls configuration."
+ echo "vdsm.conf with ssl=True requires the following changed: "
+ echo "libvirtd.conf: listen_tcp=0, auth_tcp=\"sasl\", "
+ echo "qemu.conf: spice_tls=1."
+ return 1
+ fi
+
return 0
else
- echo "FAILED: conflicting vdsm and libvirt-qemu tls configuration."
- echo "vdsm.conf with ssl=False requires the following changed: "
- echo "libvirtd.conf: listen_tcp=1, auth_tcp=\"none\", "
- echo "qemu.conf: spice_tls=0."
- return 1
+ if [ "${listen_tcp}" = "1" -a \
+ "${auth_tcp}" = '"none"' -a \
+ "${spice_tls}" = "0" ]; then
+ echo "SUCCESS: ssl configured to false. No conflicts."
+ return 0
+ else
+ echo "FAILED: conflicting vdsm and libvirt-qemu tls configuration."
+ echo "vdsm.conf with ssl=False requires the following changed: "
+ echo "libvirtd.conf: listen_tcp=1, auth_tcp=\"none\", "
+ echo "qemu.conf: spice_tls=0."
+ return 1
+ fi
fi
}
--
To view, visit http://gerrit.ovirt.org/24425
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3d9ada1b81d275b8cac9391c15ab903ec9552184
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei(a)redhat.com>
10 years, 4 months
Change in vdsm[master]: pylint: fix format string
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: pylint: fix format string
......................................................................
pylint: fix format string
Change-Id: I36ce9cdb63c49c0058af1f357badd13b1ae6be2b
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm/clientIF.py
1 file changed, 3 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/12/24412/1
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index 464d6e1..33098cf 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -301,8 +301,9 @@
mkFsFunction = getattr(supervdsm.getProxy(),
mkFsNames[drive['device']])
except AttributeError:
- raise vm.VolumeError("Unsupported 'device': %s in "
- "drive: %" % (drive['device'], drive))
+ raise vm.VolumeError(
+ "Unsupported 'device': %s in drive: %s" %
+ (drive['device'], drive))
else:
files = drive['specParams']['vmPayload']['file']
volId = drive['specParams']['vmPayload'].get('volId')
--
To view, visit http://gerrit.ovirt.org/24412
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I36ce9cdb63c49c0058af1f357badd13b1ae6be2b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
10 years, 4 months
Change in vdsm[master]: api: domainDict is optional in connectStoragePool
by Federico Simoncelli
Federico Simoncelli has uploaded a new change for review.
Change subject: api: domainDict is optional in connectStoragePool
......................................................................
api: domainDict is optional in connectStoragePool
This patch fixes a mismatch between the schema and the actual
connectStoragePool implementation.
Change-Id: I05b4f5073a33b2479404298ddafd4802e949e8f4
Signed-off-by: Federico Simoncelli <fsimonce(a)redhat.com>
---
M vdsm_api/vdsmapi-schema.json
1 file changed, 4 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/89/24089/1
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index 6d8c333..71ee38f 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -4250,7 +4250,9 @@
#
# @masterVersion: The Storage Domain version of the master domain
#
-# @domainDict: The Storage Domain statuses (added in cluster level 3.4)
+# @domainDict: #optional The Storage Domain statuses (added in cluster
+# level 3.4). If this argument is present the Storage Pool
+# will use the memory backend (no metadata).
#
# Since: 4.10.0
#
@@ -4259,7 +4261,7 @@
{'command': {'class': 'StoragePool', 'name': 'connect'},
'data': {'storagepoolID': 'UUID', 'hostID': 'int', 'scsiKey': 'str',
'masterSdUUID': 'UUID', 'masterVersion': 'int',
- 'domainDict': 'StorageDomainStatusMap'}}
+ '*domainDict': 'StorageDomainStatusMap'}}
##
# @ConnectStorageServerStatus:
--
To view, visit http://gerrit.ovirt.org/24089
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I05b4f5073a33b2479404298ddafd4802e949e8f4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce(a)redhat.com>
10 years, 4 months
Change in vdsm[ovirt-3.4]: API: return additional Hosted Engine information from vdsStats
by gpadgett@redhat.com
Greg Padgett has uploaded a new change for review.
Change subject: API: return additional Hosted Engine information from vdsStats
......................................................................
API: return additional Hosted Engine information from vdsStats
Return additional hosted engine runtime information with vds statistics
which allows for better interoperability between the engine and hosted
engine agent.
Change-Id: Iaee2756d0652dc56439b8004e9260fcea927b708
Bug-Url: https://bugzilla.redhat.com/1053040
Signed-off-by: Greg Padgett <gpadgett(a)redhat.com>
---
M vdsm/API.py
M vdsm_api/vdsmapi-schema.json
2 files changed, 57 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/90/24090/1
diff --git a/vdsm/API.py b/vdsm/API.py
index bb76f20..ae1ec79 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -1235,12 +1235,10 @@
stats['netConfigDirty'] = str(self._cif._netConfigDirty)
stats['generationID'] = self._cif._generationID
-
- if haClient:
- try:
- stats['haScore'] = haClient.HAClient().get_local_host_score()
- except Exception:
- self.log.exception("failed to retrieve Hosted Engine HA score")
+ stats['haStats'] = self._getHaInfo()
+ if stats['haStats']['configured']:
+ # For backwards compatibility, will be removed in the future
+ stats['haScore'] = stats['haStats']['score']
return {'status': doneCode, 'info': stats}
@@ -1554,6 +1552,36 @@
self.log.error(vmId + ': Lost connection to VM')
return count, active, migrating
+ def _getHaInfo(self):
+ """
+ Return Hosted Engine HA information for this host.
+ """
+ i = {
+ 'configured': False,
+ 'active': False,
+ 'score': 0,
+ 'globalMaintenance': False,
+ 'localMaintenance': False,
+ }
+ if haClient:
+ try:
+ instance = haClient.HAClient()
+ host_id = instance.get_local_host_id()
+ # If a host id is available, consider HA configured
+ i['configured'] = True
+
+ stats = instance.get_all_stats()
+ if 0 in stats:
+ i['globalMaintenance'] = stats[0].get(
+ haClient.HAClient.GlobalMdFlags.MAINTENANCE, False)
+ if host_id in stats:
+ i['active'] = stats[host_id]['live-data']
+ i['score'] = stats[host_id]['score']
+ i['localMaintenance'] = stats[host_id]['maintenance']
+ except Exception:
+ self.log.exception("failed to retrieve Hosted Engine HA info")
+ return i
+
@staticmethod
def translateNetOptionsToNew(options):
_translationMap = {
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index 564180a..12f0c98 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -1540,6 +1540,24 @@
##
{'enum': 'MOMStatus', 'data': ['disabled', 'active', 'inactive']}
+##
+# @HostedEngineStatus:
+#
+# Hosted Engine subsystem status, according to each host.
+#
+# @active: Indicates if the HA agent is alive and updating data
+#
+# @localMaintenance: Indicates if host is in local HA maintenance mode
+#
+# @globalMaintenance: Indicates if cluster is in global maintenance mode
+#
+# @score: Numeric host score
+#
+# Since: 4.14.0
+##
+{'type': 'HostedEngineStatus',
+ 'data': {'active': 'bool', 'globalMaintenance': 'bool',
+ 'localMaintenance': 'bool', 'score': 'uint'}}
##
# @HostStats:
@@ -1619,6 +1637,9 @@
# @haScore: #optional The host score according to the HA agent,
# if installed (new in version 4.13.0)
#
+# @haStatus: The current status of the Hosted Engine HA system
+# (new in version 4.14.0)
+#
# Since: 4.10.0
##
{'type': 'HostStats',
@@ -1636,7 +1657,8 @@
'vmCount': 'int', 'vmActive': 'int', 'vmMigrating': 'int',
'dateTime': 'str', 'ksmState': 'bool', 'ksmPages': 'int',
'ksmCpu': 'float', 'netConfigDirty': 'bool', 'generationID': 'UUID',
- 'momStatus': 'MOMStatus', '*haScore': 'uint'}}
+ 'momStatus': 'MOMStatus', '*haScore': 'int',
+ 'haStatus': 'HostedEngineStatus'}}
##
# @Host.getStats:
--
To view, visit http://gerrit.ovirt.org/24090
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaee2756d0652dc56439b8004e9260fcea927b708
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.4
Gerrit-Owner: Greg Padgett <gpadgett(a)redhat.com>
10 years, 4 months