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

core: update cpuTopology on status changes #525

Merged
merged 1 commit into from Jul 25, 2022

Conversation

ljelinkova
Copy link
Collaborator

@ljelinkova ljelinkova commented Jul 13, 2022

Previously, once the CPU topology was initialized in the VdsManager, it was not possible to change it without
restarting the engine. There are 2 use cases:

  1. When adding a new host, the manager is created, but no CPU topology has been reported yet. As a result, the host
    would act as if it does not support exclusive pinning until the engine is restarted.
  2. Changing the CPU topology of the host (not a common scenario, but happens during development when using hosts in a virtual machine).

This patch updates the CPU topology in the VmManager if the state of the host changes and the CPU topology has not been initialized yet.

Bug-Url: https://bugzilla.redhat.com/2104858

Comment on lines 531 to 532
if (cachedVds.getDynamicData().getStatus() == VDSStatus.Maintenance) {
cpuTopology = new ArrayList<>();
Copy link
Member

@liranr23 liranr23 Jul 13, 2022

Choose a reason for hiding this comment

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

This probably should part of InitVdsOnUpCommand, where the host switch from maintenance to UP without clearing it out, just recalling initAvailableCpus().

Copy link
Member

Choose a reason for hiding this comment

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

Since it is just update of VdsManager fields, I would rather put it into VdsManager.setStatus().

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This probably should part of InitVdsOnUpCommand, where the VM switch from maintenance to UP without clearing it out, just recalling initAvailableCpus().

I would prefer to keep the logic inside the VdsManager, The cpuTopology field is internal to VdsManager, it makes sense that it is initialized and handled here - there is no need for the outside world to know about it.

The field is cleared to make sure that it is not accidentally overwritten - e.g. when the host is non responsive but still runs the VMs and then it is set to UP state again.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Since it is just update of VdsManager fields, I would rather put it into VdsManager.setStatus().

If we updated only when setting the status, the cachedVds might not have the cpuTopology initialized yet. So I added it also to the refresh() method that updates the cachedVds.

@@ -294,6 +294,7 @@ public void refreshImpl() {
setIsSetNonOperationalExecuted(false);
synchronized (this) {
refreshCachedVds();
updateCpuTopology();
Copy link
Member

Choose a reason for hiding this comment

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

we call here the cpuTopology update and within we use cachedVds, but based on 2 lines below it may be null.

Copy link
Member

Choose a reason for hiding this comment

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

+1

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

you're right, I've updated the patch

Previously, once the CPU topology was initialized in
the VdsManager, it was not possible to change it without
the restart of the engine. There are 2 use cases:

1. When adding a new host, the manager is created, but no
CPU topology has been reported yet. As a result, the host
would act as if it does not support exclusive pinning until
the engine is restarted.
2. Changing the CPU topology of the host (not a common scenario,
but happens during development when using hosts in a virtual machine).

This patch updates the CPU topology in the VmManager if the state
of the host changes and the CPU topology has not been initialized yet.

Bug-Url: https://bugzilla.redhat.com/2104858
@ljelinkova
Copy link
Collaborator Author

/ost

@ahadas ahadas merged commit 43926a8 into oVirt:master Jul 25, 2022
@ljelinkova ljelinkova deleted the initialize-cpu-topology branch August 10, 2022 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants