Frank Kobzik has uploaded a new change for review.

Change subject: engine: spice + vnc support
......................................................................

engine: spice + vnc support

 - setvmticket command draft

todo
 - GAAD (graphics-as-a-device)
 - graphicstype enum (instead of string prototyping)

Change-Id: Ia59b933f4cd1e3ab562ad2ec1c237007c83f214c
Signed-off-by: Frantisek Kobzik <fkob...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SetVmTicketCommand.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/SetVmTicketParameters.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/SetVmTicketVDSCommandParameters.java
M 
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmResource.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SetVmTicketVDSCommand.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SpiceConsoleModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VncConsoleModel.java
7 files changed, 49 insertions(+), 35 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/53/23553/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SetVmTicketCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SetVmTicketCommand.java
index 918e084..c1877de 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SetVmTicketCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SetVmTicketCommand.java
@@ -198,7 +198,7 @@
             .getInstance()
             .getResourceManager()
             .RunVdsCommand(VDSCommandType.SetVmTicket,
-                    new SetVmTicketVDSCommandParameters(getVdsId(), getVmId(), 
mTicket, mValidTime, user.getLoginName(), user.getId())).getSucceeded();
+                    new SetVmTicketVDSCommandParameters(getVdsId(), getVmId(), 
mTicket, mValidTime, user.getLoginName(), user.getId(), 
getParameters().getGraphicsType())).getSucceeded();
 
         // Return the ticket only if sending it to the virtual machine 
succeeded:
         if (sent) {
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/SetVmTicketParameters.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/SetVmTicketParameters.java
index 4e96e5f..e11e65d 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/SetVmTicketParameters.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/SetVmTicketParameters.java
@@ -5,35 +5,40 @@
 public class SetVmTicketParameters extends VmOperationParameterBase {
     private static final long serialVersionUID = 7066467049851637162L;
 
-    private String _ticket;
+    private String ticket;
+    private int validTime;
+    private String clientIp;
+    private String graphicsType;
 
-    private int _validTime;
-
-    private String _clientIp;
-
-    public SetVmTicketParameters(Guid vmId, String ticket, int validTime) {
+    public SetVmTicketParameters(Guid vmId, String ticket, int validTime, 
String graphicsType) {
         super(vmId);
-        _ticket = ticket;
-        _validTime = validTime;
+        this.ticket = ticket;
+        this.validTime = validTime;
+        this.graphicsType = graphicsType;
     }
 
-    public SetVmTicketParameters(Guid vmId, String ticket, int validTime, 
String clientIp) {
-        this(vmId, ticket, validTime);
-        _clientIp = clientIp;
-        _ticket = ticket;
-        _validTime = validTime;
-    }
+    @Deprecated // not used
+//    public SetVmTicketParameters(Guid vmId, String ticket, int validTime, 
String clientIp) {
+//        this(vmId, ticket, validTime);
+//        clientIp = clientIp;
+//        ticket = ticket;
+//        validTime = validTime;
+//    }
 
     public String getTicket() {
-        return _ticket;
+        return ticket;
     }
 
     public int getValidTime() {
-        return _validTime;
+        return validTime;
     }
 
     public String getClientIp() {
-        return _clientIp;
+        return clientIp;
+    }
+
+    public String getGraphicsType() {
+        return graphicsType;
     }
 
     public SetVmTicketParameters() {
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/SetVmTicketVDSCommandParameters.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/SetVmTicketVDSCommandParameters.java
index 6851320..7e93618 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/SetVmTicketVDSCommandParameters.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/SetVmTicketVDSCommandParameters.java
@@ -7,6 +7,7 @@
     private int validTime;
     private String userName;
     private Guid userId;
+    private String graphicsType;
 
     public SetVmTicketVDSCommandParameters(Guid vdsId, Guid vmId, String 
ticket, int validTime, String userName, Guid userId) {
         super(vdsId, vmId);
@@ -15,6 +16,16 @@
         this.userName = userName;
         this.userId = userId;
     }
+
+    public SetVmTicketVDSCommandParameters(Guid vdsId, Guid vmId, String 
ticket, int validTime, String userName, Guid userId, String graphicsType) {
+        super(vdsId, vmId);
+        this.ticket = ticket;
+        this.validTime = validTime;
+        this.userName = userName;
+        this.userId = userId;
+        this.graphicsType = graphicsType;
+    }
+
 
     public String getTicket() {
         return ticket;
@@ -40,4 +51,8 @@
         return String.format("%s, ticket=%s, validTime=%s,m userName=%s, 
userId=%s", super.toString(), getTicket(), getValidTime(),
                 getUserName(), getUserId());
     }
+
+    public String getGraphicsType() {
+        return graphicsType;
+    }
 }
diff --git 
a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmResource.java
 
b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmResource.java
index e211094..e08c860 100644
--- 
a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmResource.java
+++ 
b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmResource.java
@@ -326,7 +326,7 @@
         final Response response = doAction(VdcActionType.SetVmTicket,
                 new SetVmTicketParameters(guid,
                                           getTicketValue(action),
-                                          getTicketExpiry(action)),
+                                          getTicketExpiry(action), "spice"),
                 action);
 
         final Action actionResponse = (Action) response.getEntity();
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SetVmTicketVDSCommand.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SetVmTicketVDSCommand.java
index db5e202..8f88e50 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SetVmTicketVDSCommand.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SetVmTicketVDSCommand.java
@@ -29,6 +29,11 @@
             Map<String, String> params = new HashMap<String, String>();
             params.put("userName", getParameters().getUserName());
             params.put("userId", getParameters().getUserId().toString());
+
+            if (getParameters().getGraphicsType() != null) {
+                params.put("graphicsType", 
getParameters().getGraphicsType().toString());
+            }
+
             status = getBroker().setVmTicket(mVmId.toString(), mTicket, 
String.valueOf(mValidTime),
                     connectionAction, params);
         }
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SpiceConsoleModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SpiceConsoleModel.java
index 80c230c..45a8b8c 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SpiceConsoleModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SpiceConsoleModel.java
@@ -4,7 +4,6 @@
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
-
 import org.ovirt.engine.core.common.action.ChangeDiskCommandParameters;
 import org.ovirt.engine.core.common.action.RunVmParams;
 import org.ovirt.engine.core.common.action.SetVmTicketParameters;
@@ -13,7 +12,6 @@
 import org.ovirt.engine.core.common.action.VdcActionType;
 import org.ovirt.engine.core.common.action.VdcReturnValueBase;
 import org.ovirt.engine.core.common.action.VmOperationParameterBase;
-import org.ovirt.engine.core.common.businessentities.DisplayType;
 import org.ovirt.engine.core.common.businessentities.ImageFileType;
 import org.ovirt.engine.core.common.businessentities.RepoImage;
 import org.ovirt.engine.core.common.businessentities.SsoMethod;
@@ -188,12 +186,8 @@
 
     @Override
     public boolean canBeSelected() {
-        DisplayType displayType = getEntity().getDisplayType() != null
-                ? getEntity().getDisplayType()
-                : getEntity().getDefaultDisplayType();
         boolean hasVmSpiceSupport = 
Boolean.TRUE.equals(AsyncDataProvider.hasSpiceSupport(getEntity().getOs(), 
getEntity().getVdsGroupCompatibilityVersion()));
-
-        return displayType == DisplayType.qxl && hasVmSpiceSupport;
+        return hasVmSpiceSupport; // todo && vm has spice or spice and vnc 
graphics type
     }
 
     @Override
@@ -543,7 +537,7 @@
 
     private void setVmTicket() {
         // Create ticket for single sign on.
-        Frontend.getInstance().runAction(VdcActionType.SetVmTicket, new 
SetVmTicketParameters(getEntity().getId(), null, 120),
+        Frontend.getInstance().runAction(VdcActionType.SetVmTicket, new 
SetVmTicketParameters(getEntity().getId(), null, 120, "spice"), // $NON-NLS-1$
                 new IFrontendActionAsyncCallback() {
                     @Override
                     public void executed(FrontendActionAsyncResult result) {
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VncConsoleModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VncConsoleModel.java
index 18f7ec7..61a84f0 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VncConsoleModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VncConsoleModel.java
@@ -3,9 +3,8 @@
 import org.ovirt.engine.core.common.action.SetVmTicketParameters;
 import org.ovirt.engine.core.common.action.VdcActionType;
 import org.ovirt.engine.core.common.action.VdcReturnValueBase;
-import org.ovirt.engine.core.common.businessentities.DisplayType;
-import org.ovirt.engine.core.common.queries.ConfigurationValues;
 import org.ovirt.engine.core.common.businessentities.VM;
+import org.ovirt.engine.core.common.queries.ConfigurationValues;
 import org.ovirt.engine.core.common.queries.IdQueryParameters;
 import org.ovirt.engine.core.common.queries.VdcQueryReturnValue;
 import org.ovirt.engine.core.common.queries.VdcQueryType;
@@ -112,17 +111,13 @@
 
     @Override
     public boolean canBeSelected() {
-        DisplayType vmDisplayType = getEntity().getDisplayType() != null
-                ? getEntity().getDisplayType()
-                : getEntity().getDefaultDisplayType();
-
-        return vmDisplayType == DisplayType.vnc;
+        return true; // todo && gt is vnc or vnc and spice
     }
 
     private void setVmTicket() {
         Frontend.getInstance().runAction(VdcActionType.SetVmTicket, new 
SetVmTicketParameters(getEntity().getId(),
                     null,
-                    TICKET_VALIDITY_SECONDS), new 
IFrontendActionAsyncCallback() {
+                    TICKET_VALIDITY_SECONDS, "vnc"), new 
IFrontendActionAsyncCallback() { // $NON-NLS-1$
 
                 @Override
                 public void executed(FrontendActionAsyncResult result) {


-- 
To view, visit http://gerrit.ovirt.org/23553
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia59b933f4cd1e3ab562ad2ec1c237007c83f214c
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Frank Kobzik <fkob...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to