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:
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.
(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 ?
Yes, the CLI could do that.
The fix for this bug has been fixed upstream. It will be available with the first 3.6 downstream build of the CLI.
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
NET4 got 'vm' usage by default.
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