Change in vdsm[master]: vm: graphics: fill legacy display parameters

fromani at redhat.com fromani at redhat.com
Fri Apr 8 15:27:55 UTC 2016


Francesco Romani has uploaded a new change for review.

Change subject: vm: graphics: fill legacy display parameters
......................................................................

vm: graphics: fill legacy display parameters

To preserve backward compatibility with Engine 3.5,
Vdsm must fill back the lefacy display configuration parameters
(displayIp, displayPort...) from the graphics device configuration.

To do so, Vdsm must mutate the original Vm.conf, not a copy,
otherwise the updates will be lost.

Change-Id: Ib876eb12e6bba970caa63aee50c9ec5532b2aef7
Bug-Url: https://bugzilla.redhat.com/1325361
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M tests/deviceTests.py
M vdsm/virt/vmdevices/graphics.py
2 files changed, 31 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/79/55879/1

diff --git a/tests/deviceTests.py b/tests/deviceTests.py
index 16d374d..0d61332 100644
--- a/tests/deviceTests.py
+++ b/tests/deviceTests.py
@@ -24,6 +24,7 @@
 
 from virt import vmdevices
 from virt.vmdevices import hwclass
+from virt.vmdevices import graphics
 from virt.domain_descriptor import DomainDescriptor
 
 from monkeypatch import MonkeyPatchScope
@@ -86,7 +87,8 @@
             'vmName': 'testVm',
             'vmId': '9ffe28b6-6134-4b1e-8804-1185f49c436f',
             'smp': '8', 'maxVCpus': '160',
-            'memSize': '1024', 'memGuaranteedSize': '512'}
+            'memSize': '1024', 'memGuaranteedSize': '512',
+        }
 
         self.confDisplayVnc = (
             {'display': 'vnc', 'displayNetwork': 'vmDisplay'},
@@ -139,6 +141,33 @@
             devs = testvm._devSpecMapFromConf()
             self.assertFalse(devs['graphics'])
 
+    def testGraphicDeviceUpdateConfig(self):
+        params = {
+            'displayIp': '0',
+            'displayPort': u'6101',
+            'displaySecurePort': u'6102',
+        }
+        with fake.VM(self.conf,
+                     self.confDeviceGraphicsVnc[0]
+        ) as testvm:
+            devs = testvm._devSpecMapFromConf()
+            testvm._updateDevices(devs)
+            testvm._devices = testvm._devMapFromDevSpecMap(devs)
+       
+            domainXML = """<domain>
+            <devices>
+            <graphics autoport="yes" listen="0" passwd="*****"
+                      passwdValidTo="1970-01-01T00:00:01" port="6101"
+                      tlsPort="6102" type="vnc" />
+            </devices>
+            </domain>"""
+            testvm._domain = DomainDescriptor(domainXML)
+            graphics.Graphics.update_device_info(
+                testvm, testvm._devices[hwclass.GRAPHICS])
+
+            for param, value in params.items():
+                self.assertEquals(testvm.conf[param], value)
+
     def testGraphicsDeviceMixed(self):
         """
         if proper Graphics Devices are supplied, display* params must be
diff --git a/vdsm/virt/vmdevices/graphics.py b/vdsm/virt/vmdevices/graphics.py
index 7bd4e92..935ceca 100644
--- a/vdsm/virt/vmdevices/graphics.py
+++ b/vdsm/virt/vmdevices/graphics.py
@@ -178,7 +178,7 @@
         # the first graphic device is duplicated in the legacy conf
         # TODO: Remove this code once we stop maintaining compatibility with
         # Engines older than 3.6.
-        updateLegacyConf({'devices': vm.conf['devices']})
+        updateLegacyConf(vm.conf)
 
 
 def isSupportedDisplayType(vmParams):


-- 
To view, visit https://gerrit.ovirt.org/55879
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib876eb12e6bba970caa63aee50c9ec5532b2aef7
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>


More information about the vdsm-patches mailing list