Hi,

the memory unit in the API is byte, but then later it is converted to MiB.
These low numbers round down to 0, which causes the error.

Here is the documentation:
http://ovirt.github.io/ovirt-engine-api-model/4.2/#types/vm/attributes/memory


Regards,
Andrej


On Wed, 20 Nov 2019 at 13:21, <donagh.moran@oracle.com> wrote:
Ovirt version 4.2.8

Hi

I'm attempting to set the memory size or the max memory attributes of a VM via the Vmbuilder. Both of the following rest calls result in the same error on both vmStatic.memSizeMb and vmStatic.maxMemorySizeMb

VmService vms = sysService.vmsService().list().search(vmName).send().vms().get(0);

vms.update().vm(vm().memory(12).build()).send();
or
vms.update().vm(vm().memoryPolicy(memoryPolicy().max(2096)).build()).send();

org.ovirt.engine.sdk4.Error: Fault reason is "Operation Failed". Fault detail is "[must be greater than or equal to 1, Attribute: vmStatic.maxMemorySizeMb  ]". HTTP response code is "400". HTTP response message is "Bad Request".
        at org.ovirt.engine.sdk4.internal.services.ServiceImpl.throwError(ServiceImpl.java:116)
        at org.ovirt.engine.sdk4.internal.services.ServiceImpl.checkFault(ServiceImpl.java:43)
        at org.ovirt.engine.sdk4.internal.services.VmServiceImpl$UpdateRequestImpl.send(VmServiceImpl.java:1563)
        at org.ovirt.engine.sdk4.internal.services.VmServiceImpl$UpdateRequestImpl.send(VmServiceImpl.java:1482)
        at com.oracle.testbox.product.ovirt.tests.regression.cluster.ClusterOptimizationTest.memoryOptimizationTest(ClusterOptimizationTest.java:48)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
        at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
        at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816)
        at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124)
        at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
        at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
        at org.testng.TestRunner.privateRun(TestRunner.java:774)
        at org.testng.TestRunner.run(TestRunner.java:624)
        at org.testng.SuiteRunner.runTest(SuiteRunner.java:359)
        at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)
        at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)
        at org.testng.SuiteRunner.run(SuiteRunner.java:261)
        at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
        at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
        at org.testng.TestNG.runSuitesSequentially(TestNG.java:1215)
        at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
        at org.testng.TestNG.run(TestNG.java:1048)
        at org.testng.TestNG.privateMain(TestNG.java:1355)
        at org.testng.TestNG.main(TestNG.java:1324)
        at com.oracle.testbox.framework.runner.Testbox.run(Testbox.java:116)
        at com.oracle.testbox.framework.runner.Testbox.main(Testbox.java:121)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.simontuffs.onejar.Boot.run(Boot.java:342)
        at com.simontuffs.onejar.Boot.main(Boot.java:168)

I've seen related bugs logged and marked as fixed in 4.1.0 https://bugzilla.redhat.com/show_bug.cgi?id=1408577

Can shed some light on whether I am missing some code pre the rest request or is this a bug?

Regards
Donagh
_______________________________________________
Devel mailing list -- devel@ovirt.org
To unsubscribe send an email to devel-leave@ovirt.org
Privacy Statement: https://www.ovirt.org/site/privacy-policy/
oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/
List Archives: https://lists.ovirt.org/archives/list/devel@ovirt.org/message/T5MHKXULJNITVZT4SIPDXGNYLYBAHLRZ/