Bug 1683965

Summary: [RFE] Option to create a VM with VNC console and without any USB device
Product: Red Hat Enterprise Virtualization Manager Reporter: nijin ashok <nashok>
Component: ovirt-engineAssignee: Tomasz BaraƄski <tbaransk>
Status: CLOSED ERRATA QA Contact: Liran Rotenberg <lrotenbe>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.2.8CC: mavital, michal.skrivanek, myllynen, nashok, rbarry, Rhev-m-bugs, sgratch
Target Milestone: ovirt-4.3.5Keywords: FutureFeature, ZStream
Target Release: 4.3.5Flags: lrotenbe: testing_plan_complete+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: ovirt-engine-4.3.5.1 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-12 11:53:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Virt RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description nijin ashok 2019-02-28 08:18:49 UTC
Description of problem:

Currently, even if we disable the USB from RHV portal, it will create a USB controller as per the change in https://gerrit.ovirt.org/#/c/68399/. So the only way to disable the USB is to edit the osinfo or create a new OS by setting "devices.usb.controller.value = none". However, if we add the VNC console to the VM, it will automatically add a "tablet" device. Since there is no USB controller it will fail with error "unsupported configuration: Can't add USB input device. USB bus is disabled". So currently there is no way to have a VM without any USB devices *at all* with VNC enabled (other than using vdsm hooks). This was solved in "High Performance" VM recently as per https://gerrit.ovirt.org/#/c/83615/. However, it's not possible to create VMs with VNC and without tablet device other than with a VDSM hook.


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

RHV 4.2.8

Actual results:

No option to create a VM with VNC console and without any USB device

Expected results:

Should be able to create a VM with VNC console and without any USB device.

Additional info:

Comment 2 Michal Skrivanek 2019-03-01 07:37:23 UTC
isn't it enough to use serial console for troubleshooting?

Comment 3 Michal Skrivanek 2019-03-01 07:41:11 UTC
Sharon, looking at the code it looks wrong. Why does VmInfoBuildUtils::isTabletEnabled() checking vm.getGraphicsInfos().size() == 1 ? We now default to SPICE+VNC and so you do NOT add tablet in that case and I can confirm that in that case the VNC is unusable. This function should easily check for ostinfo USB controller instead, and that would solve this bug too

Comment 4 Sharon Gratch 2019-03-04 09:46:49 UTC
(In reply to Michal Skrivanek from comment #3)
> Sharon, looking at the code it looks wrong. Why does
> VmInfoBuildUtils::isTabletEnabled() checking vm.getGraphicsInfos().size() ==
> 1 ? We now default to SPICE+VNC and so you do NOT add tablet in that case
> and I can confirm that in that case the VNC is unusable. This function
> should easily check for ostinfo USB controller instead, and that would solve
> this bug too

The reason for checking VNC existence only (without SPICE) in VmInfoBuildUtils::isTabletEnabled() is since this was the original code before handling high performance and adding domain xml builder support -  Please see [1].
I only verified that it's not HP vm in that code and didn't touch the graphics checking- see [2].
In 4.1 the tablet device was added only for VNC (without SPICE). Isn't that the case?


[1] https://github.com/oVirt/ovirt-engine/blob/f6fe42e82bfb06297811989bbfb712174f5daa29/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/builder/vminfo/VmInfoBuilderImpl.java#L687

[2] https://gerrit.ovirt.org/#/c/83615/


Once you added a tablet, it shouldn't use USB. All USB devices logic is done today at VmDeviceUtils::updateUsbSlots(). So we can leave it there and set osinfo to "none" and just check in VmInfoBuildUtils::isTabletEnabled() if model is set to "none" and then treats it the same as HP vms....

Comment 9 Liran Rotenberg 2019-07-07 07:49:20 UTC
Verified on:
ovirt-engine-4.3.5.3-0.1.el7.noarch

Steps:
1. Create a new OS profile:
- Create a new file in /etc/ovirt-engine/osinfo.conf.d called for example: 01-new-properties.
- In the file enter the new OS details:
os.new_os_name.id.value = <ID_NUMBER>
os.new_os_name.name.value = <NAME>
os.new_os_name.derivedFrom.value = other
os.new_os_name.devices.usb.controller.value = none

Where ID_NUMBER should be unique to the defults in 00-defaults.properties, NAME should be the new profile name.

2. Restart the engine:
$ service ovirt-engine restart

3. Create a new VM, set the OS to the <NAME>.
4. Set console to VNC.
5. Check for tablet/usb devices (virsh -r dumpxml <vm>)
6. Run the VM and open console.

Results:
The VM was created successfully with the new profile and VNC.
In step 5, only one USB device is shown: <controller type='usb' index='0' model='none'>
model='none' is disabled USB.
tablet doesn't exist.
Running the VM succeed, VNC and NoVNC console works.

Comment 10 Marko Myllynen 2019-07-09 06:45:51 UTC
> In step 5, only one USB device is shown: <controller type='usb' index='0' model='none'>

Please note that this RFE was about creating a VM without *any* USB devices, this sounds like the USB controller still exists? Thanks.

Comment 11 Liran Rotenberg 2019-07-09 07:02:06 UTC
(In reply to Marko Myllynen from comment #10)
> > In step 5, only one USB device is shown: <controller type='usb' index='0' model='none'>
> 
> Please note that this RFE was about creating a VM without *any* USB devices,
> this sounds like the USB controller still exists? Thanks.

In https://libvirt.org/formatdomain.html#elementsControllers , under usb:

"Additionally, since 0.10.0, if the USB bus needs to be explicitly disabled for the guest, model='none' may be used."

So it seems to be the right behavior, Libvirt has similar thing when handling video devices - if we don't want a video device, we need to add a device with type 'none', otherwise libvirt inserts a default device. 

Bottom line, we need it for video device, but we set it to be explicitly disabled.

If i'm mistaken, Tomasz can maybe provide more information.

Comment 12 Marko Myllynen 2019-07-09 07:05:10 UTC
Right, thanks for pointing this out, so if the guest kernel does not see any USB devices then all should be good.

Comment 14 errata-xmlrpc 2019-08-12 11:53:27 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://access.redhat.com/errata/RHEA-2019:2431