Bug 1294354

Summary: [Text] - Improve the format of the error message for detaching networks that are in use by VMs from SetupNetwork
Product: [oVirt] ovirt-engine Reporter: Michael Burman <mburman>
Component: BLL.NetworkAssignee: Edward Haas <edwardh>
Status: CLOSED CURRENTRELEASE QA Contact: Michael Burman <mburman>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.6.2CC: bugs, danken, ykaul, ylavi
Target Milestone: ovirt-4.1.0-betaFlags: rule-engine: ovirt-4.1+
Target Release: 4.1.0.2   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-01 14:35:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Network RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
screenshots none

Description Michael Burman 2015-12-27 13:51:38 UTC
Created attachment 1109819 [details]
screenshots

Description of problem:
[Text] - Improve the format of the error message for detaching networks that are in use by VMs from SetupNetwork. 

Currently when detaching 1 network from 1 VM while this network is used by the VM, the error message looks OK , for example -->

"Cannot setup Networks. The following Logical Network: 'net-1' is being used by the following VM: 'v1'. Please stop the VM and try again."

But, if we have more then 1 network and 1 VM involved, the error message looks pretty bad and the order of the sentence is inconsistent (singular vs plural), for example :

"Cannot setup Networks. The following VMs are actively using the Logical Networks 'net-1,
qosvlan2' : 'v2,
v3,
v4'. Please stop the VMs and try again."

- We have 2 issues here:
1) Singular, the sentence starts with: 'The following Logical Network'
Plural, the sentence starts with:  'The following VMs' 
and it becomes very messy to understand. 
It should be consistent for all scenarios. 
'The following Logical Network/s is being/are being used by the following VM/VMs' 

2) In case of multiple Networks and VMs, the error message looks not aligned.
each network get it's own line in the error, the same for the VMs.
This should be fixed and improved.  
  
Version-Release number of selected component (if applicable):
3.6.2-0.1.el6

How reproducible:
100

Steps to Reproduce:
1. Detach 1 network from 1 VM while it being used by the VM
2. Detach 2 networks from 1 VM while it being used by the VM
3. Detach 2 networks from 2 VMs while it being used by the VMs

Actual results:
1 - Error message is OK
2 - Sentence starts with "The following VMs" instead of "The following Logical Network/s"
Each network name gets it's own line in the error. 
3 - Sentence starts with "The following VMs" instead of "The following Logical Network/s" 
Each network and VM name gets it's own line in the error.

The more networks and VMs you will have, the more lines will appear in the error message. 

The same will be shown in the engine.log.

2015-12-27 15:28:47,062 WARN  [org.ovirt.engine.core.bll.network.host.HostSetupNetworksCommand] (ajp-/127.0.0.1:8702-9) [b3166bf] CanDoAction of action 'HostSetupNetworks' failed for user admin@internal. Reasons: VAR__ACTION__SETUP,VAR__TYPE__NETWORKS,MULTIPLE_NETWORKS_CANNOT_DETACH_NETWORKS_USED_BY_VMS,$networkNames  net-1,
        qosvlan2,$networkNames_COUNTER 2,$vmNames       v2,
        v3,
        v4,$vmNames_COUNTER 3

Expected results:
All of this should be improved and fixed. There should be consistency between single network/VM and multiple networks/VMs.

Comment 1 Edward Haas 2016-03-20 11:09:47 UTC
Is this format acceptable: (?)

Cannot setup Networks. The following Logical Network(s): ' vmnet0' are being used by the following VM(s): ' VM0' . Please stop the VM(s) and try again.

Cannot setup Networks. The following Logical Network(s): ' vmnet0, vmnet1' are being used by the following VM(s): ' VM0' . Please stop the VM(s) and try again.

Cannot setup Networks. The following Logical Network(s): ' vmnet0, vmnet1' are being used by the following VM(s): ' VM0, VM1' . Please stop the VM(s) and try again.

Comment 2 Michael Burman 2016-03-20 11:36:29 UTC
Yes, indeed)

Comment 3 Sandro Bonazzola 2016-05-02 09:49:00 UTC
Moving from 4.0 alpha to 4.0 beta since 4.0 alpha has been already released and bug is not ON_QA.

Comment 4 Yaniv Lavi 2016-05-23 13:13:37 UTC
oVirt 4.0 beta has been released, moving to RC milestone.

Comment 5 Dan Kenigsberg 2016-12-19 08:48:29 UTC
It has been fixed and merged long ago.

Comment 6 Michael Burman 2016-12-19 12:33:03 UTC
Verified on - 4.1.0-0.2.master.20161214234138.gitc23fdcc.el7.centos

"Cannot setup Networks. The following Logical Network: ' n1' is being used by the following VM(s): ' ro2, ro1, ro3' . Please stop the VM(s) and try again."