Frank Kobzik has uploaded a new change for review.

Change subject: restapi: Phase 5: Add graphics console representation
......................................................................

restapi: Phase 5: Add graphics console representation

as a part of display subresource.

GraphicsConsole holds basic dynamic data of running console (host, port,
secure port).

In a follow up, GraphicsConsole will be used for retrieving console
descriptor (aka vv file).

Change-Id: I7dbc63ac49bfba5637c38b84b373d78f348c7872
Signed-off-by: Frantisek Kobzik <[email protected]>
Bug-Url: https://bugzilla.redhat.com/1128763
---
M 
backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd
M 
backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/VmMapper.java
2 files changed, 40 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/57/39057/1

diff --git 
a/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd
 
b/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd
index 6e69ce6..20e88c4 100644
--- 
a/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd
+++ 
b/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd
@@ -2989,6 +2989,7 @@
 
   <xs:complexType name="Display">
     <xs:sequence>
+      <xs:element name="graphics_consoles" type="GraphicsConsoles"/>
       <xs:element name="type" type="xs:string" minOccurs="0" maxOccurs="1"/>
       <xs:element name="address" type="xs:string" minOccurs="0" maxOccurs="1"/>
       <xs:element name="port" type="xs:unsignedShort" minOccurs="0" 
maxOccurs="1"/>
@@ -3005,6 +3006,26 @@
     </xs:sequence>
   </xs:complexType>
 
+  <xs:element name="graphics_consoles" type="GraphicsConsoles" />
+
+  <xs:complexType name="GraphicsConsoles">
+      <xs:sequence>
+          <xs:element ref="graphics_console" minOccurs="0" 
maxOccurs="unbounded" />
+      </xs:sequence>
+  </xs:complexType>
+
+  <xs:element name="graphics_console" type="GraphicsConsole" />
+
+  <xs:complexType name="GraphicsConsole">
+      <xs:sequence>
+          <xs:element name="protocol" type="xs:string" />
+          <xs:element name="port" type="xs:int" />
+          <xs:element name="tls_port" type="xs:int" />
+          <xs:element name="address" type="xs:string" />
+      </xs:sequence>
+      <xs:attribute name="id" type="xs:string" />
+  </xs:complexType>
+
   <xs:complexType name="Ticket">
     <xs:sequence>
       <xs:element name="value" type="xs:string" minOccurs="0" maxOccurs="1"/>
diff --git 
a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/VmMapper.java
 
b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/VmMapper.java
index 8275372b..6d0b03a 100644
--- 
a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/VmMapper.java
+++ 
b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/VmMapper.java
@@ -24,6 +24,8 @@
 import org.ovirt.engine.api.model.Domain;
 import org.ovirt.engine.api.model.File;
 import org.ovirt.engine.api.model.Files;
+import org.ovirt.engine.api.model.GraphicsConsole;
+import org.ovirt.engine.api.model.GraphicsConsoles;
 import org.ovirt.engine.api.model.GuestInfo;
 import org.ovirt.engine.api.model.GuestNicConfiguration;
 import org.ovirt.engine.api.model.GuestNicsConfiguration;
@@ -55,6 +57,7 @@
 import org.ovirt.engine.api.model.VmType;
 import org.ovirt.engine.api.restapi.utils.CustomPropertiesParser;
 import org.ovirt.engine.api.restapi.utils.GuidUtils;
+import org.ovirt.engine.api.restapi.utils.HexUtils;
 import org.ovirt.engine.core.common.action.RunVmOnceParams;
 import org.ovirt.engine.core.common.businessentities.BootSequence;
 import org.ovirt.engine.core.common.businessentities.GraphicsInfo;
@@ -382,7 +385,23 @@
                 Integer displaySecurePort = graphicsInfo == null ? null : 
graphicsInfo.getTlsPort();
                 model.getDisplay().setSecurePort(displaySecurePort==null || 
displaySecurePort.equals(-1) ? null : displaySecurePort);
             }
+
+            if (!entity.getGraphicsInfos().isEmpty()) {
+                model.getDisplay().setGraphicsConsoles(new GraphicsConsoles());
+            }
+            for (Map.Entry<GraphicsType, GraphicsInfo> graphicsInfo : 
entity.getGraphicsInfos().entrySet()) {
+                GraphicsConsole graphics = new GraphicsConsole();
+                String graphicsTypeString = 
GraphicsTypeHelper.graphicsTypeToString(graphicsInfo.getKey());
+                graphics.setId(HexUtils.string2hex(graphicsTypeString));
+                graphics.setProtocol(graphicsTypeString);
+                graphics.setPort(graphicsInfo.getValue().getPort());
+                graphics.setTlsPort(graphicsInfo.getValue().getTlsPort());
+                graphics.setAddress(graphicsInfo.getValue().getIp());
+
+                
model.getDisplay().getGraphicsConsoles().getGraphicsConsole().add(graphics);
+            }
         }
+
         if (entity.getLastStopTime() != null) {
             model.setStopTime(DateMapper.map(entity.getLastStopTime(), null));
         }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7dbc63ac49bfba5637c38b84b373d78f348c7872
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Frank Kobzik <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to