Skip to content

Commit

Permalink
core: update cpuTopology on status changes
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ljelinkova authored and ahadas committed Jul 25, 2022
1 parent f78fa54 commit 43926a8
Showing 1 changed file with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ private void init() {
handlePreviousStatus();
handleSecureSetup();
initVdsBroker();
initAvailableCpus();
updateCpuTopology();
}

public void handleSecureSetup() {
Expand Down Expand Up @@ -300,7 +300,7 @@ public void refreshImpl() {
getVdsName(), getVdsId());
return;
}

updateCpuTopology();
try {
updateIteration();
if (isMonitoringNeeded()) {
Expand Down Expand Up @@ -761,9 +761,11 @@ public void setStatus(VDSStatus status, VDS vds) {
this.cachedVds.setUsageMemPercent(0);
this.cachedVds.setUsageNetworkPercent(0);
}
updateCpuTopology();
break;
case Up:
vds.setInFenceFlow(false);
updateCpuTopology();
break;
default:
break;
Expand Down Expand Up @@ -1331,7 +1333,19 @@ public void updateV2VJobInfos(List<V2VJobInfo> v2vJobInfos) {
}


private void initAvailableCpus() {
private void updateCpuTopology() {

if (!cpuTopology.isEmpty()) {
if (cachedVds.getDynamicData().getStatus() == VDSStatus.Maintenance) {
cpuTopology = new ArrayList<>();
}
return;
}

if (cachedVds.getDynamicData().getStatus() != VDSStatus.Up) {
return;
}

List<VdsCpuUnit> cpuTopology = cachedVds.getCpuTopology();
if (cpuTopology == null) {
return;
Expand Down

0 comments on commit 43926a8

Please sign in to comment.