Bug 1024298 - [ovirt-engine-backend] wrong error message (event) when creating VM with wrong memory size.
[ovirt-engine-backend] wrong error message (event) when creating VM with wron...
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine (Show other bugs)
x86_64 Linux
high Severity high
: ---
: 3.3.1
Assigned To: Roy Golan
Ilanit Stein
: AutomationBlocker, AutomationTriaged, Regression, Reopened, TestBlocker, Triaged
Depends On:
  Show dependency treegraph
Reported: 2013-10-29 07:06 EDT by Kiril Nesenko
Modified: 2015-08-11 15:21 EDT (History)
15 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-11-17 02:54:14 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
logs (8.58 MB, application/x-bzip)
2013-10-29 07:11 EDT, Kiril Nesenko
no flags Details

  None (edit)
Description Kiril Nesenko 2013-10-29 07:06:37 EDT
Description of problem:
 Cannot create with wrong memory size. Log says that Vms name already in use and its wrong. There is no such VM on the system. Log should be fixed as well.

2013-10-28 18:14:04,027 WARN  [org.ovirt.engine.core.bll.AddVmFromScratchCommand] (ajp-/ [1b825962] CanDoAction of action AddVmFromScratch failed. Reasons:VAR__ACTION__ADD,VAR__TYPE__VM,ACTION_TYPE_FAILED_NAME_ALREADY_USED
, sharedLocks= ]
2013-10-28 18:14:04,021 INFO  [org.ovirt.engine.core.bll.AddVmFromScratchCommand] (ajp-/ [1b825962] Lock Acquired to object EngineLock [exclusiveLocks= key: restvm0 value: VM_NAME
2013-10-28 18:14:04,714 WARN  [org.ovirt.engine.core.bll.VmHandler] (ajp-/ [21b358c] RAM value 0mb for novm is exceeding the recommended values 256mb - 64,000mb for Other OS
2013-10-28 18:14:04,713 INFO  [org.ovirt.engine.core.bll.AddVmFromScratchCommand] (ajp-/ [21b358c] Running command: AddVmFromScratchCommand internal: false. Entities affected :  ID: 1ba17f3a-45a2-4538-b12c-f183296e6264 Type: VdsGroups
2013-10-28 18:14:04,701 INFO  [org.ovirt.engine.core.bll.AddVmFromScratchCommand] (ajp-/ [21b358c] Lock Acquired to object EngineLock [exclusiveLocks= key: novm value: VM_NAME
, sharedLocks= ]
2013-10-28 18:14:04,031 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (ajp-/ Operation Failed: [Cannot add VM. The VM name is already in use, please choose a unique name and try again.]
, sharedLocks= ]
2013-10-28 18:14:04,027 INFO  [org.ovirt.engine.core.bll.AddVmFromScratchCommand] (ajp-/ [1b825962] Lock freed to object EngineLock [exclusiveLocks= key: restvm0 value: VM_NAME

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:

Actual results:

Expected results:

Additional info:
Comment 2 Kiril Nesenko 2013-10-29 07:11:41 EDT
Created attachment 817052 [details]
Comment 5 Eli Mesika 2013-10-30 11:12:01 EDT
unable to reproduce.
Has used the following VM with SERT API POST on the vms collections (api/vms)

<topology sockets="1" cores="1"/>
<os type="other">
<boot dev="hd"/>
<cluster href= "/api/clusters/369cf110-b792-42ba-ba3f-393f2b51d87b" id="369cf110-b792-42ba-ba3f-393f2b51d87b"/>
<template href= "/api/templates/00000000-0000-0000-0000-000000000000" id="00000000-0000-0000-0000-000000000000"/>

Result: VM was created event tough when you try to do it from UI you will get an error that memory can not exceeda 64000 MB

In this case I had defined a VM with 65000MB (68157440000 Bytes) and got no error. (A BZ for that shoulg be opened separately IMHO)

Please add a simple REST API code that reproduces the reported problem.
Comment 6 Kiril Nesenko 2013-10-31 03:59:45 EDT
Hello Eli,

I provided a link to the test case in Comment #1 with all info.

Note: You should create a VM with the following parameters:
2013-10-29 12:04:41,913 - MainThread - plmanagement.matrix-test-composer - INFO - Running command: addVm(False, name='novm', memory=214748, cluster='RestCluster1')

- Kiril
Comment 7 Eli Mesika 2013-10-31 05:35:32 EDT
Still unable to reproduce the bug
please provide the AddVm REST API call that caused the problem
The 'novm' VM in the test appears twice in the test , once with positive memory size and once with a zero memory size , both was created successfully ...

Setting info on Elena as Kiril recomended ...
Comment 10 Ilanit Stein 2013-11-12 02:43:51 EST
Adding Elena's email, explaining the problem:

"If you are looking for REST request, see it below (can be found also at Jenkins log if you search for 'CREATE').
Afaiu, the test tries to create vm with wrong memory size and instead of error it gets success (with 0 memory in response).
Hope it's helpful."

2013-10-29 12:04:42,364 - MainThread - vms - DEBUG - CREATE request content is --  url:https://jenkins-automation-rpm-vm47.eng.lab.tlv.redhat.com/api/vms body:<vm>
    <cluster href="/api/clusters/b954f172-f87c-4b4f-9b00-a277c9e43d7d" id="b954f172-f87c-4b4f-9b00-a277c9e43d7d">
        <link href="/api/clusters/b954f172-f87c-4b4f-9b00-a277c9e43d7d/networks" rel="networks"/>
        <link href="/api/clusters/b954f172-f87c-4b4f-9b00-a277c9e43d7d/permissions" rel="permissions"/>
        <link href="/api/clusters/b954f172-f87c-4b4f-9b00-a277c9e43d7d/glustervolumes" rel="glustervolumes"/>
        <link href="/api/clusters/b954f172-f87c-4b4f-9b00-a277c9e43d7d/glusterhooks" rel="glusterhooks"/>
        <cpu id="Intel Conroe Family"/>
        <data_center href="/api/datacenters/177073fb-92ea-43d1-a8eb-5a63e58f3ecf" id="177073fb-92ea-43d1-a8eb-5a63e58f3ecf"/>
            <overcommit percent="200"/>
        <version major="3" minor="3"/>
    <template id="00000000-0000-0000-0000-000000000000"/>

2013-10-29 12:04:43,205 - MainThread - vms - ERROR - Response code is not valid, expected is: [400, 409, 500, 404], actual is: 201
Comment 11 Ilanit Stein 2013-11-12 02:56:34 EST

The bug is that a VM creation with wrong memory succeed, though it should fail. 
It fails our regression VMs test.
Can you please move this bug to target release 3.3? Otherwise it will continue to fail, till 3.4.
Comment 12 Eli Mesika 2013-11-12 05:14:25 EST
Change causing that was done by Roy G in
while resolving

This actually moved the memory check from the canDoAction to the execute method and generates only a warning for invalid memory 

Assigning to Roy
Comment 13 Roy Golan 2013-11-12 05:57:38 EST
all values are permitted now. I have disagreed with that before. 

anyhow the VM was create with 28k which is effectively 0Mb in the DB.
Comment 15 Roy Golan 2013-11-17 02:54:14 EST
the test should be refactored according the change in bug 1014952 - you *can* create a VM with any positive value of mem and you'll get an event back instead of a cando if the value is below the min memory for that OS

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