[ovirt-users] Cannot create VM with custom memory amount
Logan Kuhn
support at jac-properties.com
Mon Jan 9 17:06:14 UTC 2017
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.
def create_vm(name, ram, cpu=None):
garbled_passwd = 'd3lrazNwa2wjUnI='
logging.basicConfig(level=logging.DEBUG,
filename=os.path.join(baseDir, 'list_vms.log'))
# This example will connect to the server and create a new virtual
machine:
# Create the connection to the server:
connection = sdk.Connection(
url='https://ovirt.example.com/ovirt-engine/api',
username='admin at internal',
password=base64.b64decode(garbled_passwd).decode('utf-8'),
ca_file='/etc/pki/tls/certs/examplecert.pem',
debug=True,
log=logging.getLogger(),
)
# Get the reference to the "vms" service:
vms_service = connection.system_service().vms_service()
# Use the "add" method to create a new virtual machine:
cpu = types.CpuTopology(cores=2, sockets=1)
vms_service.add(
types.Vm(
name=name,
memory=400,
cpu=types.Cpu(topology=cpu),
cluster=types.Cluster(
name='Default',
),
template=types.Template(
name='Blank',
),
),
)
# Close the connection to the server:
connection.close()
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.
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.
Regards,
Logan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20170109/8f86140b/attachment.html>
More information about the Users
mailing list