Cannot create VM with custom memory amount

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@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

On Mon, Jan 9, 2017 at 6:06 PM, Logan Kuhn <support@jac-properties.com> wrote:
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@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,
The memory parameter is in bytes. So for example to create vm with 2GiB of memory please pass following value: memory=2 * 2**30,
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
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users

Hi, I was also getting same issue. And found that it work only for 1024 MB memory size. It may be due to "Blank" template value, not sure. Please someone help us to figure out this problem. Thanks, ~Rohit On Mon, Jan 9, 2017 at 10:36 PM, Logan Kuhn <support@jac-properties.com> wrote:
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@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
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users

You must make sure you have `memory` attribute higher then `memory_guaranteed` For example this will work: memory=2*2**30, memory_policy=types.MemoryPolicy( guaranteed=1*2**30, ), and this won't work: memory=1*2**30, memory_policy=types.MemoryPolicy( guaranteed=2*2**30, ), Because guaranteed memory must be higher. On Tue, Jan 10, 2017 at 2:05 PM, TranceWorldLogic . <tranceworldlogic@gmail.com> wrote:
Hi,
I was also getting same issue. And found that it work only for 1024 MB memory size. It may be due to "Blank" template value, not sure.
Please someone help us to figure out this problem.
Thanks, ~Rohit
On Mon, Jan 9, 2017 at 10:36 PM, Logan Kuhn <support@jac-properties.com> wrote:
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@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
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users

Thanks for your help Ondra, Now I able to allocate 300MB memory for VM. But I observe some different behaviour than mention in your mail, let me explain. Let consider, parameter memory value is M. And parameter for guaranteed memory value is G Case 1> M < G => Fail to create VM got same error. Case 2> M = G => VM created successfully. Case 3> M > G => VM created successfully. On GUI, in general tab it show guaranteed memory as "Physical Memory Guaranteed" and memory parameter is shown as "Defined Memory". Meaning of those two parameter look to me, 1> guaranteed value mean like as minimum requirement to run VM and 2> memory value is like if available would be better. Would you please provide input on same ? Thanks, ~Rohit On Tue, Jan 10, 2017 at 6:50 PM, Ondra Machacek <omachace@redhat.com> wrote:
You must make sure you have `memory` attribute higher then `memory_guaranteed`
For example this will work:
memory=2*2**30, memory_policy=types.MemoryPolicy( guaranteed=1*2**30, ),
and this won't work:
memory=1*2**30, memory_policy=types.MemoryPolicy( guaranteed=2*2**30, ),
Because guaranteed memory must be higher.
On Tue, Jan 10, 2017 at 2:05 PM, TranceWorldLogic . <tranceworldlogic@gmail.com> wrote:
Hi,
I was also getting same issue. And found that it work only for 1024 MB memory size. It may be due to "Blank" template value, not sure.
Please someone help us to figure out this problem.
Thanks, ~Rohit
On Mon, Jan 9, 2017 at 10:36 PM, Logan Kuhn <support@jac-properties.com> wrote:
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@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
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users

Yes, if `Guaranteed memory` and `defined memory` are equal, you are allowed to create a VM. The difference between those you may find here: http://www.ovirt.org/documentation/admin-guide/virt/memory-faq/ On Tue, Jan 10, 2017 at 3:00 PM, TranceWorldLogic . <tranceworldlogic@gmail.com> wrote:
Thanks for your help Ondra,
Now I able to allocate 300MB memory for VM.
But I observe some different behaviour than mention in your mail, let me explain.
Let consider, parameter memory value is M. And parameter for guaranteed memory value is G
Case 1> M < G => Fail to create VM got same error. Case 2> M = G => VM created successfully. Case 3> M > G => VM created successfully.
On GUI, in general tab it show guaranteed memory as "Physical Memory Guaranteed" and memory parameter is shown as "Defined Memory". Meaning of those two parameter look to me, 1> guaranteed value mean like as minimum requirement to run VM and 2> memory value is like if available would be better.
Would you please provide input on same ?
Thanks, ~Rohit
On Tue, Jan 10, 2017 at 6:50 PM, Ondra Machacek <omachace@redhat.com> wrote:
You must make sure you have `memory` attribute higher then `memory_guaranteed`
For example this will work:
memory=2*2**30, memory_policy=types.MemoryPolicy( guaranteed=1*2**30, ),
and this won't work:
memory=1*2**30, memory_policy=types.MemoryPolicy( guaranteed=2*2**30, ),
Because guaranteed memory must be higher.
On Tue, Jan 10, 2017 at 2:05 PM, TranceWorldLogic . <tranceworldlogic@gmail.com> wrote:
Hi,
I was also getting same issue. And found that it work only for 1024 MB memory size. It may be due to "Blank" template value, not sure.
Please someone help us to figure out this problem.
Thanks, ~Rohit
On Mon, Jan 9, 2017 at 10:36 PM, Logan Kuhn <support@jac-properties.com> wrote:
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@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
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users

Thanks Ondra that link is useful, Do you have any Idea why VDSM disable balloon concept for RHEV and use for all non-RHEV ? Please refer to below link. https://www.ovirt.org/documentation/sla/memory-balloon/ *"Currently the balloon memory device is being created by default by libvirt for non RHEV environments, and VDSM disables it by default for RHEV."* Is there different technique use by RHEV ? Please provide me link for it detail. It will help me to compare ovirt and RHEV *.* Thanks, ~Rohit On Tue, Jan 10, 2017 at 10:35 PM, Ondra Machacek <omachace@redhat.com> wrote:
Yes, if `Guaranteed memory` and `defined memory` are equal, you are allowed to create a VM.
The difference between those you may find here:
http://www.ovirt.org/documentation/admin-guide/virt/memory-faq/
On Tue, Jan 10, 2017 at 3:00 PM, TranceWorldLogic . <tranceworldlogic@gmail.com> wrote:
Thanks for your help Ondra,
Now I able to allocate 300MB memory for VM.
But I observe some different behaviour than mention in your mail, let me explain.
Let consider, parameter memory value is M. And parameter for guaranteed memory value is G
Case 1> M < G => Fail to create VM got same error. Case 2> M = G => VM created successfully. Case 3> M > G => VM created successfully.
On GUI, in general tab it show guaranteed memory as "Physical Memory Guaranteed" and memory parameter is shown as "Defined Memory". Meaning of those two parameter look to me, 1> guaranteed value mean like as minimum requirement to run VM and 2> memory value is like if available would be better.
Would you please provide input on same ?
Thanks, ~Rohit
On Tue, Jan 10, 2017 at 6:50 PM, Ondra Machacek <omachace@redhat.com> wrote:
You must make sure you have `memory` attribute higher then `memory_guaranteed`
For example this will work:
memory=2*2**30, memory_policy=types.MemoryPolicy( guaranteed=1*2**30, ),
and this won't work:
memory=1*2**30, memory_policy=types.MemoryPolicy( guaranteed=2*2**30, ),
Because guaranteed memory must be higher.
On Tue, Jan 10, 2017 at 2:05 PM, TranceWorldLogic . <tranceworldlogic@gmail.com> wrote:
Hi,
I was also getting same issue. And found that it work only for 1024 MB memory size. It may be due to "Blank" template value, not sure.
Please someone help us to figure out this problem.
Thanks, ~Rohit
On Mon, Jan 9, 2017 at 10:36 PM, Logan Kuhn <
support@jac-properties.com>
wrote:
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@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
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users

On Wed, Jan 11, 2017 at 6:31 AM, TranceWorldLogic . < tranceworldlogic@gmail.com> wrote:
Thanks Ondra that link is useful, Do you have any Idea why VDSM disable balloon concept for RHEV and use for all non-RHEV ?
Please refer to below link. https://www.ovirt.org/documentation/sla/memory-balloon/
*"Currently the balloon memory device is being created by default by libvirt for non RHEV environments, and VDSM disables it by default for RHEV."* Is there different technique use by RHEV ? Please provide me link for it detail. It will help me to compare ovirt and RHEV *.*
Thanks, ~Rohit
In effect it is strange. Inside official docs for RHEV 4.0 we have: Administration Guide https://access.redhat.com/documentation/en/red-hat-virtualization/4.0/paged/... " 5.2.2.2. Optimization Settings Explained Memory Balloon Selecting the Enable Memory Balloon Optimization check box enables memory overcommitment on virtual machines running on the hosts in this cluster. When this option is set, the Memory Overcommit Manager (MoM) will start ballooning where and when possible, with a limitation of the guaranteed memory size of every virtual machine. ... It is important to understand that in some scenarios ballooning may collide with KSM. In such cases MoM will try to adjust the balloon size to minimize collisions. Additionally, in some scenarios ballooning may cause sub- optimal performance for a virtual machine. Administrators are advised to use ballooning optimization with caution. " So it seems it is indeed possible to enable ballooning (note the considerations about KSM that could partially answer to your question...) But then in Virtual Machine Management Guide here https://access.redhat.com/documentation/en/red-hat-virtualization/4.0/paged/... I see " 3.3.1. Red Hat Virtualization Guest Agents and Drivers virtio-balloon Virtio-balloon is used to control the amount of memory a guest actually accesses. It offers improved memory over-commitment. The balloon drivers are installed for future compatibility but not used by default in Red Hat Virtualization. " So it seems it is not possible to enable it for guests.... Any clarification? Thanks, Gianluca

Thanks Gianluca On Wed, Jan 11, 2017 at 1:46 PM, Gianluca Cecchi <gianluca.cecchi@gmail.com> wrote:
On Wed, Jan 11, 2017 at 6:31 AM, TranceWorldLogic . < tranceworldlogic@gmail.com> wrote:
Thanks Ondra that link is useful, Do you have any Idea why VDSM disable balloon concept for RHEV and use for all non-RHEV ?
Please refer to below link. https://www.ovirt.org/documentation/sla/memory-balloon/
*"Currently the balloon memory device is being created by default by libvirt for non RHEV environments, and VDSM disables it by default for RHEV."* Is there different technique use by RHEV ? Please provide me link for it detail. It will help me to compare ovirt and RHEV *.*
Thanks, ~Rohit
In effect it is strange. Inside official docs for RHEV 4.0 we have: Administration Guide https://access.redhat.com/documentation/en/red-hat- virtualization/4.0/paged/administration-guide/52-cluster-tasks
" 5.2.2.2. Optimization Settings Explained Memory Balloon Selecting the Enable Memory Balloon Optimization check box enables memory overcommitment on virtual machines running on the hosts in this cluster. When this option is set, the Memory Overcommit Manager (MoM) will start ballooning where and when possible, with a limitation of the guaranteed memory size of every virtual machine. ... It is important to understand that in some scenarios ballooning may collide with KSM. In such cases MoM will try to adjust the balloon size to minimize collisions. Additionally, in some scenarios ballooning may cause sub- optimal performance for a virtual machine. Administrators are advised to use ballooning optimization with caution. "
So it seems it is indeed possible to enable ballooning (note the considerations about KSM that could partially answer to your question...)
But then in Virtual Machine Management Guide here https://access.redhat.com/documentation/en/red-hat- virtualization/4.0/paged/virtual-machine-management- guide/33-installing-guest-agents-and-drivers
I see " 3.3.1. Red Hat Virtualization Guest Agents and Drivers
virtio-balloon
Virtio-balloon is used to control the amount of memory a guest actually accesses. It offers improved memory over-commitment. The balloon drivers are installed for future compatibility but not used by default in Red Hat Virtualization. "
So it seems it is not possible to enable it for guests.... Any clarification?
Thanks, Gianluca
participants (4)
-
Gianluca Cecchi
-
Logan Kuhn
-
Ondra Machacek
-
TranceWorldLogic .