Moti Asayag has uploaded a new change for review.

Change subject: restapi: Extend VM with provider id
......................................................................

restapi: Extend VM with provider id

The provider id is a reference to the provider which is
used for querying katello errata for the specific VM.
In the future, the field will be used also to associate
the VM with the server by which it was provisioned
(Foreman/Satellite).

  <vm>
    ...
    <provider id="..." href="..." />
  </vm>

Change-Id: Ia923483e6ff8de8dc16dde84e61818472f59a944
Bug-Url: https://bugzilla.redhat.com/1157377
Signed-off-by: Moti Asayag <[email protected]>
---
M 
backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd
M 
backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
M 
backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/VmMapper.java
3 files changed, 15 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/19/40719/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 1bde347..fb81ccc 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
@@ -3343,6 +3343,7 @@
           <xs:element name="next_run_configuration_exists" type="xs:boolean" 
minOccurs="0" maxOccurs="1"/>
           <xs:element name="numa_tune_mode" type="xs:string" minOccurs="0" 
maxOccurs="1"/>
           <xs:element ref="permissions" minOccurs="0" maxOccurs="1"/>
+          <xs:element ref="external_host_provider" minOccurs="0" 
maxOccurs="1"/>
         </xs:sequence>
       </xs:extension>
     </xs:complexContent>
diff --git 
a/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
 
b/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
index 08f6044..5e72981 100644
--- 
a/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
+++ 
b/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml
@@ -100,6 +100,7 @@
           vm.cpu_profile.id: xs:string
           vm.migration.auto_converge: xs:string
           vm.migration.compressed: xs:string
+          vm.external_host_provider.id: 'xs:string'
         description: update the virtual machine in the system for the given 
virtual machine id with the values specified in the request
 - name: /vms/{vm:id}/applications|rel=get
   description: get all the applications installed on the vm identified by the 
given id
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 ffef9e3..440f2ff 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
@@ -7,6 +7,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+
 import org.apache.commons.lang.StringUtils;
 import org.ovirt.engine.api.common.util.StatusUtils;
 import org.ovirt.engine.api.model.AuthorizedKey;
@@ -22,6 +23,7 @@
 import org.ovirt.engine.api.model.CustomProperty;
 import org.ovirt.engine.api.model.Display;
 import org.ovirt.engine.api.model.Domain;
+import org.ovirt.engine.api.model.ExternalHostProvider;
 import org.ovirt.engine.api.model.File;
 import org.ovirt.engine.api.model.Files;
 import org.ovirt.engine.api.model.GuestInfo;
@@ -237,6 +239,11 @@
             }
         }
 
+        if (vm.isSetExternalHostProvider()) {
+            String providerId = vm.getExternalHostProvider().getId();
+            staticVm.setProviderId(providerId == null ? null : 
GuidUtils.asGuid(providerId));
+        }
+
         return staticVm;
     }
 
@@ -448,6 +455,12 @@
         }
         
model.setNextRunConfigurationExists(entity.isNextRunConfigurationExists());
         model.setNumaTuneMode(map(entity.getNumaTuneMode(), null));
+
+        if (entity.getProviderId() != null) {
+            model.setExternalHostProvider(new ExternalHostProvider());
+            
model.getExternalHostProvider().setId(entity.getProviderId().toString());
+        }
+
         return model;
     }
 


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

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

Reply via email to