Edward Haas has uploaded a new change for review.

Change subject: virt net: Change graphics type from network to address
......................................................................

virt net: Change graphics type from network to address

This patch changes the graphics listen type of VM/s from a libvirt
network name to an address.

This is part of an effor to decouple VDSM networking from libvirt
network entities.

Change-Id: I0724627bd6c37ce11f943c8818fcd5b559fdf070
Signed-off-by: Edward Haas <[email protected]>
---
M tests/deviceTests.py
M vdsm/virt/vmdevices/graphics.py
2 files changed, 8 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/36/59336/1

diff --git a/tests/deviceTests.py b/tests/deviceTests.py
index 67f9c9e..3224757 100644
--- a/tests/deviceTests.py
+++ b/tests/deviceTests.py
@@ -27,7 +27,7 @@
 from virt.vmdevices import graphics
 from virt.domain_descriptor import DomainDescriptor
 
-from monkeypatch import MonkeyPatchScope
+from monkeypatch import MonkeyPatchScope, MonkeyPatch
 from testlib import permutations, expandPermutations
 from testlib import VdsmTestCase as TestCaseBase
 from testlib import XMLTestCase
@@ -47,7 +47,7 @@
         <graphics autoport="yes" defaultMode="secure"
                   keymap="en-us" passwd="*****"
                   passwdValidTo="1970-01-01T00:00:01" port="-1" type="vnc">
-            <listen network="vdsm-vmDisplay" type="network"/>
+            <listen address="10.10.10.10" type="address"/>
         </graphics>""",
 
         """
@@ -509,6 +509,8 @@
             self.assertEqual(graphDev.port, graphConf['port'])
             self.assertEqual(graphDev.tlsPort, graphConf['tlsPort'])
 
+    @MonkeyPatch(graphics, '_getNetworkIp',
+                 lambda net: '10.10.10.10' if net else '0')
     def testLegacyGraphicsXML(self):
         vmConfs = [
             {'display': 'vnc', 'displayPort': '-1', 'displayNetwork':
@@ -530,6 +532,8 @@
         for vmConf, xml in zip(vmConfs, self.GRAPHICS_XMLS):
             self._verifyGraphicsXML(vmConf, xml, isLegacy=True)
 
+    @MonkeyPatch(graphics, '_getNetworkIp',
+                 lambda net: '10.10.10.10' if net else '0')
     def testGraphicsDeviceXML(self):
         vmConfs = [
             {'devices': [{
diff --git a/vdsm/virt/vmdevices/graphics.py b/vdsm/virt/vmdevices/graphics.py
index 0bfa186..1e16650 100644
--- a/vdsm/virt/vmdevices/graphics.py
+++ b/vdsm/virt/vmdevices/graphics.py
@@ -141,11 +141,9 @@
                 graphics.appendChildWithArgs('channel', name=chan,
                                              mode='secure')
 
-        if self.specParams.get('displayNetwork'):
+        if self.specParams.get('displayIp', '0') != '0':
             graphics.appendChildWithArgs(
-                'listen', type='network',
-                network=net_api.netname_o2l(
-                    self.specParams.get('displayNetwork')))
+                'listen', type='address', address=self.specParams['displayIp'])
         else:
             graphics.setAttrs(listen='0')
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0724627bd6c37ce11f943c8818fcd5b559fdf070
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Edward Haas <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/admin/lists/[email protected]

Reply via email to