Merge branch 'feature/pools'

This commit is contained in:
Michael Lipp 2025-03-06 14:44:41 +01:00
commit 3557e5fc27
14 changed files with 1022 additions and 74 deletions

View file

@ -1,4 +1,4 @@
# See https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml # See [rules](https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml)
# Default state for all rules # Default state for all rules
default: true default: true
@ -27,12 +27,4 @@ MD036: false
# MD043/required-headings : Required heading structure : # MD043/required-headings : Required heading structure :
# https://github.com/DavidAnson/markdownlint/blob/v0.37.4/doc/md043.md # https://github.com/DavidAnson/markdownlint/blob/v0.37.4/doc/md043.md
MD043: MD043: false
# List of headings
headings: [
"# Head",
"## Item",
"### Detail"
]
# Match case of headings
match_case: false

View file

@ -62,7 +62,7 @@ public class K8sDynamicModelsBase<T extends K8sDynamicModel>
} catch (InstantiationException | IllegalAccessException } catch (InstantiationException | IllegalAccessException
| IllegalArgumentException | InvocationTargetException | IllegalArgumentException | InvocationTargetException
| NoSuchMethodException | SecurityException exc) { | NoSuchMethodException | SecurityException exc) {
throw new IllegalArgumentException(exc); throw new IllegalArgumentException(exc); // NOPMD
} }
} }
} }

View file

@ -192,7 +192,7 @@ import org.jgrapes.util.events.WatchFile;
*/ */
@SuppressWarnings({ "PMD.ExcessiveImports", "PMD.AvoidPrintStackTrace", @SuppressWarnings({ "PMD.ExcessiveImports", "PMD.AvoidPrintStackTrace",
"PMD.DataflowAnomalyAnalysis", "PMD.TooManyMethods", "PMD.DataflowAnomalyAnalysis", "PMD.TooManyMethods",
"PMD.CouplingBetweenObjects" }) "PMD.CouplingBetweenObjects", "PMD.TooManyFields" })
public class Runner extends Component { public class Runner extends Component {
private static final String QEMU = "qemu"; private static final String QEMU = "qemu";

View file

@ -18,6 +18,7 @@
package org.jdrupes.vmoperator.util; package org.jdrupes.vmoperator.util;
import java.lang.reflect.Array;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
@ -157,11 +158,12 @@ public final class DataPath {
return (T) copy; return (T) copy;
} }
if (object.getClass().isArray()) { if (object.getClass().isArray()) {
var copy = new ArrayList<>(); var copy = Array.newInstance(object.getClass().getComponentType(),
for (var item : (Object[]) object) { Array.getLength(object));
copy.add(deepCopy(item)); for (int i = 0; i < Array.getLength(object); i++) {
Array.set(copy, i, deepCopy(Array.get(object, i)));
} }
return (T) copy.toArray(); return (T) copy;
} }
if (object instanceof Cloneable) { if (object instanceof Cloneable) {
try { try {

View file

@ -0,0 +1,17 @@
package org.jdrupes.vmoperator.util;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
class DataPathTests {
@Test
void testArray() {
int[] orig
= { Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3) };
var copy = DataPath.deepCopy(orig);
for (int i = 0; i < orig.length; i++) {
assertEquals(orig[i], copy[i]);
}
}
}

1003
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -7,6 +7,7 @@
"documentation": "^14.0.1", "documentation": "^14.0.1",
"install": "^0.13.0", "install": "^0.13.0",
"jsdoc": "^4.0.2", "jsdoc": "^4.0.2",
"markdownlint": "^0.37.4",
"node-sass": "^9.0.0", "node-sass": "^9.0.0",
"npm": "^8.11.0", "npm": "^8.11.0",
"rollup": "^4.1.5", "rollup": "^4.1.5",
@ -22,8 +23,8 @@
"typescript": "^5.2.2" "typescript": "^5.2.2"
}, },
"overrides": { "overrides": {
"node-gyp": "^10.1.0", "node-gyp": "^10.1.0",
"glob": "^9.0.0" "glob": "^9.0.0"
}, },
"eslintConfig": { "eslintConfig": {
"root": true, "root": true,
@ -34,5 +35,8 @@
}, },
"eslintIgnore": [ "eslintIgnore": [
"node_modules/**" "node_modules/**"
] ],
"dependencies": {
"markdownlint-cli": "^0.44.0"
}
} }

View file

@ -19,4 +19,3 @@ the VMs and adjust the CPU and RAM usages (modifies the definition
in kubernetes). in kubernetes).
![VM-Operator GUI](VM-Operator-GUI-view.png) ![VM-Operator GUI](VM-Operator-GUI-view.png)

View file

@ -27,6 +27,7 @@ If you just want to try out things, you can skip the remainder of this
page and proceed to "[the manager](manager.html)". page and proceed to "[the manager](manager.html)".
## Motivation ## Motivation
The project was triggered by a remark in the discussion about RedHat The project was triggered by a remark in the discussion about RedHat
[dropping SPICE support](https://bugzilla.redhat.com/show_bug.cgi?id=2030592) [dropping SPICE support](https://bugzilla.redhat.com/show_bug.cgi?id=2030592)
from the RHEL packages. Which means that you have to run Qemu in a from the RHEL packages. Which means that you have to run Qemu in a
@ -55,9 +56,11 @@ close to simply deploying the pod (you get the restart and some PVC
management "for free"). management "for free").
A second look, however, reveals that Kubernetes has more to offer. A second look, however, reveals that Kubernetes has more to offer.
* It has a well defined API for managing resources.
* It provides access to different kinds of managed storage for the VMs. * It has a well defined API for managing resources.
* Its managing features *are* useful for running the component that * It provides access to different kinds of managed storage for the VMs.
* Its managing features *are* useful for running the component that
manages the pods with the VMs. manages the pods with the VMs.
And if you use Kubernetes anyway, well then the VMs within Kubernetes And if you use Kubernetes anyway, well then the VMs within Kubernetes

View file

@ -40,7 +40,8 @@ default files for creating these resources using the default namespace
can be found in the can be found in the
[deploy](https://github.com/mnlipp/VM-Operator/tree/main/deploy) [deploy](https://github.com/mnlipp/VM-Operator/tree/main/deploy)
directory. I recommend to use directory. I recommend to use
[kustomize](https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/) to create your own configuration. [kustomize](https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/)
to create your own configuration.
## Initial Configuration ## Initial Configuration

View file

@ -44,9 +44,9 @@ A sample configuration file with annotated options can be found
As the runner implementation uses the As the runner implementation uses the
[JGrapes](https://jgrapes.org/) framework, the file [JGrapes](https://jgrapes.org/) framework, the file
follows the framework's follows the framework's
[conventions](https://jgrapes.org/latest-release/javadoc/org/jgrapes/util/YamlConfigurationStore.html). The top level "`/Runner`" selects [conventions](https://jgrapes.org/latest-release/javadoc/org/jgrapes/util/YamlConfigurationStore.html).
the component to be configured. Nested within is the information The top level "`/Runner`" selects the component to be configured. Nested
to be applied to the component. within is the information to be applied to the component.
The main entries in the configuration file are the "template" and The main entries in the configuration file are the "template" and
the "vm" information. The runner processes the the "vm" information. The runner processes the
@ -58,8 +58,8 @@ defines a particular VM type, i.e. it contains the "nasty details"
that do not need to be modified for some given set of VM instances. that do not need to be modified for some given set of VM instances.
The templates provided with the runner can be found The templates provided with the runner can be found
[here](https://github.com/mnlipp/VM-Operator/tree/main/org.jdrupes.vmoperator.runner.qemu/templates). When details [here](https://github.com/mnlipp/VM-Operator/tree/main/org.jdrupes.vmoperator.runner.qemu/templates).
of the VM configuration need modification, a new VM type When details of the VM configuration need modification, a new VM type
(i.e. a new template) has to be defined. Authoring a new (i.e. a new template) has to be defined. Authoring a new
template requires some knowledge about the template requires some knowledge about the
[qemu invocation](https://www.qemu.org/docs/master/system/invocation.html). [qemu invocation](https://www.qemu.org/docs/master/system/invocation.html).
@ -92,7 +92,8 @@ which may be used in a stand-alone development configuration.
The runner supports adaption to changes of the RAM size (using the The runner supports adaption to changes of the RAM size (using the
balloon device) and to changes of the number of CPUs. Note that balloon device) and to changes of the number of CPUs. Note that
in order to get new CPUs online on Linux guests, you need a in order to get new CPUs online on Linux guests, you need a
[udev rule](https://docs.kernel.org/core-api/cpu_hotplug.html#user-space-notification) which is not installed by default[^simplest]. [udev rule](https://docs.kernel.org/core-api/cpu_hotplug.html#user-space-notification)
which is not installed by default[^simplest].
The runner also changes the images loaded in CDROM drives. If the The runner also changes the images loaded in CDROM drives. If the
drive is locked, i.e. if it doesn't respond to the "open tray" command drive is locked, i.e. if it doesn't respond to the "open tray" command
@ -101,7 +102,8 @@ the change will be suspended until the VM opens the tray.
Finally, `powerdownTimeout` can be changed while the qemu process runs. Finally, `powerdownTimeout` can be changed while the qemu process runs.
[^simplest]: The simplest form of the rule is probably: [^simplest]: The simplest form of the rule is probably:
```
```txt
ACTION=="add", SUBSYSTEM=="cpu", ATTR{online}="1" ACTION=="add", SUBSYSTEM=="cpu", ATTR{online}="1"
``` ```

View file

@ -77,7 +77,8 @@ objects that either specify a role or a user.
## Console access ## Console access
Access to the VM's console is implemented by generating a Access to the VM's console is implemented by generating a
[connection file](https://manpages.debian.org/testing/virt-viewer/remote-viewer.1.en.html#CONNECTION_FILE) for virt-viewer when the user clicks on [connection file](https://manpages.debian.org/testing/virt-viewer/remote-viewer.1.en.html#CONNECTION_FILE)
for virt-viewer when the user clicks on
the console icon. If automatic open is enabled for this kind of the console icon. If automatic open is enabled for this kind of
files in the browser, the console opens without further user action. files in the browser, the console opens without further user action.