Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieve current graphic consoles #1420

Merged
merged 7 commits into from Jun 17, 2021
Merged

Retrieve current graphic consoles #1420

merged 7 commits into from Jun 17, 2021

Conversation

rszwajko
Copy link
Member

@rszwajko rszwajko commented Apr 28, 2021

This PR depends on patch: https://gerrit.ovirt.org/c/ovirt-engine/+/114302 and fixes bug: https://bugzilla.redhat.com/1940766

  1. use detail=current_graphics_consoles to retrieve the list of
    available consoles (for active VMs only)
  2. remove AutoSelect
  3. use ClientModeConsoleDefault to set console priorities

Screenshot (VNC console has the highest priority):
console_current

Copy link
Member

@sjd78 sjd78 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok, just a few questions before approving


yield put(setVmConsoles({ vmId, consolesList: consoles, selectedConsole }))
}
// for headless VM (no graphics_consoles defined) - API response is `{}`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this saga, fetchConsoles, necessary anymore?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can remove it

const hasRdp = isWindows(vm.getIn(['os', 'type']))
const defaultConsole = vm.get('defaultConsole')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the defaultConsole being stored with the VM this way because you intend to make it user configurable in future?

Otherwise, it seems unnecessary to keep the system defaultConsole stored in the VM when it can just be accessed in config.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the defaultConsole being stored with the VM this way because you intend to make it user configurable in future?

Yep. Per VM settings are the next step here.

Copy link
Member

@sjd78 sjd78 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes LGTM. Hopefully the restapi patch can be progressed soon.

Question - and I didn't test this scenario - what happens if this change runs on an engine without the patch? Is the console functionality lost completely? If yes, we should probably put a more specific backend version check at login to ensure things are going to work.

@rszwajko
Copy link
Member Author

Question - and I didn't test this scenario - what happens if this change runs on an engine without the patch? Is the console functionality lost completely?

Yes, there will be no consoles on the dashboard. We could use follow=graphics_consoles&current to address this scenario - if the engine supports the new detail then it will ignore follow. Old engine will ignore the detail and return follow. The current flag makes it 2x faster then follow alone.

@rszwajko
Copy link
Member Author

@sjd78
The backward compatibility option (follow=graphics_consoles&current) depends on features in patch https://gerrit.ovirt.org/c/ovirt-engine/+/114302
Until the patch is merged I would wait with implementing them in the UI.

@rszwajko rszwajko force-pushed the consoles branch 2 times, most recently from 29a9f48 to 0dd32bd Compare May 13, 2021 13:25
1. use detail=current_graphics_consoles to retrieve the list of
   available consoles (for active VMs only)
2. remove AutoSelect
3. use ClientModeConsoleDefault to set console priorities
4. use additional `current` flag when fetching VM details to retrieve
   graphic consoles info from vm_dynamic. This is ~2x faster
   then standard `follow=graphics_consoles.
5. for backward compatibility use `follow=graphics_consoles&current'
   when (shallow) fetching multiple VMs. If the new detail is supported
   by the server then those params will be ignored.
@rszwajko
Copy link
Member Author

Changes:

  1. use additional current flag when fetching VM details to retrieve
    graphic consoles info from vm_dynamic. This is ~2x faster
    then standard follow=graphics_consoles.
  2. for backward compatibility use follow=graphics_consoles&current
    when (shallow) fetching multiple VMs. If the new detail is supported
    by the server then those params will be ignored.

@rszwajko rszwajko requested a review from sjd78 May 13, 2021 13:49
Copy link
Member

@sjd78 sjd78 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The backward compatibility works. I verified against a 4.4.5 engine.

Code LGTM

@sjd78 sjd78 added the Status: ON_QA status ON_QA (currently being tested) label May 17, 2021
@sgratch sgratch removed the Status: ON_QA status ON_QA (currently being tested) label Jun 2, 2021
Copy link
Member

@sgratch sgratch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rszwajko
The changes look good and working well except the following:

  • For headless Win based VMs, the RDP option is dismissed for both dashboard and VM details views.
  • The ClientModeVncDefault config parameter is ignored for setting the default console, i.e. in case ClientModeVncDefault is set to NoVnc and ClientModeConsoleDefault is set to vnc or the VM supports only vnc, then the 'VNC console browser' option should be set as a default on dashboard (this is how it behaves on webadmin as well).
  • For both new engine and backward compatibility for old engines:
    It seems that using the vm_dynamic is faster, but we still need to be sure that using ?follow=graphics_consoles&current or the new detail=current_graphics_consoles on dashboard won't re-generate bug https://bugzilla.redhat.com/show_bug.cgi?id=1795457 as was when using ?follow=graphics_consoles. This bug was the whole motivation for the original fix. When checking the code, it seems ok but I can't be sure since we don't know where the sql query: select * from getdisksvmguid is actually generated by the follow=graphics_consoles call.
    I suggest asking the performance QE team to verify before marking the BZ as modified. Unless we can verify that in the code.

Introduce clear separation between console protocols (VNC, Spice, RDP)
and consoles visible in the UI (BrowserVnc, NativeVnc, Spice, RDP).
Changes:
 1. use defaultUiConsole - a read-only config value derived from
    defaultConsole and defaultVncMode
 2. remove defaultConsole field from the VM and instead directly check
    the current defaultUiConsole config value
@rszwajko
Copy link
Member Author

rszwajko commented Jun 7, 2021

For headless Win based VMs, the RDP option is dismissed for both dashboard and VM details views.

It's not a regression. This fix was introduced in 148f731

The ClientModeVncDefault config parameter is ignored for setting the default console, i.e. in case ClientModeVncDefault is set to NoVnc and ClientModeConsoleDefault is set to vnc or the VM supports only vnc, then the 'VNC console browser' option should be set as a default on dashboard (this is how it behaves on webadmin as well).

Fixed by introducing a clear separation between protocols and UI consoles available for the end user. The source of the confusion was that VNC protocol maps into 2 UI consoles.

I suggest asking the performance QE team to verify before marking the BZ as modified. Unless we can verify that in the code.

OK. The approach seems safe to me as it is used by Web Admin (with comparable number of VMs). However we could do more research on this.

@rszwajko rszwajko requested a review from sgratch June 7, 2021 11:42
sgratch
sgratch previously requested changes Jun 7, 2021
Copy link
Member

@sgratch sgratch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a regression. This fix was introduced in 148f731

Based on webadmin and from current design aspect, we don't really support an option to disable RDP since RDP is always enabled for win vms, even headless ones.
We did miss that for older versions and added this functionality back on #1342.
So if we want to be compatible with webadmin, we need to add this.
Nevertheless since it was not supported till 1.6.8, it's ok for me to leave it as is until someone will complain. Not that important.

let consoles = []

consoles = vm.get('consoles').map((c) => ({
priority: 0,
protocol: c.get('protocol'),
uiConsole: toUiConsole(NATIVE, c.get('protocol')),
Copy link
Member

@sgratch sgratch Jun 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem correct to me. I think that in case Spice is not supported and vnc is supported then the default ui conosle type should be based on ClientModeVncDefault as well, i.e in case noVnc is supported then this should be the default.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current code provides the requested functionality.

Note that we always support both VNC flavors if VNC protocol is present:

  1. NoVnc is added when vncConsole flag is ttrue.
  2. The Native VNC is added by directly mapping the list of available protocols (that's why toUiConsole() is used with first parameter set to NATIVE).

This logic was inherited from previous versions.

Copy link
Member

@sgratch sgratch Jun 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rszwajko the issue raised here is regarding the default console displayed for the VM card in case that the defaultConsole is not supported by that VM.

For reproducing:
set ClientModeConsoleDefault=spice, ClientModeVncDefault=NoVnc and set the VM to support only VNC.

Expected result: the default option should be BrowserVnc.
Actual result: the default option is VNC.
This seems like not supported by the current code but it was supported by the previous version and by webadmin.

We did miss that for older versions and added this functionality back on #1342.
So if we want to be compatible with webadmin, we need to add this.
Nevertheless since it was not supported till 1.6.8, it's ok for me to leave it as is until someone will complain. Not that important.

We can fix it under separate issue.

Sure, please open a separate issue for this

Copy link
Member Author

@rszwajko rszwajko Jun 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rszwajko the issue raised here is regarding the default console displayed for the VM card in case that the defaultConsole is not supported by that VM.

For reproducing:
set ClientModeConsoleDefault=spice, ClientModeVncDefault=NoVnc and set the VM to support only VNC.
Expected result: the default option should be BrowserVnc.
Actual result: the default option is VNC.
This seems like not supported by the current code but it was supported by the previous version and by webadmin.

OK. I understand the use case now. However I'm not sure if it applies to the current design. Previous version and Web Admin provide a single button with black-box style logic (no indication what console will be chosen by the algorithm).
In the new design it's transparent to the user:

  1. all available consoles are visible (the default console goes first)
  2. the default global console send from the server (server's default console) is displayed in Account Settings (see below - feature available soon). Due to that there is only one such default (we don't have secondary default for cases like ClientModeConsoleDefault=spice, ClientModeVncDefault=NoVnc )
  3. user can override(completely) the server's default by setting a preferred console in Account Settings (available soon). Once again it's only one value (a limitation of SelectBox UI).
  4. user can override the global console by setting per VM value (available in the next phase)

The goal is to have the logic here simple and transparent that's why only 2 levels are used:

  1. global - either server's default console or console set by the user in Account Settings
  2. per VM (next phase)

If the default is not supported by the given VM (for any reason) then consoles are displayed in default order (as before). Of course we could provide fallback but things will get complex i.e. imagine the case where:

  1. ClientModeConsoleDefault=spice, ClientModeVncDefault=NoVnc
  2. preferred console is RDP
  3. VM is Linux with VNC only

I'm not convinced if the added value justifies the complexity:)

image

export const SPICE = 'spice'
export const RDP = 'rdp'

// VNC modes sent from the backend (ClientConsoleMode)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ClientConsoleMode -> ClientModeVncDefault ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was referring to VncConsoleModel.ClientConsoleMode enum but referring to config property is better.

@rszwajko
Copy link
Member Author

rszwajko commented Jun 7, 2021

It's not a regression. This fix was introduced in 148f731

Based on webadmin and from current design aspect, we don't really support an option to disable RDP since RDP is always enabled for win vms, even headless ones.
We did miss that for older versions and added this functionality back on #1342.
So if we want to be compatible with webadmin, we need to add this.
Nevertheless since it was not supported till 1.6.8, it's ok for me to leave it as is until someone will complain. Not that important.

We can fix it under separate issue.

@sgratch
Copy link
Member

sgratch commented Jun 10, 2021

@rszwajko
I agree with all you wrote above regarding the design, except the specific scenario of which the user specifically sets the Vnc mode to noVnc (ClientModeVncDefault=noVnc) and only VNC console type is supported for that VM.
This case is currently working for webadmin and I think that it should work the same for web-ui if we support a default console now.

Previous version and Web Admin provide a single button with black-box style logic (no indication what console will be chosen by the algorithm).

Not accurate. On webadmin you can currently choose the actual console type per VM ,but the default console (console button) is based on two things: the supported consoles and the global config ClientModeVncDefault value. So in case the user sets ClientModeVncDefault=noVnc and if vnc is the only client supported for a VM, this will be the auto default console opened while clicking on console button via webadmin.

Due to that there is only one such default (we don't have secondary default for cases like ClientModeConsoleDefault=spice, ClientModeVncDefault=NoVnc )

We don't need to support a secondary default. But in a very specific case in which:

  1. the VM is configured to run with only VNC console type
  2. ClientModeVncDefault=noVnc
  3. for the new console options settings: the global default is not RDP for Win VMs or VNC)

=> then the default console which appears as the first on list should be noVnc and not VNC.

Of course we could provide fallback but things will get complex i.e. imagine the case where:

ClientModeConsoleDefault=spice, ClientModeVncDefault=NoVnc
preferred console is RDP
VM is Linux with VNC only

in that case, the default should be NoVnc and not VNC.
The same goes If VM is Linux with Spice only then Spice should be the default even if ClientModeConsoleDefault=vnc, ClientModeVncDefault=NoVnc and preferred console is RDP.

We can decide to neglect the default console options on web-ui dashboard and just display the consoles in a default fix order as it was up till now. But if we do support default ordering then let's do it compatible to webadmin.
It shouldn't be too complicated to fix for that specific scenario.

@rszwajko
Copy link
Member Author

@sgratch

It shouldn't be too complicated to fix for that specific scenario.

Of course we can address this specific scenario. Please check the newest commit.

@rszwajko rszwajko dismissed sgratch’s stale review June 10, 2021 10:26

Please check the newest code.

@rszwajko rszwajko mentioned this pull request Jun 10, 2021
Copy link
Member

@sgratch sgratch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code now LGTM.
But there are performance test results that still needed to be examined before merging. They are discussed via mails.

@sgratch
Copy link
Member

sgratch commented Jun 14, 2021

@rszwajko please rebase

@sgratch
Copy link
Member

sgratch commented Jun 17, 2021

The performance test results look ok so we can merge the PR.

@sgratch sgratch merged commit 1078cf8 into oVirt:master Jun 17, 2021
@sgratch sgratch added the Status: ON_QA status ON_QA (currently being tested) label Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: ON_QA status ON_QA (currently being tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants