Hello Vinzenz Feenstra, Dan Kenigsberg,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/30254
to review the following change.
Change subject: vm: hyperv: initial windows hyperv support
......................................................................
vm: hyperv: initial windows hyperv support
This patch adds explicit support for hyperv optimizations.
The optimizations are both for stability and for performance.
Engine, or any other client, can enable them by supplying a new
optional parameter 'hyperVenable' in the Vm parameters at
creation time.
As default, the new settings are disabled for backward compatibility.
The parameters are hardcoded and not externally configurable
because they are not supposed to be changed very often, if
changed at all; moreover, we implement the optimal recommended
settings.
Change-Id: I28ea1d5adeda07798255484209e1a1d92c2c2bc5
Bug-Url: https://bugzilla.redhat.com/1110305
Signed-off-by: Francesco Romani <[email protected]>
Reviewed-on: http://gerrit.ovirt.org/27619
Reviewed-by: Vinzenz Feenstra <[email protected]>
Reviewed-by: Dan Kenigsberg <[email protected]>
---
M tests/vmTests.py
M vdsm/rpc/vdsmapi-schema.json
M vdsm/virt/vm.py
3 files changed, 46 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/54/30254/1
diff --git a/tests/vmTests.py b/tests/vmTests.py
index 2762e51..f435ada 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -321,6 +321,21 @@
domxml.appendFeatures()
self.assertXML(domxml.dom, featuresXML, 'features')
+ def testFeaturesHyperVXML(self):
+ featuresXML = """
+ <features>
+ <acpi/>
+ <hyperv>
+ <relaxed state="on"/>
+ </hyperv>
+ </features>"""
+ conf = {'hypervEnable': 'true'}
+ conf.update(self.conf)
+ domxml = vm._DomXML(conf, self.log,
+ caps.Architecture.X86_64)
+ domxml.appendFeatures()
+ self.assertXML(domxml.dom, featuresXML, 'features')
+
def testSysinfoXML(self):
sysinfoXML = """
<sysinfo type="smbios">
diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index 75281fa..c301912 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -3229,6 +3229,9 @@
#
# @emulatedMachine: #optional The machine specification being emulated
#
+# @hypervEnable: #optional Enables hyperv specific optimizations for
the
+# Guest OS (new in version 4.16.0)
+#
# @keyboardLayout: #optional The keyboard layout string (eg. 'en-us')
#
# @kvmEnable: Indicates if KVM hardware acceleration is enabled
@@ -3281,8 +3284,9 @@
'*cpuShares': 'str', '*cpuType': 'str', '*custom': 'StringMap',
'*devices': ['VmDevice'], 'display': 'VmDisplayType', 'displayIp':
'str',
'displayPort': 'int', 'displaySecurePort': 'int',
- '*emulatedMachine': 'str', '*keyboardLayout': 'str',
- 'kvmEnable': 'bool', '*maxVCpus': 'uint', 'memSize': 'uint',
+ '*emulatedMachine': 'str', '*hypervEnable': 'bool',
+ '*keyboardLayout': 'str', 'kvmEnable': 'bool',
+ '*maxVCpus': 'uint', 'memSize': 'uint',
'memGuaranteedSize': 'uint', 'nicModel': 'str', 'nice': 'int',
'*pauseCode': 'str', 'pid': 'uint', 'smp': 'uint',
'*smpCoresPerSocket': 'uint',
'*smpThreadsPerCore': 'uint', 'status': 'VmStatus',
@@ -3309,6 +3313,9 @@
# @devices: #optional An array of VM devices requested
#
# @display: The type of display
+#
+# @hypervEnable: #optional Enables hyperv specific optimizations for
the
+# Guest OS. (new in version 4.16.0)
#
# @kvmEnable: Indicates if KVM hardware acceleration is enabled
#
@@ -3344,7 +3351,8 @@
{'type': 'VmParameters',
'data': {'acpiEnable': 'bool', '*bootMenuEnable': 'bool',
'*cpuShares': 'str', '*custom': 'StringMap', '*devices':
['VmDevice'],
- 'display': 'VmDisplayType', 'kvmEnable': 'bool', 'memSize': 'uint',
+ 'display': 'VmDisplayType', '*hypervEnable': 'bool',
+ 'kvmEnable': 'bool', 'memSize': 'uint',
'nice': 'int', 'smp': 'uint', '*smpCoresPerSocket': 'uint',
'*smpThreadsPerCore': 'uint', 'timeOffset': 'uint',
'transparentHugePages': 'bool', 'vmId': 'UUID', 'vmName': 'str',
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index d44ae8b..42f63f5 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -833,12 +833,31 @@
<features>
<acpi/>
<features/>
+
+ for hyperv:
+ <features>
+ <acpi/>
+ <hyperv>
+ <relaxed state='on'/>
+ </hyperv>
+ <features/>
"""
- if utils.tobool(self.conf.get('acpiEnable', 'true')):
+ if (utils.tobool(self.conf.get('acpiEnable', 'true')) or
+ utils.tobool(self.conf.get('hypervEnable', 'false'))):
features = self.dom.appendChildWithArgs('features')
+
+ if utils.tobool(self.conf.get('acpiEnable', 'true')):
features.appendChildWithArgs('acpi')
+ if utils.tobool(self.conf.get('hypervEnable', 'false')):
+ hyperv = XMLElement('hyperv')
+ features.appendChild(hyperv)
+
+ hyperv.appendChildWithArgs('relaxed', state='on')
+ # turns off an internal Windows watchdog, and by doing so avoids
+ # some high load BSODs.
+
def appendCpu(self):
"""
Add guest CPU definition.
--
To view, visit http://gerrit.ovirt.org/30254
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I28ea1d5adeda07798255484209e1a1d92c2c2bc5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Francesco Romani <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Vinzenz Feenstra <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches