Milan Zamazal has uploaded a new change for review.

Change subject: virt: Don't set connected attribute in <graphics> if already set
......................................................................

virt: Don't set connected attribute in <graphics> if already set

Currently, we unconditionally set connected=disconnect parameter for
graphics tickets in Engine and apply this setting in Vdsm if <graphics>
type is spice.  This prevents users from opening multiple spice
connections to the same VM even when they override the setting in Vdsm
hooks, see the bug.

This patch checks whether `connected' attribute is already defined and
sets it to the requested value only if it hasn't been set yet.  This way
the value from Engine is initially set and it is retained afterwards
whether it is changed using other means (e.g. by hooks) or not.

In theory, it prevents changing the attribute value from Engine after
the VM has been started.  But we don't support such a feature now and
we're probably not going to add it in a foreseeable future, so this
limitation shouldn't matter.

Change-Id: Ie7c49b26675f06a4914e97d1d85f2355ee6a083c
Bug-URL: https://bugzilla.redhat.com/1060573
Signed-off-by: Milan Zamazal <mzama...@redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/24/56224/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 39ef3f0..ccdb3fa 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -3788,7 +3788,8 @@
             validto = time.strftime('%Y-%m-%dT%H:%M:%S',
                                     time.gmtime(time.time() + float(seconds)))
             graphics.setAttribute('passwdValidTo', validto)
-        if graphics.getAttribute('type') == 'spice':
+        if ((graphics.getAttribute('type') == 'spice' and
+             not graphics.getAttribute('connected'))):
             graphics.setAttribute('connected', connAct)
         hooks.before_vm_set_ticket(self._domain.xml, self.conf, params)
         try:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie7c49b26675f06a4914e97d1d85f2355ee6a083c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Milan Zamazal <mzama...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to