Bug 1085463 - rhevm-shell it is not possible to create nonVM network
Summary: rhevm-shell it is not possible to create nonVM network
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-cli
Version: 3.4.0
Hardware: x86_64
OS: Linux
low
medium
Target Milestone: ovirt-3.6.0-rc
: 3.6.0
Assignee: Juan Hernández
QA Contact: Jiri Belka
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-04-08 16:28 UTC by Martin Pavlik
Modified: 2016-03-09 19:54 UTC (History)
10 users (show)

Fixed In Version: ovirt-engine-cli-3.6.0.0-0.1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-03-09 19:54:20 UTC
oVirt Team: Infra
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2016:0406 0 normal SHIPPED_LIVE rhevm-cli bug fix and enhancement update 2016-03-10 00:04:32 UTC
oVirt gerrit 32783 0 master MERGED cli: Generate empty list for empty option Never

Description Martin Pavlik 2014-04-08 16:28:42 UTC
Description of problem:

It is not possible to create new network without usages-usage  : vm

If usage is not specified, usage vm is added automatically


[RHEVM shell (connected)]# add network --name NET5 --data_center-name Default
id            : 4a549f24-a62a-40a1-b945-ed7828684a5f
name          : NET5
data_center-id: 5849b030-626e-47cb-ad90-3ce782d831b3
mtu           : 0
stp           : False
usages-usage  : vm


if no usage is specified, error returns

[RHEVM shell (connected)]# add network --name NET4 --description NET4 --data_center-name DC1 --usages-usage
  =========================================== ERROR ========================================
  status: 400
  reason: Bad Request
  detail: None is not a member of NetworkUsage. Possible values for NetworkUsage are: display, vm, migration
  ==========================================================================================




Version-Release number of selected component (if applicable):
rhevm-cli-3.4.0.6-2.el6ev.noarch

How reproducible:
100%

Steps to Reproduce:
1. start rhevm-shell
2. connect to rhevm
3. try to add new network to DC without VM role
e.g. add network --name NET4 --description NET4 --data_center-name DC1 --usages-usage

Actual results:
It is not possible to create new network without usages-usage  : vm

Expected results:
It is possible to create new network without usages-usage  : vm

Additional info:

Comment 1 Juan Hernández 2014-04-09 09:08:48 UTC
The CLI just passes the parameters to the RESTAPI, which in turn passes them to the backend. In this case, when no usage is specified, the backend receives nothing, but the default value of the "vmNetwork" field of the "Network" entity is "true". This means that for the backend the default is to create a VM network. If this isn't the desired default then it should be changed in the backend, as the RESTAPI shouldn't make this kind of decisions.

Comment 2 Moti Asayag 2014-06-01 08:31:15 UTC
(In reply to Juan Hernández from comment #1)
> The CLI just passes the parameters to the RESTAPI, which in turn passes them
> to the backend. In this case, when no usage is specified, the backend
> receives nothing, but the default value of the "vmNetwork" field of the
> "Network" entity is "true". This means that for the backend the default is
> to create a VM network. If this isn't the desired default then it should be
> changed in the backend, as the RESTAPI shouldn't make this kind of decisions.

Juan, you're right about this is being a backend default behaviour. 
However, that default value can be overriden by providing the the following request, which will set no value to the usages element, and eventually creates a non-vm newtork:

<network>
  <name>NET1</name>
  <data_center><name>Default</name></data_center>
  <usages/>
</network>

Can't the same behavior be imitated by the cli ?

Comment 3 Juan Hernández 2014-06-03 17:39:07 UTC
Yes, the CLI could do that.

Comment 4 Juan Hernández 2014-09-12 08:32:08 UTC
The fix for this bug has been fixed upstream. It will be available with the first 3.6 downstream build of the CLI.

Comment 6 Jiri Belka 2015-07-07 11:23:15 UTC
ok, ovirt-engine-cli-3.6.0.0-0.3.20150623.git53408f5.el6.noarch

[oVirt shell (connected)]# add network --name NET5 --data_center-name Default

id            : 4de41bff-6f5c-4936-9f56-277e9f6a55f6
name          : NET5
data_center-id: 00000001-0001-0001-0001-000000000314
mtu           : 0
stp           : False
usages-usage  : vm

[oVirt shell (connected)]# add network --name NET4 --description NET4 --data_center-name Default --usages-usage

id            : 8b8f7231-1b8f-4f78-83ef-5d79bf7168aa
name          : NET4
description   : NET4
data_center-id: 00000001-0001-0001-0001-000000000314
mtu           : 0
stp           : False

[oVirt shell (connected)]# list networks 

id         : 8b8f7231-1b8f-4f78-83ef-5d79bf7168aa
name       : NET4
description: NET4

id         : 4de41bff-6f5c-4936-9f56-277e9f6a55f6
name       : NET5

id         : 00000000-0000-0000-0000-000000000009
name       : ovirtmgmt
description: Management Network

Comment 7 Jiri Belka 2015-07-07 11:27:04 UTC
NET4 got 'vm' usage by default.

Comment 9 errata-xmlrpc 2016-03-09 19:54:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHEA-2016-0406.html


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