Hello Petr Horáček, Francesco Romani,
I'd like you to do a code review. Please visit
https://gerrit.ovirt.org/61262
to review the following change.
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 for OVS based display networks.
OVS integration has avoided the use of libvirt network entities, for
simplicitly and as part of a general effort to eliminate VDSM networking
libvirt dependency.
With this patch, a VM graphics may be assign to an OVS based host network.
NOTE: This patch must be merged with the libvirt hook patch.
(id: Ie7d32f9605f9ca99d1e070621)
This reverts commit 9e3ff6d62bd42fadffff387e69c1a6bdab153cd3.
Change-Id: Id809e90f2340caffaf30a5749dd75ec39516c96c
Bug-Url: https://bugzilla.redhat.com/1195208
Signed-off-by: Edward Haas <[email protected]>
Reviewed-on: https://gerrit.ovirt.org/59336
Reviewed-by: Petr Horáček <[email protected]>
Continuous-Integration: Jenkins CI
Reviewed-by: Francesco Romani <[email protected]>
Tested-by: Petr Horáček <[email protected]>
Reviewed-on: https://gerrit.ovirt.org/61120
---
M vdsm/virt/vmdevices/graphics.py
1 file changed, 19 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/62/61262/1
diff --git a/vdsm/virt/vmdevices/graphics.py b/vdsm/virt/vmdevices/graphics.py
index 0bfa186..8066325 100644
--- a/vdsm/virt/vmdevices/graphics.py
+++ b/vdsm/virt/vmdevices/graphics.py
@@ -18,10 +18,9 @@
# Refer to the README and COPYING files for full details of the license
#
-import logging
-
import libvirt
+from vdsm import supervdsm
from vdsm.network import api as net_api
from vdsm import utils
from vdsm.config import config
@@ -141,7 +140,17 @@
graphics.appendChildWithArgs('channel', name=chan,
mode='secure')
- if self.specParams.get('displayNetwork'):
+ # For the listen type IP to be used, the display network must be OVS.
+ # We assume that the cluster in which the host operates is OVS enabled
+ # and all other hosts in the cluster have the migration hook installed.
+ # The migration hook is responsible to convert ip to net and vice versa
+ display_network = self.specParams.get('displayNetwork')
+ display_ip = self.specParams.get('displayIp', '0')
+ if (display_network and display_ip != '0' and
+ supervdsm.getProxy().ovs_bridge(display_network)):
+ graphics.appendChildWithArgs(
+ 'listen', type='address', address=display_ip)
+ elif display_network:
graphics.appendChildWithArgs(
'listen', type='network',
network=net_api.netname_o2l(
@@ -243,11 +252,16 @@
def _getNetworkIp(network):
try:
nets = net_api.libvirt_networks()
- device = nets[network].get('iface', network)
+ # On a legacy based network, the device is the iface specified in the
+ # network report (supporting real bridgeless networks).
+ # In case the report or the iface key is missing,
+ # the device is defaulted to the network name (i.e. northbound port).
+ device = (nets[network].get('iface', network)
+ if network in nets else network)
ip, _, _, _ = net_api.ip_addrs_info(device)
except (libvirt.libvirtError, KeyError, IndexError):
ip = config.get('addresses', 'guests_gateway_ip')
+ finally:
if ip == '':
ip = '0'
- logging.info('network %s: using %s', network, ip)
return ip
--
To view, visit https://gerrit.ovirt.org/61262
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id809e90f2340caffaf30a5749dd75ec39516c96c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-4.0
Gerrit-Owner: Edward Haas <[email protected]>
Gerrit-Reviewer: Francesco Romani <[email protected]>
Gerrit-Reviewer: Petr Horáček <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/admin/lists/[email protected]