<div dir="ltr"><div style="font-size:12.8px">I'm working on a program that should take a set of variables for the name, ram and disk space as well as how many disks (IE, 3 at 10, 15 and 20GB). Most of that works, but if I try and specify an integer value for memory it will seemingly always fail. I'm using Python 3, code and error are below.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><div>def create_vm(name, ram, cpu=None):</div><div> garbled_passwd = 'd3lrazNwa2wjUnI='</div><div><br></div><div> logging.basicConfig(level=<wbr>logging.DEBUG, filename=os.path.join(baseDir, 'list_vms.log'))</div><div><br></div><div> # This example will connect to the server and create a new virtual machine:</div><div><br></div><div> # Create the connection to the server:</div><div> connection = sdk.Connection(</div><div> url='<a href="https://ovirt.example.com/ovirt-engine/api" target="_blank">https://ovirt.example.<wbr>com/ovirt-engine/api</a>',</div><div> username='admin@internal',</div><div> password=base64.b64decode(<wbr>garbled_passwd).decode('utf-8'<wbr>),</div><div> ca_file='/etc/pki/tls/certs/<wbr>examplecert.pem',</div><div> debug=True,</div><div> log=logging.getLogger(),</div><div> )</div><div><br></div><div> # Get the reference to the "vms" service:</div><div> vms_service = connection.system_service().<wbr>vms_service()</div><div><br></div><div> # Use the "add" method to create a new virtual machine:</div><div> cpu = types.CpuTopology(cores=2, sockets=1)</div><div><br></div><div> vms_service.add(</div><div> types.Vm(</div><div> name=name,</div><div> memory=400,</div><div> cpu=types.Cpu(topology=cpu),</div><div> cluster=types.Cluster(</div><div> name='Default',</div><div> ),</div><div> template=types.Template(</div><div> name='Blank',</div><div> ),</div><div> ),</div><div> )</div><div><br></div><div> # Close the connection to the server:</div><div> connection.close()</div><div><br></div><div>ovirtsdk4.Error: Fault reason is "Operation Failed". Fault detail is "[Cannot add VM. Physical Memory Guaranteed cannot exceed Memory Size.]". HTTP response code is 400.</div></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">The Template is unmodified from installation time. I know the other settings are right because if I comment out the memory line then it creates a VM with the memory value from the "Blank" template.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><div class="gmail-m_-2832130594311703272gmail_signature">Regards,<div>Logan</div></div></div>
</div>