Bug 1151599 - [PPC][restapi] Cannot create ppc64 VMs using REST API
Summary: [PPC][restapi] Cannot create ppc64 VMs using REST API
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-restapi
Version: 3.4.1-1
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
: 3.5.0
Assignee: Doron Fediuck
QA Contact: Pavel Stehlik
URL:
Whiteboard: sla
Depends On:
Blocks: 1122979
TreeView+ depends on / blocked
 
Reported: 2014-10-10 19:13 UTC by Vitor de Lima
Modified: 2016-02-10 20:19 UTC (History)
15 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-10-14 14:11:12 UTC
oVirt Team: SLA
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Vitor de Lima 2014-10-10 19:13:45 UTC
Description of problem:
The creation of ppc64 VMs without any additional info about ballooning causes an error.

Given the following XML posted to the URL api/vms:
<vm><name>otheros-ppc64</name> <cluster><name>Default</name></cluster> <template><name>Blank</name></template> <os type='other_ppc64'><boot dev='hd'/></os></vm>

The request results in the following error:
<fault>
<reason>Operation Failed</reason>
<detail>
[Cannot add VM. Balloon is not supported on 'ppc64' architecture.]
</detail>
</fault>

Version-Release number of selected component (if applicable):
ovirt-engine-3.4.3_av12.1-2-g6a33553

How reproducible:
Always

Steps to Reproduce:
1. Setup a Data Center and Cluster for ppc64 VMs
2. Create a ppc64 VM using the REST API

Actual results:
An error occurs.

Expected results:
The VM should be create successfully.

Additional info:
The REST API should disable ballooning if this parameters was omitted in the incoming XML.

Comment 1 Juan Hernández 2014-10-13 09:12:17 UTC
Note that the REST API should not enable or disable anything, business logic is the responsibility of the backend, the REST API should just send to the backend whatever the user sent.

Comment 2 Lukas Svaty 2014-10-13 12:51:40 UTC
This might be reproducible via other APIs as well. Please check if they are not setting balloon to enabled or they are just sending values set by user.

Comment 3 Jiri Moskovcak 2014-10-14 13:11:43 UTC
This is what I use from python to test VM creation on ppc:

api.vms.add(params.VM(name=VM_NAME,
                              memory=2*GB,
                              cluster=api.clusters.get("Default"),
                              template=api.templates.get('Blank'),
                              memory_policy=params.MemoryPolicy(ballooning=False),
                              placement_policy=params.VmPlacementPolicy(host=api.hosts.get("asda"),affinity='pinned')))

and using curl (I didn't test it, just got it from our QA):

curl -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" \
    -u admin@internal -k \
    -d "<vm><name>ppc64</name> \
    <cluster><name>ppc64</name></cluster> \
    <template><name>Blank</name></template> \
    <os type='rhel_6_ppc64'><boot
dev='hd'/></os><memory_policy><ballooning>false</ballooning></memory_policy></vm>"
\
    https://[engine]/api/vm

Comment 4 Vitor de Lima 2014-10-14 13:38:07 UTC
I think it would be better if ballooning was disabled automatically when you create a VM in a cluster that does not support it. Just like what happens with SPICE, migration, etc, ... these things are automatically chosen according to the target architecture.

Comment 5 Doron Fediuck 2014-10-14 14:11:12 UTC
(In reply to Vitor de Lima from comment #4)
> I think it would be better if ballooning was disabled automatically when you
> create a VM in a cluster that does not support it. Just like what happens
> with SPICE, migration, etc, ... these things are automatically chosen
> according to the target architecture.

Vitor we need to maintain consistency in the system behavior.
When working with a script a user should assume to get the same results
regardless of the specific cluster he is working on.
Since the default behaviour of libvirt and the engine are to add a balloon
device, we keep the default regardless of the cluster. When working with PPC
you should make sure your VM settings comply with PPC needs or get an error
as the above message shows.

To conclude,
PPC should not break system defaults, and the same behaviour remains.
When working with PPC cluster the user should specify ballooning=False
among other properties needed for the VM to run.

Comment 6 Ori Gofen 2014-10-14 15:04:24 UTC
Doron, if the default behavior of libvirt is to send ,balloning == 'True', regardless of cluster attribute, what does the cluster flag

<ballooning_enabled>
                    false
</ballooning_enabled>

means? does it do something? or is it data redundancy?
Like you I also believe in consistency, but closing this as NOTABUG for the sake of libvirt consistency, damages the costumer consistency.
literally none of my scripts work, I'm executing every operation manually and believe me,if I'm frustrated, an experienced rhev costumer will rage

Comment 7 Lukas Svaty 2014-10-14 15:49:47 UTC
Look at this scenario and try it yourself please.

1. Create VM with RESTAPI "<vm><name>foo</name><memory_policy><ballooning>false</ballooning></memory_policy><cluster><name>Default</name></cluster><template><name>Blank</name></template></vm>"
Im ok with setting ballooning to false as it goes by your comment in bug
2. try to edit ANYTHING on the VM

~] $ curl -X PUT -H "Accept: application/xml" -H "Content-Type: application/xml" -u admin@internal:$pwd --cacert ca.crt -d "<vm><name>bar</name></vm>" $engine/api/vms/$vmid
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<fault>
    <reason>Operation Failed</reason>
    <detail>[Cannot edit VM. Balloon is not supported on 'ppc64' architecture.]</detail>
</fault>

Do I really have to put "<memory_policy><ballooning>false</ballooning></memory_policy>" into every
edit I want to make with REST? Even that I did not try to enable the balloon?

For me this is really not user friendly solution. Not to mention that it will break all the automation we have.

Comment 8 Artyom 2014-10-15 09:21:57 UTC
Also we need to edit all our automation tests to put balloning=False, that also not good solution and also it different behavior via UI(balloning by default False) and via other API(balloning by default True). We have many peoples that thinks, it's better to put balloning by default false for all api or get balloning value from cluster and put the same for vms. So maybe it's worth to fix it?

Comment 9 Doron Fediuck 2014-10-19 09:05:51 UTC
(In reply to Artyom from comment #8)
> Also we need to edit all our automation tests to put balloning=False, that
> also not good solution and also it different behavior via UI(balloning by
> default False) and via other API(balloning by default True). We have many
> peoples that thinks, it's better to put balloning by default false for all
> api or get balloning value from cluster and put the same for vms. So maybe
> it's worth to fix it?

You're confusing several things, so let's explain it;
Using a balloon has 2 levels-
1. VM level: does the VM have a balloon device
2. Cluster level: so we actively use ballooning in the given cluster.

The fact that (2) is set to true does not imply that all VMs will have a
balloon device. On the other hand, the fact that a VM has a balloon does not
mean we'll be using it. The actual uses vary between users. 
The important thing is that we are obliged to maintain behavior consistency
with libvirt (and had to fix our code for it in the past). This is why every
VM has a balloon device even if not being used in the current cluster. This
consistency must be kept in .z releases. Changing it for 3.6 would probably
be easier since scripts with ballooning=false will still be supported and this
is a safer way to conduct such a change.

Comment 10 Ori Gofen 2014-10-21 17:56:33 UTC
understood,this should be well documented.


Note You need to log in before you can comment on or make changes to this bug.