Ori Liel has uploaded a new change for review.

Change subject: restapi: #864991 - Vm Custom Properties Ignored
......................................................................

restapi: #864991 - Vm Custom Properties Ignored

Change-Id: I5d9c4ac782edf1779455aeee4121091199b76b3d
Signed-off-by: Ori Liel <[email protected]>
---
M 
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmResource.java
M 
backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendVmResourceTest.java
2 files changed, 23 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/06/8706/1

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 e48d274..ac71782 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
@@ -208,24 +208,19 @@
 
     @Override
     public Response start(Action action) {
-        RunVmOnceParams params = new RunVmOnceParams(guid);
-
-        if (action.isSetPause() && action.isPause()) {
-            params.setRunAndPause(true);
-        }
-
+        RunVmOnceParams params = map(get(), new RunVmOnceParams(guid));
         if (action.isSetVm()) {
             validateEnums(VM.class, action.getVm());
             VM vm = action.getVm();
-
+            params = map(vm, params);
             if (vm.isSetPlacementPolicy() && 
vm.getPlacementPolicy().isSetHost()) {
                 validateParameters(vm.getPlacementPolicy(), "host.id|name");
                 
params.setDestinationVdsId(getHostId(vm.getPlacementPolicy().getHost()));
             }
-
-            params = map(vm, params);
         }
-
+        if (action.isSetPause() && action.isPause()) {
+            params.setRunAndPause(true);
+        }
         return doAction(VdcActionType.RunVmOnce, 
setReinitializeSysPrep(params), action);
     }
 
diff --git 
a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendVmResourceTest.java
 
b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendVmResourceTest.java
index b5058cf..ed9e53c 100644
--- 
a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendVmResourceTest.java
+++ 
b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendVmResourceTest.java
@@ -304,7 +304,9 @@
 
     @Test
     public void testStart() throws Exception {
-        setUpWindowsGetEntityExpectations(1, false);
+        setUpWindowsGetEntityExpectations(2, false);
+        setUpGetPayloadExpectations(0);
+        setUpGetBallooningExpectations();
         setUriInfo(setUpActionExpectations(VdcActionType.RunVmOnce,
                                            RunVmOnceParams.class,
                                            new String[] { "VmId" },
@@ -315,7 +317,9 @@
 
     @Test
     public void testStartWithPauseAndStateless() throws Exception {
-        setUpWindowsGetEntityExpectations(1, false);
+        setUpWindowsGetEntityExpectations(2, false);
+        setUpGetPayloadExpectations(0);
+        setUpGetBallooningExpectations();
         setUriInfo(setUpActionExpectations(VdcActionType.RunVmOnce,
                                            RunVmOnceParams.class,
                                            new String[] { "VmId", 
"RunAndPause", "RunAsStateless" },
@@ -331,7 +335,9 @@
 
     @Test
     public void testStartWithVnc() throws Exception {
-        setUpWindowsGetEntityExpectations(1, false);
+        setUpWindowsGetEntityExpectations(2, false);
+        setUpGetPayloadExpectations(0);
+        setUpGetBallooningExpectations();
         setUriInfo(setUpActionExpectations(VdcActionType.RunVmOnce,
                                            RunVmOnceParams.class,
                                            new String[] { "VmId", "UseVnc" },
@@ -347,7 +353,9 @@
 
     @Test
     public void testStartWithBootDev() throws Exception {
-        setUpWindowsGetEntityExpectations(1, false);
+        setUpWindowsGetEntityExpectations(2, false);
+        setUpGetPayloadExpectations(0);
+        setUpGetBallooningExpectations();
         setUriInfo(setUpActionExpectations(VdcActionType.RunVmOnce,
                                            RunVmOnceParams.class,
                                            new String[] { "VmId", 
"BootSequence" },
@@ -364,7 +372,9 @@
 
     @Test
     public void testStartWithCdRomAndFloppy() throws Exception {
-        setUpWindowsGetEntityExpectations(1, false);
+        setUpWindowsGetEntityExpectations(2, false);
+        setUpGetPayloadExpectations(0);
+        setUpGetBallooningExpectations();
         setUriInfo(setUpActionExpectations(VdcActionType.RunVmOnce,
                                            RunVmOnceParams.class,
                                            new String[] { "VmId", "DiskPath", 
"FloppyPath" },
@@ -403,7 +413,9 @@
     }
 
     protected void testStartWithHost(Host host, Guid hostId) throws Exception {
-        setUpWindowsGetEntityExpectations(1, false);
+        setUpWindowsGetEntityExpectations(2, false);
+        setUpGetPayloadExpectations(0);
+        setUpGetBallooningExpectations();
         setUriInfo(setUpActionExpectations(VdcActionType.RunVmOnce,
                                            RunVmOnceParams.class,
                                            new String[] { "VmId", 
"DestinationVdsId" },


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

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

Reply via email to