Description of problem: In case of using rest API with /graphicsconsoles extension, there are cases in which a VM or a Template or an Instance-Type are left with graphic devices without any video device or with video device without any graphic devices. This can happen When using the following REST APIs: DELETE ..api/instancetypes/<instancetype-id>/graphicsconsoles/<console-id> DELETE ..api/templates/<template-id>/graphicsconsoles/<console-id> DELETE ..api/vms/<vm-id>/graphicsconsoles/<console-id> Or: POST ..api/instancetypes/<instancetype-id>/graphicsconsoles POST ..api/templates/<template-id>/graphicsconsoles POST ..api/vms/<vm-id>/graphicsconsoles <graphics_console> <protocol>type</protocol> </graphics_console> Version-Release number of selected component (if applicable): master How reproducible: 100% Steps to Reproduce: For example: 1.run the following API for a VM with QXL,SPICE devices: DELETE ..api/vms/<vm-id>/graphicsconsoles/<console-id of SPICE> Actual results: As a result of this API, the SPICE device is removed but the QXL device still exists. Expected results: In case of no graphic devices, the QXL should be removed and the VM should become headless.
Verify with: Engine: Red Hat Virtualization Manager Version: 4.1.1-0.1.el7 Host: OS Version:RHEL - 7.3 - 7.el7 Kernel Version:3.10.0 - 550.el7.x86_64 KVM Version:2.6.0 - 28.el7_3.3.1 LIBVIRT Version:libvirt-2.0.0-10.el7_3.4 VDSM Version:vdsm-4.19.5-1.el7ev SPICE Version:0.12.4 - 20.el7_3 Steps: Run delete and check that 'Headless Mode' is set: DELETE ..api/instancetypes/<instancetype-id>/graphicsconsoles/<console-id> DELETE ..api/templates/<template-id>/graphicsconsoles/<console-id> DELETE ..api/vms/<vm-id>/graphicsconsoles/<console-id> Run update (with POST) on resource in 'Headless Mode' and check that graphics console is set: POST ..api/instancetypes/<instancetype-id>/graphicsconsoles POST ..api/templates/<template-id>/graphicsconsoles POST ..api/vms/<vm-id>/graphicsconsoles Body: <graphics_console> <protocol>type</protocol> </graphics_console> PASS in all resources