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
>