Reflect display password changes in status.
This commit is contained in:
parent
9209ba0078
commit
383d1c5cca
4 changed files with 69 additions and 0 deletions
|
|
@ -1411,6 +1411,11 @@ spec:
|
||||||
Amount of memory in use.
|
Amount of memory in use.
|
||||||
type: string
|
type: string
|
||||||
default: "0"
|
default: "0"
|
||||||
|
displayPasswordSerial:
|
||||||
|
description: >-
|
||||||
|
Counts changes of the display password.
|
||||||
|
type: integer
|
||||||
|
default: 0
|
||||||
conditions:
|
conditions:
|
||||||
description: >-
|
description: >-
|
||||||
List of component conditions observed
|
List of component conditions observed
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ import org.jdrupes.vmoperator.common.K8sDynamicModel;
|
||||||
import org.jdrupes.vmoperator.common.K8sDynamicStub;
|
import org.jdrupes.vmoperator.common.K8sDynamicStub;
|
||||||
import org.jdrupes.vmoperator.runner.qemu.events.BalloonChangeEvent;
|
import org.jdrupes.vmoperator.runner.qemu.events.BalloonChangeEvent;
|
||||||
import org.jdrupes.vmoperator.runner.qemu.events.ConfigureQemu;
|
import org.jdrupes.vmoperator.runner.qemu.events.ConfigureQemu;
|
||||||
|
import org.jdrupes.vmoperator.runner.qemu.events.DisplayPasswordChanged;
|
||||||
import org.jdrupes.vmoperator.runner.qemu.events.Exit;
|
import org.jdrupes.vmoperator.runner.qemu.events.Exit;
|
||||||
import org.jdrupes.vmoperator.runner.qemu.events.HotpluggableCpuStatus;
|
import org.jdrupes.vmoperator.runner.qemu.events.HotpluggableCpuStatus;
|
||||||
import org.jdrupes.vmoperator.runner.qemu.events.RunnerStateChange;
|
import org.jdrupes.vmoperator.runner.qemu.events.RunnerStateChange;
|
||||||
|
|
@ -321,6 +322,26 @@ public class StatusUpdater extends Component {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On ballon change.
|
||||||
|
*
|
||||||
|
* @param event the event
|
||||||
|
* @throws ApiException
|
||||||
|
*/
|
||||||
|
@Handler
|
||||||
|
public void onDisplayPasswordChanged(DisplayPasswordChanged event)
|
||||||
|
throws ApiException {
|
||||||
|
if (vmStub == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
vmStub.updateStatus(from -> {
|
||||||
|
JsonObject status = from.status();
|
||||||
|
status.addProperty("displayPasswordSerial",
|
||||||
|
status.get("displayPasswordSerial").getAsLong() + 1);
|
||||||
|
return status;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On shutdown.
|
* On shutdown.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* VM-Operator
|
||||||
|
* Copyright (C) 2024 Michael N. Lipp
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jdrupes.vmoperator.runner.qemu.events;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
import org.jdrupes.vmoperator.runner.qemu.commands.QmpCommand;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link MonitorResult} that indicates that the display password has changed.
|
||||||
|
*/
|
||||||
|
public class DisplayPasswordChanged extends MonitorResult {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new display password changed.
|
||||||
|
*
|
||||||
|
* @param command the command
|
||||||
|
* @param response the response
|
||||||
|
*/
|
||||||
|
public DisplayPasswordChanged(QmpCommand command, JsonNode response) {
|
||||||
|
super(command, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -25,6 +25,7 @@ import org.jdrupes.vmoperator.runner.qemu.commands.QmpCapabilities;
|
||||||
import org.jdrupes.vmoperator.runner.qemu.commands.QmpCommand;
|
import org.jdrupes.vmoperator.runner.qemu.commands.QmpCommand;
|
||||||
import org.jdrupes.vmoperator.runner.qemu.commands.QmpDelCpu;
|
import org.jdrupes.vmoperator.runner.qemu.commands.QmpDelCpu;
|
||||||
import org.jdrupes.vmoperator.runner.qemu.commands.QmpQueryHotpluggableCpus;
|
import org.jdrupes.vmoperator.runner.qemu.commands.QmpQueryHotpluggableCpus;
|
||||||
|
import org.jdrupes.vmoperator.runner.qemu.commands.QmpSetDisplayPassword;
|
||||||
import org.jgrapes.core.Channel;
|
import org.jgrapes.core.Channel;
|
||||||
import org.jgrapes.core.Components;
|
import org.jgrapes.core.Components;
|
||||||
import org.jgrapes.core.Event;
|
import org.jgrapes.core.Event;
|
||||||
|
|
@ -57,6 +58,9 @@ public class MonitorResult extends Event<Void> {
|
||||||
if (command instanceof QmpDelCpu) {
|
if (command instanceof QmpDelCpu) {
|
||||||
return new CpuDeleted(command, response);
|
return new CpuDeleted(command, response);
|
||||||
}
|
}
|
||||||
|
if (command instanceof QmpSetDisplayPassword) {
|
||||||
|
return new DisplayPasswordChanged(command, response);
|
||||||
|
}
|
||||||
return new MonitorResult(command, response);
|
return new MonitorResult(command, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue