├── .codacy.yml ├── .editorconfig ├── .eslintrc.json ├── .gitattributes ├── .github └── workflows │ ├── codeql.yml │ ├── gradle.yml │ ├── jekyll.yml │ └── release.yml ├── .gitignore ├── .gitlab-ci.yml ├── .markdownlint.yaml ├── .settings ├── org.eclipse.buildship.core.prefs ├── org.eclipse.core.resources.prefs └── org.eclipse.core.runtime.prefs ├── .vscode ├── launch.json └── settings.json ├── LICENSE ├── README.md ├── VM-Operator.png ├── build.gradle ├── buildSrc ├── .settings │ ├── org.eclipse.buildship.core.prefs │ ├── org.eclipse.core.resources.prefs │ ├── org.eclipse.core.runtime.prefs │ ├── org.eclipse.jdt.core.prefs │ └── org.eclipse.jdt.groovy.core.prefs ├── build.gradle └── src │ ├── org.jdrupes.vmoperator.java-application-conventions.gradle │ ├── org.jdrupes.vmoperator.java-common-conventions.gradle │ ├── org.jdrupes.vmoperator.java-doc-conventions.gradle │ ├── org.jdrupes.vmoperator.java-library-conventions.gradle │ └── org.jdrupes.vmoperator.versioning-conventions.gradle ├── checkstyle.xml ├── deploy ├── crds │ ├── vmpools-crd.yaml │ └── vms-crd.yaml ├── kustomization.yaml ├── vmop-config-map.yaml ├── vmop-deployment.yaml ├── vmop-image-repository-pvc.yaml ├── vmop-role-binding.yaml ├── vmop-role.yaml ├── vmop-service-account.yaml ├── vmop-service.yaml ├── vmrunner-role-binding.yaml ├── vmrunner-role.yaml └── vmrunner-service-account.yaml ├── dev-example ├── .gitignore ├── Readme.md ├── config.yaml ├── gen-pool-vm-crds ├── kustomization.yaml ├── pool-action ├── test-pool.yaml ├── test-vm-display-secret.yaml ├── test-vm-pv-system.yaml ├── test-vm-shell.yaml ├── test-vm-snapshot.yaml ├── test-vm.tpl.yaml ├── test-vm.yaml └── vmop-agent │ ├── 99-vmop-agent.rules │ ├── vmop-agent │ └── vmop-agent.service ├── example ├── local-path │ ├── Readme.md │ ├── kustomization.yaml │ └── test-vm.yaml └── rook-ceph │ ├── Readme.md │ ├── kustomization.yaml │ └── test-vm.yaml ├── gradle.properties ├── gradle ├── org.eclipse.jdt.core.formatter.prefs └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── misc ├── javadoc-overwrites.css ├── javadoc-redirect │ └── index.html └── javadoc.bottom.txt ├── org.jdrupes.vmoperator.common ├── .checkstyle ├── .eclipse-pmd ├── .settings │ ├── net.sf.jautodoc.prefs │ ├── org.eclipse.buildship.core.prefs │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.core.runtime.prefs ├── build.gradle └── src │ └── org │ └── jdrupes │ └── vmoperator │ └── common │ ├── Constants.java │ ├── Convertions.java │ ├── DynamicTypeAdapterFactory.java │ ├── K8s.java │ ├── K8sClient.java │ ├── K8sClusterGenericStub.java │ ├── K8sDynamicModel.java │ ├── K8sDynamicModels.java │ ├── K8sDynamicModelsBase.java │ ├── K8sDynamicStub.java │ ├── K8sDynamicStubBase.java │ ├── K8sGenericStub.java │ ├── K8sObserver.java │ ├── K8sV1ConfigMapStub.java │ ├── K8sV1DeploymentStub.java │ ├── K8sV1NodeStub.java │ ├── K8sV1PodStub.java │ ├── K8sV1PvcStub.java │ ├── K8sV1SecretStub.java │ ├── K8sV1ServiceStub.java │ ├── K8sV1StatefulSetStub.java │ ├── VmDefinition.java │ ├── VmDefinitionStub.java │ ├── VmDefinitions.java │ ├── VmExtraData.java │ ├── VmPool.java │ └── package-info.java ├── org.jdrupes.vmoperator.manager.events ├── .checkstyle ├── .eclipse-pmd ├── .settings │ ├── org.eclipse.buildship.core.prefs │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.core.runtime.prefs ├── build.gradle └── src │ └── org │ └── jdrupes │ └── vmoperator │ └── manager │ └── events │ ├── AssignVm.java │ ├── ChannelDictionary.java │ ├── ChannelManager.java │ ├── ChannelTracker.java │ ├── Exit.java │ ├── GetDisplaySecret.java │ ├── GetPools.java │ ├── GetVms.java │ ├── ModifyVm.java │ ├── PodChanged.java │ ├── ResetVm.java │ ├── UpdateAssignment.java │ ├── VmChannel.java │ ├── VmPoolChanged.java │ ├── VmResourceChanged.java │ └── package-info.java ├── org.jdrupes.vmoperator.manager ├── .checkstyle ├── .eclipse-pmd ├── .gitignore ├── .settings │ ├── net.sf.jautodoc.prefs │ ├── org.eclipse.buildship.core.prefs │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.core.runtime.prefs ├── build.gradle ├── checkstyle.xml ├── resources │ └── org │ │ └── jdrupes │ │ └── vmoperator │ │ └── manager │ │ ├── ManagerIntro-Preview.md │ │ ├── ManagerIntro-Preview_de.md │ │ ├── VM-Operator.png │ │ ├── VM-Operator.svg │ │ ├── console-brand.ftl.html │ │ ├── console-footer.ftl.html │ │ ├── favicon.ico │ │ ├── l10n.properties │ │ ├── l10n_de.properties │ │ ├── logging.properties │ │ ├── runnerConfig.ftl.yaml │ │ ├── runnerDataPvc.ftl.yaml │ │ ├── runnerDiskPvc.ftl.yaml │ │ ├── runnerLoadBalancer.ftl.yaml │ │ └── runnerPod.ftl.yaml ├── src │ └── org │ │ └── jdrupes │ │ └── vmoperator │ │ └── manager │ │ ├── AbstractMonitor.java │ │ ├── AvoidEmptyPolicy.java │ │ ├── ConfigMapReconciler.java │ │ ├── Constants.java │ │ ├── Containerfile │ │ ├── Controller.java │ │ ├── DisplaySecretMonitor.java │ │ ├── DisplaySecretReconciler.java │ │ ├── LoadBalancerReconciler.java │ │ ├── Manager.java │ │ ├── PodMonitor.java │ │ ├── PodReconciler.java │ │ ├── PoolMonitor.java │ │ ├── PvcReconciler.java │ │ ├── Reconciler.java │ │ ├── VmMonitor.java │ │ └── package-info.java ├── test-resources │ ├── basic-vm.yaml │ └── kustomization.yaml └── test │ └── org │ └── jdrupes │ └── vmoperator │ └── manager │ └── BasicTests.java ├── org.jdrupes.vmoperator.runner.qemu ├── .checkstyle ├── .eclipse-pmd ├── .gitignore ├── .settings │ ├── net.sf.jautodoc.prefs │ ├── org.eclipse.buildship.core.prefs │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.core.runtime.prefs ├── build.gradle ├── checkstyle.xml ├── config-sample.yaml ├── display-password ├── helm-test │ ├── .helmignore │ ├── Chart.yaml │ ├── README.md │ ├── templates │ │ ├── _helpers.tpl │ │ ├── etcConfig.yaml │ │ ├── pod.yml │ │ ├── pv.yaml │ │ └── pvc.yaml │ └── values.yaml ├── logging.properties ├── password-expiry ├── resources │ └── org │ │ └── jdrupes │ │ └── vmoperator │ │ └── runner │ │ └── qemu │ │ ├── defaults.yaml │ │ └── logging.properties ├── src │ └── org │ │ └── jdrupes │ │ └── vmoperator │ │ └── runner │ │ └── qemu │ │ ├── AgentConnector.java │ │ ├── CdMediaController.java │ │ ├── CommandDefinition.java │ │ ├── Configuration.java │ │ ├── ConsoleTracker.java │ │ ├── Constants.java │ │ ├── Containerfile.alpine │ │ ├── Containerfile.arch │ │ ├── CpuController.java │ │ ├── DisplayController.java │ │ ├── GuestAgentClient.java │ │ ├── QemuConnector.java │ │ ├── QemuMonitor.java │ │ ├── RamController.java │ │ ├── Runner.java │ │ ├── StatusUpdater.java │ │ ├── VmDefUpdater.java │ │ ├── VmopAgentClient.java │ │ ├── commands │ │ ├── QmpAddCpu.java │ │ ├── QmpCapabilities.java │ │ ├── QmpChangeMedium.java │ │ ├── QmpCommand.java │ │ ├── QmpCont.java │ │ ├── QmpDelCpu.java │ │ ├── QmpGuestGetOsinfo.java │ │ ├── QmpGuestInfo.java │ │ ├── QmpGuestPing.java │ │ ├── QmpGuestPowerdown.java │ │ ├── QmpOpenTray.java │ │ ├── QmpPowerdown.java │ │ ├── QmpQueryHotpluggableCpus.java │ │ ├── QmpRemoveMedium.java │ │ ├── QmpReset.java │ │ ├── QmpSetBalloon.java │ │ ├── QmpSetDisplayPassword.java │ │ ├── QmpSetPasswordExpiry.java │ │ └── package-info.java │ │ ├── events │ │ ├── BalloonChangeEvent.java │ │ ├── ConfigureQemu.java │ │ ├── CpuAdded.java │ │ ├── CpuDeleted.java │ │ ├── DisplayPasswordChanged.java │ │ ├── Exit.java │ │ ├── GuestAgentCommand.java │ │ ├── HotpluggableCpuStatus.java │ │ ├── MonitorCommand.java │ │ ├── MonitorEvent.java │ │ ├── MonitorReady.java │ │ ├── MonitorResult.java │ │ ├── OsinfoEvent.java │ │ ├── PowerdownEvent.java │ │ ├── QmpConfigured.java │ │ ├── RunnerStateChange.java │ │ ├── ShutdownEvent.java │ │ ├── SpiceConnectedEvent.java │ │ ├── SpiceDisconnectedEvent.java │ │ ├── SpiceEvent.java │ │ ├── SpiceInitializedEvent.java │ │ ├── TrayMovedEvent.java │ │ ├── VmopAgentConnected.java │ │ ├── VmopAgentLogIn.java │ │ ├── VmopAgentLogOut.java │ │ ├── VmopAgentLoggedIn.java │ │ ├── VmopAgentLoggedOut.java │ │ ├── VserportChangeEvent.java │ │ └── package-info.java │ │ └── package-info.java └── templates │ └── Standard-VM-latest.ftl.yaml ├── org.jdrupes.vmoperator.util ├── .checkstyle ├── .eclipse-pmd ├── .settings │ ├── org.eclipse.buildship.core.prefs │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.core.runtime.prefs ├── build.gradle ├── src │ └── org │ │ └── jdrupes │ │ └── vmoperator │ │ └── util │ │ ├── DataPath.java │ │ ├── Dto.java │ │ ├── DtoTemplateModel.java │ │ ├── ExtendedObjectWrapper.java │ │ ├── FsdUtils.java │ │ ├── GsonPtr.java │ │ ├── LongLoggingManager.java │ │ └── package-info.java └── test │ └── org │ └── jdrupes │ └── vmoperator │ └── util │ └── DataPathTests.java ├── org.jdrupes.vmoperator.vmaccess ├── .checkstyle ├── .eclipse-pmd ├── .eslintignore ├── .eslintrc.json ├── .gitignore ├── .settings │ ├── org.eclipse.buildship.core.prefs │ ├── org.eclipse.core.resources.prefs │ ├── org.eclipse.core.runtime.prefs │ └── org.eclipse.jdt.ui.prefs ├── build.gradle ├── package.json ├── resources │ ├── META-INF │ │ └── services │ │ │ └── org.jgrapes.webconsole.base.ConletComponentFactory │ └── org │ │ └── jdrupes │ │ └── vmoperator │ │ └── vmaccess │ │ ├── VmAccess-confirmReset.ftl.html │ │ ├── VmAccess-edit.ftl.html │ │ ├── VmAccess-l10nBundles.ftl.js │ │ ├── VmAccess-preview.ftl.html │ │ ├── computer-in-use.svg │ │ ├── computer-off.svg │ │ ├── computer.svg │ │ ├── l10n.properties │ │ ├── l10n_de.properties │ │ ├── l10n_en.properties │ │ ├── osicons │ │ ├── Licenses.txt │ │ ├── almalinux.svg │ │ ├── arch.svg │ │ ├── debian.svg │ │ ├── fedora.svg │ │ ├── tux.svg │ │ ├── ubuntu.svg │ │ ├── unknown.svg │ │ └── windows.svg │ │ └── reset-icon.svg ├── rollup.config.mjs ├── src │ └── org │ │ └── jdrupes │ │ └── vmoperator │ │ └── vmaccess │ │ ├── VmAccess.java │ │ ├── VmAccessFactory.java │ │ ├── browser │ │ ├── VmAccess-functions.ts │ │ ├── VmAccess-style.scss │ │ └── l10nBundles-stub.d.ts │ │ └── package-info.java └── tsconfig.json ├── org.jdrupes.vmoperator.vmmgmt ├── .checkstyle ├── .eclipse-pmd ├── .eslintignore ├── .eslintrc.json ├── .gitignore ├── .settings │ ├── org.eclipse.buildship.core.prefs │ ├── org.eclipse.core.resources.prefs │ ├── org.eclipse.core.runtime.prefs │ └── org.eclipse.jdt.ui.prefs ├── build.gradle ├── package.json ├── resources │ ├── META-INF │ │ └── services │ │ │ └── org.jgrapes.webconsole.base.ConletComponentFactory │ └── org │ │ └── jdrupes │ │ └── vmoperator │ │ └── vmmgmt │ │ ├── VmMgmt-confirmReset.ftl.html │ │ ├── VmMgmt-l10nBundles.ftl.js │ │ ├── VmMgmt-preview.ftl.html │ │ ├── VmMgmt-view.ftl.html │ │ ├── computer-in-use.svg │ │ ├── computer-off.svg │ │ ├── computer.svg │ │ ├── l10n.properties │ │ ├── l10n_de.properties │ │ └── l10n_en.properties ├── rollup.config.mjs ├── src │ └── org │ │ └── jdrupes │ │ └── vmoperator │ │ └── vmmgmt │ │ ├── TimeSeries.java │ │ ├── VmMgmt.java │ │ ├── VmMgmtFactory.java │ │ ├── browser │ │ ├── ConditionalInputController.ts │ │ ├── CpuRamChart.ts │ │ ├── MemorySize.ts │ │ ├── TimeSeries.ts │ │ ├── VmMgmt-functions.ts │ │ ├── VmMgmt-style.scss │ │ └── l10nBundles-stub.d.ts │ │ └── package-info.java └── tsconfig.json ├── overview.md ├── package-lock.json ├── package.json ├── ruleset.xml ├── settings.gradle ├── spice-squid ├── .checkstyle ├── .eclipse-pmd ├── .settings │ ├── net.sf.jautodoc.prefs │ ├── org.eclipse.buildship.core.prefs │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.core.runtime.prefs ├── Containerfile ├── build.gradle ├── run.sh └── squid.conf └── webpages ├── .gitignore ├── .readthedocs.yaml ├── 02_2_operator.png ├── BingSiteAuth.xml ├── ConfigAccess-preview.png ├── Gemfile ├── PoolAccess-preview.png ├── VM-Operator-GUI-preview.png ├── VM-Operator-GUI-view.png ├── VM-Operator-with-font.svg ├── VM-Operator.svg ├── VmAccess-preview.png ├── _config.yml ├── _includes ├── matomo.html ├── toc.html └── umami.html ├── _layouts └── vm-operator.html ├── admin-gui.md ├── auto-login.md ├── controller.md ├── favicon.svg ├── hints.md ├── index-pic.svg ├── index.md ├── manager.md ├── pools.md ├── robots-readthedocs.txt ├── robots.txt ├── runner.md ├── stylesheets ├── pygment_trac.css └── styles.css ├── upgrading.md ├── user-gui.md └── webgui.md /.codacy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | exclude_paths: 3 | - 'buildSrc/**' 4 | - '*/test/**' 5 | - '*/test-resources/**' 6 | - 'misc/stylesheet.css' 7 | 8 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | insert_final_newline = true 6 | trim_trailing_whitespace = true 7 | 8 | [*.{html,md,yml,yaml}] 9 | indent_size = 2 10 | indent_style = space 11 | 12 | [*.{gradle,js,ts}] 13 | indent_size = 4 14 | indent_style = space 15 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "rules": { 4 | "no-unused-vars": "off", 5 | "@typescript-eslint/no-unused-vars": [ 6 | "warn", 7 | { 8 | "argsIgnorePattern": "^_", 9 | "varsIgnorePattern": "^_", 10 | "caughtErrorsIgnorePattern": "^_" 11 | } 12 | ] 13 | }, 14 | "ignorePatterns": ["src/**/*.test.ts", "build/**/*"] 15 | } 16 | 17 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # Linux start script should use lf 5 | /gradlew text eol=lf 6 | 7 | # These are Windows script files and should use crlf 8 | *.bat text eol=crlf 9 | 10 | -------------------------------------------------------------------------------- /.github/workflows/gradle.yml: -------------------------------------------------------------------------------- 1 | name: Java CI with Gradle 2 | 3 | on: 4 | push: {} 5 | pull_request: {} 6 | 7 | permissions: 8 | contents: read 9 | 10 | concurrency: 11 | group: doc_generation 12 | cancel-in-progress: false 13 | 14 | jobs: 15 | build: 16 | 17 | runs-on: ubuntu-latest 18 | 19 | steps: 20 | - uses: actions/checkout@v3 21 | with: 22 | fetch-depth: 0 23 | - name: Install graphviz 24 | run: sudo apt-get install graphviz 25 | - name: Set up JDK 21 26 | uses: actions/setup-java@v3 27 | with: 28 | java-version: '21' 29 | distribution: 'temurin' 30 | - name: Build with Gradle 31 | run: ./gradlew -Pwebsite.push.token=${{ secrets.WEBSITE_PUSH_TOKEN }} stage 32 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Push Container Image with Gradle 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | permissions: 8 | contents: read 9 | packages: write 10 | 11 | concurrency: 12 | group: doc_generation 13 | cancel-in-progress: false 14 | 15 | jobs: 16 | build: 17 | 18 | runs-on: ubuntu-latest 19 | 20 | steps: 21 | - uses: actions/checkout@v4 22 | with: 23 | fetch-depth: 0 24 | - name: Install graphviz 25 | run: sudo apt-get install graphviz 26 | - name: Install podman 27 | run: sudo apt-get install podman 28 | - name: Log in to the Container registry 29 | uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 30 | with: 31 | registry: ghcr.io 32 | username: ${{ github.actor }} 33 | password: ${{ secrets.GITHUB_TOKEN }} 34 | - name: Set up JDK 21 35 | uses: actions/setup-java@v3 36 | with: 37 | java-version: '21' 38 | distribution: 'temurin' 39 | - name: Push with Gradle 40 | run: ./gradlew -Pwebsite.push.token=${{ secrets.WEBSITE_PUSH_TOKEN }} -Pdocker.registry=ghcr.io/${{ github.actor }} stage publishImage 41 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Gradle project-specific cache directory 2 | .gradle 3 | 4 | # Ignore Gradle build output directory 5 | build 6 | 7 | # Eclipse 8 | bin 9 | .classpath 10 | .project 11 | org.eclipse.jdt.core.prefs 12 | **/.externalToolBuilders/ 13 | 14 | # Node 15 | **/node_modules/ 16 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | stages: 2 | - build 3 | - test 4 | - publish 5 | - deploy 6 | 7 | .any-job: 8 | rules: 9 | - if: $CI_SERVER_HOST == "gitlab.mnl.de" 10 | 11 | .gradle-job: 12 | extends: .any-job 13 | image: registry.mnl.de/org/jgrapes/jdk21-builder:v2 14 | cache: 15 | - key: dependencies-${CI_COMMIT_BRANCH} 16 | policy: pull-push 17 | paths: 18 | - .gradle 19 | - node_modules 20 | - key: "$CI_COMMIT_SHA" 21 | policy: pull-push 22 | paths: 23 | - build 24 | - "*/build" 25 | before_script: 26 | - echo -n $CI_REGISTRY_PASSWORD | podman login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY 27 | - git switch $(git branch -r --sort="authordate" --contains $CI_COMMIT_SHA | head -1 | sed -e 's#[^/]*/##') 28 | - git pull 29 | - git reset --hard $CI_COMMIT_SHA 30 | 31 | build-jars: 32 | stage: build 33 | extends: .gradle-job 34 | script: 35 | - ./gradlew -Pdocker.registry=$CI_REGISTRY_IMAGE build apidocs 36 | 37 | publish-images: 38 | stage: publish 39 | extends: .gradle-job 40 | dependencies: 41 | - build-jars 42 | script: 43 | - ./gradlew -Pdocker.registry=$CI_REGISTRY_IMAGE publishImage 44 | 45 | .pages-job: 46 | extends: .any-job 47 | image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/ruby:3.2 48 | variables: 49 | JEKYLL_ENV: production 50 | LC_ALL: C.UTF-8 51 | before_script: 52 | - git fetch origin gh-pages 53 | - git checkout gh-pages 54 | - gem install bundler 55 | - bundle install 56 | 57 | test-pages: 58 | stage: test 59 | extends: .pages-job 60 | rules: 61 | - if: $CI_COMMIT_BRANCH == "gh-pages" 62 | script: 63 | - bundle exec jekyll build -d test 64 | artifacts: 65 | paths: 66 | - test 67 | 68 | #publish-pages: 69 | # stage: publish 70 | # extends: .pages-job 71 | # rules: 72 | # - if: $CI_COMMIT_BRANCH == "gh-pages" 73 | # script: 74 | # - bundle exec jekyll build -d public 75 | # artifacts: 76 | # paths: 77 | # - public 78 | # environment: production 79 | -------------------------------------------------------------------------------- /.markdownlint.yaml: -------------------------------------------------------------------------------- 1 | # See [rules](https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml) 2 | 3 | # Default state for all rules 4 | default: true 5 | 6 | # MD007/ul-indent : Unordered list indentation : 7 | # https://github.com/DavidAnson/markdownlint/blob/v0.37.4/doc/md007.md 8 | MD007: 9 | # Spaces for indent 10 | indent: 2 11 | # Whether to indent the first level of the list 12 | start_indented: true 13 | # Spaces for first level indent (when start_indented is set) 14 | start_indent: 2 15 | 16 | # MD025/single-title/single-h1 : Multiple top-level headings in the same document : 17 | # https://github.com/DavidAnson/markdownlint/blob/v0.37.4/doc/md025.md 18 | MD025: 19 | # Heading level 20 | level: 1 21 | # RegExp for matching title in front matter (disable) 22 | front_matter_title: "" 23 | 24 | # MD036/no-emphasis-as-heading : Emphasis used instead of a heading : 25 | # https://github.com/DavidAnson/markdownlint/blob/v0.37.4/doc/md036.md 26 | MD036: false 27 | 28 | # MD043/required-headings : Required heading structure : 29 | # https://github.com/DavidAnson/markdownlint/blob/v0.37.4/doc/md043.md 30 | MD043: false 31 | -------------------------------------------------------------------------------- /.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | arguments=--init-script /home/mnl/.config/Code/User/globalStorage/redhat.java/1.24.0/config_linux/org.eclipse.osgi/55/0/.cp/gradle/init/init.gradle --init-script /home/mnl/.config/Code/User/globalStorage/redhat.java/1.24.0/config_linux/org.eclipse.osgi/55/0/.cp/gradle/protobuf/init.gradle 2 | auto.sync=false 3 | build.scans.enabled=false 4 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) 5 | connection.project.dir= 6 | eclipse.preferences.version=1 7 | gradle.user.home= 8 | java.home= 9 | jvm.arguments= 10 | offline.mode=false 11 | override.workspace.settings=true 12 | show.console.view=true 13 | show.executions.view=true 14 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.runtime.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | line.separator=\n 3 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "java", 9 | "name": "Current File", 10 | "request": "launch", 11 | "mainClass": "${file}" 12 | }, 13 | { 14 | "type": "java", 15 | "name": "Manager", 16 | "request": "launch", 17 | "mainClass": "org.jdrupes.vmoperator.manager.Manager", 18 | "projectName": "org.jdrupes.vmoperator.manager" 19 | }, 20 | { 21 | "type": "java", 22 | "name": "Runner", 23 | "request": "launch", 24 | "mainClass": "org.jdrupes.vmoperator.runner.qemu.Runner", 25 | "projectName": "org.jdrupes.vmoperator.runner.qemu", 26 | "cwd": "${workspaceFolder}/org.jdrupes.vmoperator.runner.qemu", 27 | "vmArgs": "-ea -Djava.util.logging.manager=org.jdrupes.vmoperator.util.LongLoggingManager" 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "java.compile.nullAnalysis.mode": "disabled", 3 | "java.configuration.updateBuildConfiguration": "interactive", 4 | "java.dependency.packagePresentation": "flat" 5 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Java CI with Gradle](https://github.com/mnlipp/VM-Operator/actions/workflows/gradle.yml/badge.svg)](https://github.com/mnlipp/VM-Operator/actions/workflows/gradle.yml) 2 | [![Codacy Badge](https://app.codacy.com/project/badge/Grade/2277842dac894de4b663c6aa2779077e)](https://app.codacy.com/gh/mnlipp/VM-Operator/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) 3 | ![Latest Manager](https://img.shields.io/github/v/tag/mnlipp/vm-operator?filter=manager*&label=latest) 4 | ![Latest Runner](https://img.shields.io/github/v/tag/mnlipp/vm-operator?filter=runner-qemu*&label=latest) 5 | 6 | # Run QEMU/KVM in Kubernetes Pods 7 | 8 | ![Overview picture](webpages/index-pic.svg) 9 | 10 | This project provides an easy to use and flexible solution for running 11 | QEMU/KVM based VMs in Kubernetes pods. 12 | 13 | The central component of this solution is the kubernetes operator that 14 | manages "runners". These run in pods and are used to start and manage 15 | the QEMU/KVM process for the VMs (optionally together with a SW-TPM). 16 | 17 | A web GUI for administrators provides an overview of the VMs together 18 | with some basic control over the VMs. A web GUI for users provides an 19 | interface to access and optionally start, stop and reset the VMs. 20 | 21 | Advanced features of the operator include pooling of VMs and automatic 22 | login. 23 | 24 | See the [project's home page](https://vm-operator.jdrupes.org/) 25 | for details. 26 | -------------------------------------------------------------------------------- /VM-Operator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnlipp/VM-Operator/76b579c404f4ea691bf5a00cde47ddb8d35b1342/VM-Operator.png -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | gradlePluginPortal() 4 | } 5 | } 6 | 7 | plugins { 8 | id 'org.ajoberstar.grgit' version '5.2.0' 9 | id 'org.ajoberstar.git-publish' version '4.2.0' apply false 10 | id 'pl.allegro.tech.build.axion-release' version '1.17.2' apply false 11 | id 'org.jdrupes.vmoperator.versioning-conventions' 12 | id 'org.jdrupes.vmoperator.java-doc-conventions' 13 | id 'eclipse' 14 | id "com.github.node-gradle.node" version "7.0.1" 15 | } 16 | 17 | allprojects { 18 | project.group = 'org.jdrupes.vmoperator' 19 | } 20 | 21 | task stage { 22 | description = 'To be executed by CI.' 23 | group = 'build' 24 | 25 | // Build everything first 26 | gradle.projectsEvaluated { 27 | dependsOn subprojects.tasks.collect { 28 | tc -> tc.findByName("build") }.flatten() 29 | } 30 | } 31 | 32 | eclipse { 33 | project { 34 | file { 35 | project.natures += 'org.eclipse.buildship.core.gradleprojectnature' 36 | project.buildCommand 'org.eclipse.buildship.core.gradleprojectbuilder' 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /buildSrc/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | arguments= 2 | auto.sync=false 3 | build.scans.enabled=false 4 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) 5 | connection.project.dir= 6 | eclipse.preferences.version=1 7 | gradle.user.home= 8 | java.home= 9 | jvm.arguments= 10 | offline.mode=false 11 | override.workspace.settings=false 12 | show.console.view=true 13 | show.executions.view=true 14 | -------------------------------------------------------------------------------- /buildSrc/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /buildSrc/.settings/org.eclipse.core.runtime.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | line.separator=\n 3 | -------------------------------------------------------------------------------- /buildSrc/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | # 2 | #Wed Oct 02 14:48:43 CEST 2024 3 | eclipse.preferences.version=1 4 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 5 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=21 6 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 7 | org.eclipse.jdt.core.compiler.compliance=21 8 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 9 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 10 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 11 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 12 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 13 | org.eclipse.jdt.core.compiler.source=21 14 | -------------------------------------------------------------------------------- /buildSrc/.settings/org.eclipse.jdt.groovy.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | groovy.compiler.level=-1 3 | groovy.script.filters=**/*.dsld,y,**/*.gradle,n 4 | -------------------------------------------------------------------------------- /buildSrc/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | // Support convention plugins written in Groovy. Convention plugins 3 | // are build scripts in 'src/main' that automatically become available 4 | // as plugins in the main build. 5 | id 'groovy-gradle-plugin' 6 | 7 | // Apply eclipse plugin 8 | id 'eclipse' 9 | } 10 | 11 | sourceSets { 12 | main { 13 | groovy { 14 | srcDirs = ['src'] 15 | } 16 | resources { 17 | srcDirs = ['resources'] 18 | } 19 | } 20 | } 21 | 22 | eclipse { 23 | 24 | jdt { 25 | file { 26 | withProperties { properties -> 27 | def formatterPrefs = new Properties() 28 | rootProject.file("../gradle/org.eclipse.jdt.core.formatter.prefs") 29 | .withInputStream { formatterPrefs.load(it) } 30 | properties.putAll(formatterPrefs) 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /buildSrc/src/org.jdrupes.vmoperator.java-application-conventions.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * This project uses @Incubating APIs which are subject to change. 5 | */ 6 | 7 | plugins { 8 | // Apply the common convention plugin for shared build configuration between library and application projects. 9 | id 'org.jdrupes.vmoperator.java-common-conventions' 10 | 11 | // Apply the application plugin to add support for building a CLI application in Java. 12 | id 'application' 13 | } 14 | -------------------------------------------------------------------------------- /buildSrc/src/org.jdrupes.vmoperator.java-library-conventions.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * This project uses @Incubating APIs which are subject to change. 5 | */ 6 | 7 | plugins { 8 | // Apply the common convention plugin for shared build configuration between library and application projects. 9 | id 'org.jdrupes.vmoperator.java-common-conventions' 10 | 11 | // Apply the java-library plugin for API and implementation separation. 12 | id 'java-library' 13 | } 14 | -------------------------------------------------------------------------------- /buildSrc/src/org.jdrupes.vmoperator.versioning-conventions.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * This project uses @Incubating APIs which are subject to change. 5 | */ 6 | 7 | plugins { 8 | // Required by axion-release 9 | id 'org.ajoberstar.grgit' 10 | // Git based versioning 11 | id 'pl.allegro.tech.build.axion-release' 12 | } 13 | 14 | def shortened = project.name.startsWith(project.group + ".") ? 15 | project.name.substring(project.group.length() + 1) : project.name 16 | if (shortened == "manager") { 17 | shortened = "manager-app"; 18 | } 19 | var tagName = shortened.replace('.', '-') + "-" 20 | if (grgit.branch.current.name != "main" 21 | && grgit.branch.current.name != "HEAD" 22 | && !grgit.branch.current.name.startsWith("testing") 23 | && !grgit.branch.current.name.startsWith("release") 24 | && !grgit.branch.current.name.startsWith("develop")) { 25 | tagName = tagName + grgit.branch.current.name.replace('/', '-') + "-" 26 | } 27 | project.ext.tagName = tagName 28 | 29 | scmVersion { 30 | versionIncrementer 'incrementMinor' 31 | tag { 32 | prefix = project.tagName 33 | } 34 | } 35 | project.version = scmVersion.version 36 | ext.isSnapshot = version.endsWith('-SNAPSHOT') 37 | -------------------------------------------------------------------------------- /deploy/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | resources: 5 | - vmop-role.yaml 6 | - vmop-service-account.yaml 7 | - vmop-role-binding.yaml 8 | - vmop-image-repository-pvc.yaml 9 | - vmop-config-map.yaml 10 | - vmop-deployment.yaml 11 | - vmop-service.yaml 12 | - vmrunner-role.yaml 13 | - vmrunner-service-account.yaml 14 | - vmrunner-role-binding.yaml 15 | -------------------------------------------------------------------------------- /deploy/vmop-config-map.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: vm-operator 5 | labels: 6 | app.kubernetes.io/name: vm-operator 7 | 8 | data: 9 | config.yaml: | 10 | "/Manager": {} 11 | 12 | logging.properties: | 13 | handlers=java.util.logging.ConsoleHandler, \ 14 | org.jgrapes.webconlet.logviewer.LogViewerHandler 15 | 16 | org.jgrapes.level=FINE 17 | org.jdrupes.vmoperator.manager.level=FINE 18 | 19 | java.util.logging.ConsoleHandler.level=ALL 20 | java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter 21 | java.util.logging.SimpleFormatter.format=%1$tb %1$td %1$tT %4$s %5$s%6$s%n 22 | 23 | org.jgrapes.webconlet.logviewer.LogViewerHandler.level=CONFIG 24 | -------------------------------------------------------------------------------- /deploy/vmop-image-repository-pvc.yaml: -------------------------------------------------------------------------------- 1 | kind: PersistentVolumeClaim 2 | apiVersion: v1 3 | metadata: 4 | name: vmop-image-repository 5 | labels: 6 | app.kubernetes.io/name: vm-operator 7 | spec: 8 | accessModes: 9 | - ReadOnlyMany 10 | resources: 11 | requests: 12 | storage: 100Gi 13 | volumeMode: Filesystem 14 | -------------------------------------------------------------------------------- /deploy/vmop-role-binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: RoleBinding 3 | metadata: 4 | name: vm-operator 5 | labels: 6 | app.kubernetes.io/name: vm-operator 7 | roleRef: 8 | apiGroup: rbac.authorization.k8s.io 9 | kind: Role 10 | name: vm-operator 11 | subjects: 12 | - kind: ServiceAccount 13 | name: vm-operator 14 | -------------------------------------------------------------------------------- /deploy/vmop-role.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: Role 3 | metadata: 4 | name: vm-operator 5 | labels: 6 | app.kubernetes.io/name: vm-operator 7 | rules: 8 | - apiGroups: 9 | - vmoperator.jdrupes.org 10 | resources: 11 | - vms 12 | - vmpools 13 | verbs: 14 | - '*' 15 | - apiGroups: 16 | - vmoperator.jdrupes.org 17 | resources: 18 | - vms/status 19 | verbs: 20 | - patch 21 | - apiGroups: 22 | - apps 23 | resources: 24 | - statefulsets 25 | verbs: 26 | - '*' 27 | - apiGroups: 28 | - "" 29 | resources: 30 | - configmaps 31 | - secrets 32 | - services 33 | verbs: 34 | - '*' 35 | - apiGroups: 36 | - "" 37 | resources: 38 | - persistentvolumeclaims 39 | - pods 40 | verbs: 41 | - watch 42 | - list 43 | - get 44 | - create 45 | - delete 46 | - patch 47 | -------------------------------------------------------------------------------- /deploy/vmop-service-account.yaml: -------------------------------------------------------------------------------- 1 | kind: ServiceAccount 2 | apiVersion: v1 3 | metadata: 4 | name: vm-operator 5 | labels: 6 | app.kubernetes.io/name: vm-operator 7 | -------------------------------------------------------------------------------- /deploy/vmop-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: vm-operator 5 | spec: 6 | ports: 7 | - port: 8080 8 | protocol: TCP 9 | targetPort: 8080 10 | selector: 11 | app.kubernetes.io/name: vm-operator 12 | app.kubernetes.io/component: manager 13 | -------------------------------------------------------------------------------- /deploy/vmrunner-role-binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: RoleBinding 3 | metadata: 4 | name: vm-runner 5 | labels: 6 | app.kubernetes.io/name: vm-operator 7 | roleRef: 8 | apiGroup: rbac.authorization.k8s.io 9 | kind: Role 10 | name: vm-runner 11 | subjects: 12 | - kind: ServiceAccount 13 | name: vm-runner 14 | -------------------------------------------------------------------------------- /deploy/vmrunner-role.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: Role 3 | metadata: 4 | name: vm-runner 5 | labels: 6 | app.kubernetes.io/name: vm-operator 7 | rules: 8 | - apiGroups: 9 | - vmoperator.jdrupes.org 10 | resources: 11 | - vms 12 | verbs: 13 | - list 14 | - get 15 | - patch 16 | - apiGroups: 17 | - vmoperator.jdrupes.org 18 | resources: 19 | - vms/status 20 | verbs: 21 | - patch 22 | - apiGroups: 23 | - events.k8s.io 24 | resources: 25 | - events 26 | verbs: 27 | - create 28 | -------------------------------------------------------------------------------- /deploy/vmrunner-service-account.yaml: -------------------------------------------------------------------------------- 1 | kind: ServiceAccount 2 | apiVersion: v1 3 | metadata: 4 | name: vm-runner 5 | labels: 6 | app.kubernetes.io/name: vm-operator 7 | -------------------------------------------------------------------------------- /dev-example/.gitignore: -------------------------------------------------------------------------------- 1 | /test-vm-ci.yaml 2 | /kubeconfig.yaml 3 | /crds/ 4 | /.vm-operator-cmd.rc 5 | -------------------------------------------------------------------------------- /dev-example/Readme.md: -------------------------------------------------------------------------------- 1 | # Example setup for development 2 | 3 | The CRD must be deployed independently. Apart from that, the 4 | `kustomize.yaml` 5 | 6 | * creates a small cdrom image repository and 7 | 8 | * deploys the operator in namespace `vmop-dev` with a replica of 0. 9 | 10 | This allows you to run the manager in your IDE. 11 | 12 | The `kustomize.yaml` also changes the container image repository for 13 | the operator to a private repository for development. You have to 14 | adapt this to your own repository if you also want to test your 15 | development version in a container. 16 | 17 | If you want to run the unittests, this setup *must* be used with a private 18 | container image repository which must match the one configured 19 | for gradle pushImages. 20 | -------------------------------------------------------------------------------- /dev-example/gen-pool-vm-crds: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function usage() { 4 | cat >&2 <&2 "Unknown option: $1"; exit 1;; 28 | *) template="$1";; 29 | esac 30 | shift 31 | done 32 | 33 | if [ -z "$template" ]; then 34 | usage 35 | fi 36 | 37 | if [ "$count" = "0" ]; then 38 | exit 0 39 | fi 40 | for number in $(seq 1 $count); do 41 | if [ -z "$prefix" ]; then 42 | prefix=$(basename $template .tpl.yaml) 43 | fi 44 | name="$prefix$(printf %03d $number)" 45 | index=$(($number - 1)) 46 | esh -o $destination/$name.yaml $template number=$number index=$index 47 | done 48 | -------------------------------------------------------------------------------- /dev-example/pool-action: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function usage() { 4 | cat >&2 <&2 "Unknown option: $1"; exit 1;; 33 | *) if [ ! -v pool ]; then 34 | pool="$1" 35 | elif [ ! -v action ]; then 36 | action="$1" 37 | else 38 | usage 39 | fi;; 40 | esac 41 | shift 42 | done 43 | 44 | if [ ! -v pool -o ! -v "action" -o ! -v context ]; then 45 | echo >&2 "Missing arguments or context not set." 46 | echo >&2 47 | usage 48 | fi 49 | case "$action" in 50 | "start"|"stop"|"delete"|"delete-disks") ;; 51 | *) usage;; 52 | esac 53 | 54 | kubectl --context="$context" -n "$namespace" get vms -o json \ 55 | | jq -r '.items[] | select(.spec.pools | contains(["'${pool}'"])) | .metadata.name' \ 56 | | while read vmName; do 57 | case "$action" in 58 | start) kubectl --context="$context" -n "$namespace" patch vms "$vmName" \ 59 | --type='merge' -p '{"spec":{"vm":{"state":"Running"}}}';; 60 | stop) kubectl --context="$context" -n "$namespace" patch vms "$vmName" \ 61 | --type='merge' -p '{"spec":{"vm":{"state":"Stopped"}}}';; 62 | delete) kubectl --context="$context" -n "$namespace" delete vm/"$vmName";; 63 | delete-disks) kubectl --context="$context" -n "$namespace" delete \ 64 | pvc -l app.kubernetes.io/instance="$vmName" ;; 65 | esac 66 | done 67 | -------------------------------------------------------------------------------- /dev-example/test-pool.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: "vmoperator.jdrupes.org/v1" 2 | kind: VmPool 3 | metadata: 4 | namespace: vmop-dev 5 | name: test-vms 6 | spec: 7 | retention: "PT1m" 8 | loginOnAssignment: true 9 | permissions: 10 | - user: admin 11 | may: 12 | - accessConsole 13 | - start 14 | - role: user 15 | may: 16 | - accessConsole 17 | - start 18 | -------------------------------------------------------------------------------- /dev-example/test-vm-display-secret.yaml: -------------------------------------------------------------------------------- 1 | kind: Secret 2 | apiVersion: v1 3 | metadata: 4 | name: test-vm-display-secret 5 | namespace: vmop-dev 6 | labels: 7 | app.kubernetes.io/name: vm-runner 8 | app.kubernetes.io/instance: test-vm 9 | app.kubernetes.io/component: display-secret 10 | type: Opaque 11 | data: 12 | display-password: dGVzdC12bQ== 13 | password-expiry: KzMw 14 | -------------------------------------------------------------------------------- /dev-example/test-vm-pv-system.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: PersistentVolume 3 | metadata: 4 | name: test-vm-system 5 | labels: 6 | app.kubernetes.io/name: vmrunner 7 | app.kubernetes.io/instance: test-vm 8 | vmrunner.jdrupes.org/disk: system 9 | spec: 10 | capacity: 11 | storage: 40Gi 12 | volumeMode: Block 13 | accessModes: 14 | - ReadWriteOnce 15 | persistentVolumeReclaimPolicy: Retain 16 | claimRef: 17 | name: system-disk-test-vm-0 18 | namespace: qemu-vms 19 | local: 20 | path: /dev/vgmain/test-vm 21 | nodeAffinity: 22 | required: 23 | nodeSelectorTerms: 24 | - matchExpressions: 25 | - key: kubernetes.io/hostname 26 | operator: In 27 | values: 28 | - olymp 29 | -------------------------------------------------------------------------------- /dev-example/test-vm-shell.yaml: -------------------------------------------------------------------------------- 1 | kind: Pod 2 | apiVersion: v1 3 | metadata: 4 | name: test-vm-shell 5 | namespace: vmop-dev 6 | spec: 7 | volumes: 8 | - name: test-vm-system-disk 9 | persistentVolumeClaim: 10 | claimName: system-disk-test-vm-0 11 | - name: vmop-image-repository 12 | persistentVolumeClaim: 13 | claimName: vmop-image-repository 14 | containers: 15 | - name: test-vm-shell 16 | image: archlinux/archlinux 17 | args: 18 | - bash 19 | imagePullPolicy: Always 20 | stdin: true 21 | stdinOnce: true 22 | tty: true 23 | volumeDevices: 24 | - name: test-vm-system-disk 25 | devicePath: /dev/test-vm-system-disk 26 | volumeMounts: 27 | - name: vmop-image-repository 28 | mountPath: /var/local/vmop-image-repository 29 | securityContext: 30 | privileged: true 31 | -------------------------------------------------------------------------------- /dev-example/test-vm-snapshot.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: snapshot.storage.k8s.io/v1 3 | kind: VolumeSnapshot 4 | metadata: 5 | namespace: vmop-dev 6 | name: test-vm-system-disk-snapshot 7 | spec: 8 | volumeSnapshotClassName: csi-rbdplugin-snapclass 9 | source: 10 | persistentVolumeClaimName: test-vm-system-disk 11 | -------------------------------------------------------------------------------- /dev-example/test-vm.tpl.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: "vmoperator.jdrupes.org/v1" 2 | kind: VirtualMachine 3 | metadata: 4 | namespace: vmop-dev 5 | name: test-vm<%= $(printf "%02d" ${number}) %> 6 | annotations: 7 | argocd.argoproj.io/sync-wave: "20" 8 | 9 | spec: 10 | image: 11 | source: ghcr.io/mnlipp/org.jdrupes.vmoperator.runner.qemu-arch:latest 12 | # source: registry.mnl.de/org/jdrupes/vm-operator/org.jdrupes.vmoperator.runner.qemu-arch:testing 13 | # source: docker-registry.lan.mnl.de/vmoperator/org.jdrupes.vmoperator.runner.qemu-arch:latest 14 | pullPolicy: Always 15 | 16 | runnerTemplate: 17 | update: true 18 | 19 | permissions: 20 | - role: admin 21 | may: 22 | - "*" 23 | 24 | guestShutdownStops: true 25 | 26 | cloudInit: 27 | metaData: {} 28 | 29 | pools: 30 | - test-vms 31 | 32 | vm: 33 | # state: Running 34 | bootMenu: true 35 | maximumCpus: 4 36 | currentCpus: 2 37 | maximumRam: 6Gi 38 | currentRam: 4Gi 39 | 40 | networks: 41 | # No bridge on TC1 42 | # - tap: {} 43 | - user: {} 44 | 45 | disks: 46 | - volumeClaimTemplate: 47 | metadata: 48 | name: system 49 | spec: 50 | storageClassName: ceph-rbd3slow 51 | dataSource: 52 | name: test-vm-system-disk-snapshot 53 | kind: VolumeSnapshot 54 | apiGroup: snapshot.storage.k8s.io 55 | accessModes: 56 | - ReadWriteOnce 57 | resources: 58 | requests: 59 | storage: 40Gi 60 | - cdrom: 61 | image: "" 62 | # image: https://download.fedoraproject.org/pub/fedora/linux/releases/38/Workstation/x86_64/iso/Fedora-Workstation-Live-x86_64-38-1.6.iso 63 | 64 | display: 65 | spice: 66 | port: <%= $((5910 + number)) %> 67 | -------------------------------------------------------------------------------- /dev-example/test-vm.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: "vmoperator.jdrupes.org/v1" 2 | kind: VirtualMachine 3 | metadata: 4 | namespace: vmop-dev 5 | name: test-vm 6 | spec: 7 | image: 8 | source: registry.mnl.de/org/jdrupes/vm-operator/org.jdrupes.vmoperator.runner.qemu-arch:testing 9 | pullPolicy: Always 10 | 11 | permissions: 12 | - user: admin 13 | may: 14 | - "*" 15 | 16 | resources: 17 | requests: 18 | cpu: 1 19 | memory: 2Gi 20 | 21 | guestShutdownStops: true 22 | 23 | cloudInit: {} 24 | 25 | vm: 26 | # state: Running 27 | bootMenu: yes 28 | useTpm: true 29 | maximumRam: 8Gi 30 | currentRam: 4Gi 31 | maximumCpus: 4 32 | currentCpus: 4 33 | 34 | networks: 35 | # No bridge on test cluster 36 | - user: {} 37 | 38 | disks: 39 | - volumeClaimTemplate: 40 | metadata: 41 | name: system 42 | spec: 43 | storageClassName: "" 44 | selector: 45 | matchLabels: 46 | app.kubernetes.io/name: vmrunner 47 | app.kubernetes.io/instance: test-vm 48 | vmrunner.jdrupes.org/disk: system 49 | resources: 50 | requests: 51 | storage: 40Gi 52 | - cdrom: 53 | image: "" 54 | # image: https://download.fedoraproject.org/pub/fedora/linux/releases/38/Workstation/x86_64/iso/Fedora-Workstation-Live-x86_64-38-1.6.iso 55 | # image: "Fedora-Workstation-Live-x86_64-38-1.6.iso" 56 | 57 | display: 58 | spice: 59 | port: 5810 60 | generateSecret: true 61 | 62 | loadBalancerService: {} 63 | -------------------------------------------------------------------------------- /dev-example/vmop-agent/99-vmop-agent.rules: -------------------------------------------------------------------------------- 1 | SUBSYSTEM=="virtio-ports", ATTR{name}=="org.jdrupes.vmop_agent.0", \ 2 | TAG+="systemd" ENV{SYSTEMD_WANTS}="vmop-agent.service" 3 | -------------------------------------------------------------------------------- /dev-example/vmop-agent/vmop-agent.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=VM-Operator (Guest) Agent 3 | BindsTo=dev-virtio\x2dports-org.jdrupes.vmop_agent.0.device 4 | After=dev-virtio\x2dports-org.jdrupes.vmop_agent.0.device multi-user.target 5 | IgnoreOnIsolate=True 6 | 7 | [Service] 8 | UMask=0077 9 | #EnvironmentFile=/etc/sysconfig/vmop-agent 10 | ExecStart=/usr/local/libexec/vmop-agent 11 | Restart=always 12 | RestartSec=0 13 | 14 | [Install] 15 | WantedBy=dev-virtio\x2dports-org.jdrupes.vmop_agent.0.device 16 | -------------------------------------------------------------------------------- /example/local-path/Readme.md: -------------------------------------------------------------------------------- 1 | # Example setup 2 | 3 | The CRD must be deployed independently. 4 | 5 | ```sh 6 | kubectl apply -f https://github.com/mnlipp/VM-Operator/raw/main/deploy/crds/vms-crd.yaml 7 | ``` 8 | 9 | Apart from that, the `kustomize.yaml` defines a namespace for the manager 10 | (and the VMs managed by it) and patches the repository PVC to create 11 | a small volume using local-path. 12 | 13 | A second patch provides a new configuration file for the manager 14 | that makes it use the local-path storage class when creating the 15 | small volume for a runner's data. 16 | 17 | The `kustomize.yaml` does not include the test VM. Before creating 18 | the test VM, you will again most likely want to change the 19 | disk definition. The sample file uses a reference to some 20 | manually allocated PV. 21 | -------------------------------------------------------------------------------- /example/local-path/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | resources: 5 | - https://github.com/mnlipp/VM-Operator/deploy 6 | 7 | namespace: vmop-demo 8 | 9 | patches: 10 | - patch: |- 11 | kind: PersistentVolumeClaim 12 | apiVersion: v1 13 | metadata: 14 | name: vmop-image-repository 15 | spec: 16 | # Default is ReadOnlyMany 17 | accessModes: 18 | - ReadWriteOnce 19 | resources: 20 | requests: 21 | # Default is 100Gi 22 | storage: 10Gi 23 | # Default is to use the default storage class 24 | storageClassName: local-path 25 | 26 | - patch: |- 27 | kind: ConfigMap 28 | apiVersion: v1 29 | metadata: 30 | name: vm-operator 31 | data: 32 | config.yaml: | 33 | "/Manager": 34 | "/Controller": 35 | "/Reconciler" 36 | runnerDataPvc: 37 | # Default is to use the default storage class 38 | storageClassName: local-path 39 | -------------------------------------------------------------------------------- /example/local-path/test-vm.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: "vmoperator.jdrupes.org/v1" 2 | kind: VirtualMachine 3 | metadata: 4 | namespace: vmop-demo 5 | name: test-vm 6 | spec: 7 | 8 | # image: 9 | # Defaults: 10 | # repository: ghcr.io 11 | # path: mnlipp/org.jdrupes.vmoperator.runner.qemu-arch 12 | # version: latest 13 | # pullPolicy: Always 14 | 15 | vm: 16 | maximumCpus: 4 17 | currentCpus: 2 18 | maximumRam: 8Gi 19 | currentRam: 4Gi 20 | 21 | networks: 22 | - user: {} 23 | 24 | disks: 25 | - volumeClaimTemplate: 26 | metadata: 27 | name: system 28 | spec: 29 | storageClassName: "" 30 | selector: 31 | matchLabels: 32 | app.kubernetes.io/name: vmrunner 33 | app.kubernetes.io/instance: test-vm 34 | vmrunner.jdrupes.org/disk: system 35 | resources: 36 | requests: 37 | storage: 40Gi 38 | - cdrom: 39 | image: "" 40 | # image: https://download.fedoraproject.org/pub/fedora/linux/releases/38/Workstation/x86_64/iso/Fedora-Workstation-Live-x86_64-38-1.6.iso 41 | # image: "Fedora-Workstation-Live-x86_64-38-1.6.iso" 42 | 43 | display: 44 | spice: 45 | port: 5910 46 | -------------------------------------------------------------------------------- /example/rook-ceph/Readme.md: -------------------------------------------------------------------------------- 1 | # Example setup 2 | 3 | The CRD must be deployed independently. 4 | 5 | ```sh 6 | kubectl apply -f https://github.com/mnlipp/VM-Operator/raw/main/deploy/crds/vms-crd.yaml 7 | ``` 8 | 9 | Apart from that, the `kustomize.yaml` defines a namespace for the manager 10 | (and the VMs managed by it) and applies patches to use `rook-cephfs` as 11 | storage class (instead of the default storage class). 12 | 13 | The `kustomize.yaml` does not include the test VM. Before creating 14 | the test VM, you will again most likely want to change the 15 | disk definition. The sample file claims a ceph block device. 16 | -------------------------------------------------------------------------------- /example/rook-ceph/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | resources: 5 | - https://github.com/mnlipp/VM-Operator/deploy 6 | 7 | namespace: vmop-demo 8 | 9 | patches: 10 | # Use storage class rook-cephfs for the shared image repository 11 | - patch: |- 12 | kind: PersistentVolumeClaim 13 | apiVersion: v1 14 | metadata: 15 | name: vmop-image-repository 16 | spec: 17 | storageClassName: rook-cephfs 18 | 19 | # Use storage class rook-cepfs for the runner's data (e.g. EFI vars) 20 | - patch: |- 21 | kind: ConfigMap 22 | apiVersion: v1 23 | metadata: 24 | name: vm-operator 25 | data: 26 | config.yaml: | 27 | "/Manager": 28 | "/Controller": 29 | "/Reconciler": 30 | runnerData: 31 | storageClassName: rook-cephfs 32 | -------------------------------------------------------------------------------- /example/rook-ceph/test-vm.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: "vmoperator.jdrupes.org/v1" 2 | kind: VirtualMachine 3 | metadata: 4 | namespace: vmop-demo 5 | name: test-vm 6 | spec: 7 | 8 | # image: 9 | # Defaults: 10 | # repository: ghcr.io 11 | # path: mnlipp/org.jdrupes.vmoperator.runner.qemu-arch 12 | # version: latest 13 | # pullPolicy: Always 14 | 15 | vm: 16 | maximumCpus: 4 17 | currentCpus: 2 18 | maximumRam: 8Gi 19 | currentRam: 4Gi 20 | 21 | networks: 22 | - user: {} 23 | 24 | disks: 25 | - volumeClaimTemplate: 26 | metadata: 27 | name: system 28 | spec: 29 | storageClassName: rook-ceph-block 30 | resources: 31 | requests: 32 | storage: 40Gi 33 | - cdrom: 34 | # image: "" 35 | image: https://download.fedoraproject.org/pub/fedora/linux/releases/38/Workstation/x86_64/iso/Fedora-Workstation-Live-x86_64-38-1.6.iso 36 | # image: "Fedora-Workstation-Live-x86_64-38-1.6.iso" 37 | 38 | display: 39 | spice: 40 | port: 5910 41 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.parallel=true 2 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnlipp/VM-Operator/76b579c404f4ea691bf5a00cde47ddb8d35b1342/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /misc/javadoc-overwrites.css: -------------------------------------------------------------------------------- 1 | :root { --body-font-size: 16px;} 2 | :root { --code-font-size: 16px;} 3 | -------------------------------------------------------------------------------- /misc/javadoc-redirect/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | JGrapes documentation 4 | 5 | 6 | 7 | If you are not redirected automatically, 8 | follow this link to the documentation.. 9 | 10 | 11 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.common/.checkstyle: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.common/.eclipse-pmd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.common/.settings/net.sf.jautodoc.prefs: -------------------------------------------------------------------------------- 1 | add_header=true 2 | eclipse.preferences.version=1 3 | header_text=/*\n * VM-Operator\n * Copyright (C) 2024 Michael N. Lipp\n * \n * This program is free software\: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n */ 4 | project_specific_settings=true 5 | visibility_package=false 6 | visibility_private=false 7 | visibility_protected=false 8 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.common/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | arguments= 2 | auto.sync=false 3 | build.scans.enabled=false 4 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) 5 | connection.project.dir=.. 6 | eclipse.preferences.version=1 7 | gradle.user.home= 8 | java.home= 9 | jvm.arguments= 10 | offline.mode=false 11 | override.workspace.settings=false 12 | show.console.view=false 13 | show.executions.view=false 14 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.common/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.common/.settings/org.eclipse.core.runtime.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | line.separator=\n 3 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.common/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * This project uses @Incubating APIs which are subject to change. 5 | */ 6 | 7 | plugins { 8 | id 'org.jdrupes.vmoperator.java-library-conventions' 9 | } 10 | 11 | dependencies { 12 | api project(':org.jdrupes.vmoperator.util') 13 | api 'org.jgrapes:org.jgrapes.core:[1.22.1,2)' 14 | api 'io.kubernetes:client-java:[19.0.0,20.0.0)' 15 | api 'org.yaml:snakeyaml' 16 | api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:[2.16.1,3]' 17 | } 18 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.common/src/org/jdrupes/vmoperator/common/K8sDynamicModels.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2024 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.common; 20 | 21 | import com.google.gson.Gson; 22 | import com.google.gson.JsonObject; 23 | import io.kubernetes.client.common.KubernetesListObject; 24 | 25 | /** 26 | * Represents a list of Kubernetes objects each of which is 27 | * represented using a JSON data structure. 28 | * Some information that is common to all Kubernetes objects, 29 | * notably the metadata, is made available through the methods 30 | * defined by {@link KubernetesListObject}. 31 | */ 32 | public class K8sDynamicModels extends K8sDynamicModelsBase { 33 | 34 | /** 35 | * Initialize the object list using the given JSON data. 36 | * 37 | * @param delegate the gson instance to use for extracting structured data 38 | * @param data the data 39 | */ 40 | public K8sDynamicModels(Gson delegate, JsonObject data) { 41 | super(K8sDynamicModel.class, delegate, data); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.common/src/org/jdrupes/vmoperator/common/VmDefinitions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2024 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.common; 20 | 21 | import com.google.gson.Gson; 22 | import com.google.gson.JsonObject; 23 | 24 | /** 25 | * Represents a list of {@link VmDefinition}s. 26 | */ 27 | public class VmDefinitions 28 | extends K8sDynamicModelsBase { 29 | 30 | /** 31 | * Initialize the object list using the given JSON data. 32 | * 33 | * @param delegate the gson instance to use for extracting structured data 34 | * @param data the data 35 | */ 36 | public VmDefinitions(Gson delegate, JsonObject data) { 37 | super(VmDefinition.class, delegate, data); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.common/src/org/jdrupes/vmoperator/common/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | /** 20 | * Classes and methods shared among the VM operator modules. 21 | */ 22 | package org.jdrupes.vmoperator.common; -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager.events/.checkstyle: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager.events/.eclipse-pmd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager.events/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | arguments= 2 | auto.sync=false 3 | build.scans.enabled=false 4 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) 5 | connection.project.dir=.. 6 | eclipse.preferences.version=1 7 | gradle.user.home= 8 | java.home= 9 | jvm.arguments= 10 | offline.mode=false 11 | override.workspace.settings=false 12 | show.console.view=false 13 | show.executions.view=false 14 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager.events/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager.events/.settings/org.eclipse.core.runtime.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | line.separator=\n 3 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager.events/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * This project uses @Incubating APIs which are subject to change. 5 | */ 6 | 7 | plugins { 8 | id 'org.jdrupes.vmoperator.java-library-conventions' 9 | } 10 | 11 | dependencies { 12 | api project(':org.jdrupes.vmoperator.common') 13 | } 14 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager.events/src/org/jdrupes/vmoperator/manager/events/AssignVm.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2024 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.manager.events; 20 | 21 | import org.jdrupes.vmoperator.manager.events.GetVms.VmData; 22 | import org.jgrapes.core.Event; 23 | 24 | /** 25 | * Assign a VM from a pool to a user. 26 | */ 27 | @SuppressWarnings("PMD.DataClass") 28 | public class AssignVm extends Event { 29 | 30 | private final String fromPool; 31 | private final String toUser; 32 | 33 | /** 34 | * Instantiates a new event. 35 | * 36 | * @param fromPool the from pool 37 | * @param toUser the to user 38 | */ 39 | public AssignVm(String fromPool, String toUser) { 40 | this.fromPool = fromPool; 41 | this.toUser = toUser; 42 | } 43 | 44 | /** 45 | * Gets the pool to assign from. 46 | * 47 | * @return the pool 48 | */ 49 | public String fromPool() { 50 | return fromPool; 51 | } 52 | 53 | /** 54 | * Gets the user to assign to. 55 | * 56 | * @return the to user 57 | */ 58 | public String toUser() { 59 | return toUser; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager.events/src/org/jdrupes/vmoperator/manager/events/Exit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2024 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.manager.events; 20 | 21 | import org.jgrapes.core.events.Stop; 22 | 23 | /** 24 | * Like {@link Stop}, but sets an exit status. 25 | */ 26 | @SuppressWarnings("PMD.ShortClassName") 27 | public class Exit extends Stop { 28 | 29 | private final int exitStatus; 30 | 31 | /** 32 | * Instantiates a new exit. 33 | * 34 | * @param exitStatus the exit status 35 | */ 36 | public Exit(int exitStatus) { 37 | this.exitStatus = exitStatus; 38 | } 39 | 40 | public int exitStatus() { 41 | return exitStatus; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager.events/src/org/jdrupes/vmoperator/manager/events/ResetVm.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2024 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.manager.events; 20 | 21 | import org.jgrapes.core.Event; 22 | 23 | /** 24 | * Triggers a reset of the VM. 25 | */ 26 | @SuppressWarnings("PMD.DataClass") 27 | public class ResetVm extends Event { 28 | 29 | private final String vmName; 30 | 31 | /** 32 | * Instantiates a new event. 33 | * 34 | * @param vmName the vm name 35 | */ 36 | public ResetVm(String vmName) { 37 | this.vmName = vmName; 38 | } 39 | 40 | /** 41 | * Gets the vm name. 42 | * 43 | * @return the vm name 44 | */ 45 | public String vmName() { 46 | return vmName; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager.events/src/org/jdrupes/vmoperator/manager/events/UpdateAssignment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2024 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.manager.events; 20 | 21 | import org.jdrupes.vmoperator.common.VmPool; 22 | import org.jgrapes.core.Event; 23 | 24 | /** 25 | * Note the assignment to a user in the VM status. 26 | */ 27 | @SuppressWarnings("PMD.DataClass") 28 | public class UpdateAssignment extends Event { 29 | 30 | private final VmPool fromPool; 31 | private final String toUser; 32 | 33 | /** 34 | * Instantiates a new event. 35 | * 36 | * @param fromPool the pool from which the VM was assigned 37 | * @param toUser the to user 38 | */ 39 | public UpdateAssignment(VmPool fromPool, String toUser) { 40 | this.fromPool = fromPool; 41 | this.toUser = toUser; 42 | } 43 | 44 | /** 45 | * Gets the pool from which the VM was assigned. 46 | * 47 | * @return the pool 48 | */ 49 | public VmPool fromPool() { 50 | return fromPool; 51 | } 52 | 53 | /** 54 | * Gets the user to whom the VM was assigned. 55 | * 56 | * @return the to user 57 | */ 58 | public String toUser() { 59 | return toUser; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager.events/src/org/jdrupes/vmoperator/manager/events/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | /** 20 | * Domain specific {@link org.jgrapes.core.Event}s (and 21 | * {@link org.jgrapes.core.Channel}s) used to communicate between 22 | * the core components of the {@link org.jgrapes.core.Manager} and 23 | * "plugin" components such as the conlets. 24 | */ 25 | package org.jdrupes.vmoperator.manager.events; -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager/.checkstyle: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager/.eclipse-pmd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager/.gitignore: -------------------------------------------------------------------------------- 1 | /logging.properties 2 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager/.settings/net.sf.jautodoc.prefs: -------------------------------------------------------------------------------- 1 | add_header=true 2 | eclipse.preferences.version=1 3 | header_text=/*\n * VM-Operator\n * Copyright (C) 2024 Michael N. Lipp\n * \n * This program is free software\: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n */ 4 | project_specific_settings=true 5 | replacements=\n\n\nReturns the\nSets the\nAdds the\nEdits the\nRemoves the\nInits the\nParses the\nCreates the\nBuilds the\nChecks if is\nPrints the\nChecks for\n\n\n 6 | visibility_package=false 7 | visibility_private=false 8 | visibility_protected=false 9 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | arguments= 2 | auto.sync=false 3 | build.scans.enabled=false 4 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) 5 | connection.project.dir=.. 6 | eclipse.preferences.version=1 7 | gradle.user.home= 8 | java.home= 9 | jvm.arguments= 10 | offline.mode=false 11 | override.workspace.settings=false 12 | show.console.view=false 13 | show.executions.view=false 14 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager/.settings/org.eclipse.core.runtime.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | line.separator=\n 3 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager/checkstyle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager/resources/org/jdrupes/vmoperator/manager/ManagerIntro-Preview.md: -------------------------------------------------------------------------------- 1 | You can use the "puzzle piece" icon on the top right corner of the 2 | page to add display widgets (conlets) to the overview tab. 3 | 4 | Use the "full screen" icon on the top right corner of any 5 | conlet (if available) to get a detailed view. 6 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager/resources/org/jdrupes/vmoperator/manager/ManagerIntro-Preview_de.md: -------------------------------------------------------------------------------- 1 | Verwenden Sie das "Puzzle"-Icon auf der rechten oberen Ecke 2 | der Seite, um Anzeige-Widgets (Conlets) hinzuzufügen. 3 | 4 | Wenn sich in der rechten oberen Ecke eines Conlets ein Vollbild-Icon 5 | befindet, können Sie es verwenden, um eine Detailansicht in einem neuen 6 | Register anzufordern. 7 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager/resources/org/jdrupes/vmoperator/manager/VM-Operator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnlipp/VM-Operator/76b579c404f4ea691bf5a00cde47ddb8d35b1342/org.jdrupes.vmoperator.manager/resources/org/jdrupes/vmoperator/manager/VM-Operator.png -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager/resources/org/jdrupes/vmoperator/manager/console-brand.ftl.html: -------------------------------------------------------------------------------- 1 | ${_("consoleTitle")}  4 | (<#if clusterName()??>${clusterName() + "/"}${ namespace() }) -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager/resources/org/jdrupes/vmoperator/manager/console-footer.ftl.html: -------------------------------------------------------------------------------- 1 |
2 | Copyright © Michael N. Lipp 2023, 2025 3 |
4 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager/resources/org/jdrupes/vmoperator/manager/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnlipp/VM-Operator/76b579c404f4ea691bf5a00cde47ddb8d35b1342/org.jdrupes.vmoperator.manager/resources/org/jdrupes/vmoperator/manager/favicon.ico -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager/resources/org/jdrupes/vmoperator/manager/l10n.properties: -------------------------------------------------------------------------------- 1 | # 2 | # VM-Operator 3 | # Copyright (C) 2023 Michael N. Lipp 4 | # 5 | # This program is free software; you can redistribute it and/or modify it 6 | # under the terms of the GNU Affero General Public License as published by 7 | # the Free Software Foundation; either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License 13 | # for more details. 14 | # 15 | # You should have received a copy of the GNU Affero General Public License along 16 | # with this program; if not, see . 17 | # 18 | 19 | consoleTitle = VM-Operator 20 | introTitle = Usage -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager/resources/org/jdrupes/vmoperator/manager/l10n_de.properties: -------------------------------------------------------------------------------- 1 | # 2 | # VM-Operator 3 | # Copyright (C) 2024 Michael N. Lipp 4 | # 5 | # This program is free software; you can redistribute it and/or modify it 6 | # under the terms of the GNU Affero General Public License as published by 7 | # the Free Software Foundation; either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License 13 | # for more details. 14 | # 15 | # You should have received a copy of the GNU Affero General Public License along 16 | # with this program; if not, see . 17 | # 18 | 19 | introTitle = Benutzung 20 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager/resources/org/jdrupes/vmoperator/manager/logging.properties: -------------------------------------------------------------------------------- 1 | # 2 | # VM-Operator 3 | # Copyright (C) 2025 Michael N. Lipp 4 | # 5 | # This program is free software; you can redistribute it and/or modify it 6 | # under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | # for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License along 16 | # with this program; if not, see . 17 | # 18 | 19 | handlers=java.util.logging.ConsoleHandler, \ 20 | org.jgrapes.webconlet.logviewer.LogViewerHandler 21 | 22 | org.jdrupes.vmoperator.level=FINE 23 | 24 | java.util.logging.ConsoleHandler.level=ALL 25 | java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter 26 | java.util.logging.SimpleFormatter.format=%1$tb %1$td %1$tT %4$s %5$s%6$s%n 27 | 28 | org.jgrapes.webconlet.logviewer.LogViewerHandler.level=CONFIG 29 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager/resources/org/jdrupes/vmoperator/manager/runnerDataPvc.ftl.yaml: -------------------------------------------------------------------------------- 1 | kind: PersistentVolumeClaim 2 | apiVersion: v1 3 | metadata: 4 | namespace: ${ cr.namespace() } 5 | name: ${ runnerDataPvcName } 6 | labels: 7 | app.kubernetes.io/name: ${ constants.APP_NAME } 8 | app.kubernetes.io/instance: ${ cr.name() } 9 | app.kubernetes.io/managed-by: ${ constants.VM_OP_NAME } 10 | spec: 11 | accessModes: 12 | - ReadWriteOnce 13 | <#if reconciler.runnerDataPvc?? && reconciler.runnerDataPvc.storageClassName??> 14 | storageClassName: ${ reconciler.runnerDataPvc.storageClassName } 15 | 16 | resources: 17 | requests: 18 | storage: 1Mi 19 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager/resources/org/jdrupes/vmoperator/manager/runnerDiskPvc.ftl.yaml: -------------------------------------------------------------------------------- 1 | kind: PersistentVolumeClaim 2 | apiVersion: v1 3 | metadata: 4 | namespace: ${ cr.namespace() } 5 | name: ${ disk.generatedPvcName } 6 | labels: 7 | app.kubernetes.io/name: ${ constants.APP_NAME } 8 | app.kubernetes.io/instance: ${ cr.name() } 9 | app.kubernetes.io/managed-by: ${ constants.VM_OP_NAME } 10 | <#if disk.volumeClaimTemplate.metadata?? 11 | && disk.volumeClaimTemplate.metadata.annotations??> 12 | annotations: 13 | ${ toJson(disk.volumeClaimTemplate.metadata.annotations) } 14 | 15 | spec: 16 | ${ toJson(disk.volumeClaimTemplate.spec) } 17 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager/resources/org/jdrupes/vmoperator/manager/runnerLoadBalancer.ftl.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | namespace: ${ cr.namespace() } 5 | name: ${ cr.name() } 6 | labels: 7 | app.kubernetes.io/name: ${ constants.APP_NAME } 8 | app.kubernetes.io/instance: ${ cr.name() } 9 | app.kubernetes.io/managed-by: ${ constants.VM_OP_NAME } 10 | annotations: 11 | vmoperator.jdrupes.org/version: ${ managerVersion } 12 | ownerReferences: 13 | - apiVersion: ${ cr.apiVersion() } 14 | kind: ${ constants.Crd.KIND_VM } 15 | name: ${ cr.name() } 16 | uid: ${ cr.metadata().getUid() } 17 | controller: false 18 | 19 | spec: 20 | type: LoadBalancer 21 | ports: 22 | - name: spice 23 | port: ${ cr.spec().vm.display.spice.port?c } 24 | selector: 25 | app.kubernetes.io/name: ${ constants.APP_NAME } 26 | app.kubernetes.io/instance: ${ cr.name() } 27 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager/src/org/jdrupes/vmoperator/manager/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.manager; 20 | 21 | /** 22 | * Some constants. 23 | */ 24 | @SuppressWarnings("PMD.DataClass") 25 | public class Constants extends org.jdrupes.vmoperator.common.Constants { 26 | 27 | /** The Constant STATE_RUNNING. */ 28 | public static final String STATE_RUNNING = "Running"; 29 | 30 | /** The Constant STATE_STOPPED. */ 31 | public static final String STATE_STOPPED = "Stopped"; 32 | 33 | /** The Constant IMAGE_REPO_PATH. */ 34 | public static final String IMAGE_REPO_PATH 35 | = "/var/local/vmop-image-repository"; 36 | } 37 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager/src/org/jdrupes/vmoperator/manager/Containerfile: -------------------------------------------------------------------------------- 1 | FROM docker.io/eclipse-temurin:21-jre-alpine 2 | 3 | COPY build/install/vm-manager /opt/vmmanager 4 | 5 | CMD ["/opt/vmmanager/bin/vm-manager"] 6 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.manager/test-resources/basic-vm.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: "vmoperator.jdrupes.org/v1" 2 | kind: VirtualMachine 3 | metadata: 4 | namespace: vmop-test 5 | name: test-vm 6 | spec: 7 | image: 8 | repository: docker-registry.lan.mnl.de 9 | path: vmoperator/this.will.never.start 10 | version: 0.0.0 11 | 12 | cloudInit: 13 | metaData: {} 14 | 15 | vm: 16 | # state: Running 17 | maximumRam: 4Gi 18 | currentRam: 2Gi 19 | maximumCpus: 4 20 | currentCpus: 2 21 | powerdownTimeout: 1 22 | 23 | networks: 24 | - user: {} 25 | disks: 26 | - cdrom: 27 | image: https://test.com/test.iso 28 | bootindex: 0 29 | - cdrom: 30 | image: "image.iso" 31 | - volumeClaimTemplate: 32 | metadata: 33 | name: system 34 | annotations: 35 | use_as: system-disk 36 | spec: 37 | storageClassName: local-path 38 | resources: 39 | requests: 40 | storage: 1Gi 41 | - volumeClaimTemplate: 42 | spec: 43 | storageClassName: local-path 44 | resources: 45 | requests: 46 | storage: 1Gi 47 | 48 | display: 49 | outputs: 2 50 | spice: 51 | port: 5812 52 | usbRedirects: 2 53 | 54 | resources: 55 | requests: 56 | cpu: 1 57 | memory: 2Gi 58 | 59 | loadBalancerService: 60 | labels: 61 | label2: replaced 62 | label3: added 63 | annotations: 64 | anno1: added 65 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/.checkstyle: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/.eclipse-pmd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/.gitignore: -------------------------------------------------------------------------------- 1 | config.yaml 2 | /config-w11.yaml 3 | /config-fedora.yaml 4 | /config-test-vm.yaml 5 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/.settings/net.sf.jautodoc.prefs: -------------------------------------------------------------------------------- 1 | add_header=true 2 | eclipse.preferences.version=1 3 | header_text=/*\n * VM-Operator\n * Copyright (C) 2023 Michael N. Lipp\n * \n * This program is free software\: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n */ 4 | project_specific_settings=true 5 | replacements=\n\n\nReturns the\nSets the\nAdds the\nEdits the\nRemoves the\nInits the\nParses the\nCreates the\nBuilds the\nChecks if is\nPrints the\nChecks for\n\n\n 6 | visibility_package=false 7 | visibility_private=false 8 | visibility_protected=false 9 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | arguments= 2 | auto.sync=false 3 | build.scans.enabled=false 4 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) 5 | connection.project.dir=.. 6 | eclipse.preferences.version=1 7 | gradle.user.home= 8 | java.home= 9 | jvm.arguments= 10 | offline.mode=false 11 | override.workspace.settings=false 12 | show.console.view=false 13 | show.executions.view=false 14 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/.settings/org.eclipse.core.runtime.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | line.separator=\n 3 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/checkstyle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/display-password: -------------------------------------------------------------------------------- 1 | test-vm -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/helm-test/.helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *.orig 18 | *~ 19 | # Various IDEs 20 | .project 21 | .idea/ 22 | *.tmproj 23 | .vscode/ 24 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/helm-test/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v2 2 | name: vmrunner-qemu-test 3 | description: Create a vmrunner controlled qemu VM (from fixed resources) 4 | type: application 5 | 6 | # This is the chart version. 7 | version: "1.0.0" 8 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/helm-test/README.md: -------------------------------------------------------------------------------- 1 | # Helm chart for deploying VM 2 | 3 | Used for testing the runner. Generates the requires Kubernetes objects 4 | using helm. 5 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/helm-test/templates/_helpers.tpl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnlipp/VM-Operator/76b579c404f4ea691bf5a00cde47ddb8d35b1342/org.jdrupes.vmoperator.runner.qemu/helm-test/templates/_helpers.tpl -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/helm-test/templates/pod.yml: -------------------------------------------------------------------------------- 1 | kind: Pod 2 | apiVersion: v1 3 | metadata: 4 | namespace: {{ .Release.Namespace }} 5 | name: {{ .Release.Name }} 6 | labels: 7 | app: qemu-vm 8 | vm: {{ .Release.Name }} 9 | spec: 10 | containers: 11 | - name: {{ .Release.Name }} 12 | image: {{ .Values.image.repository }}/{{ .Values.image.path }}:{{ .Values.image.version }} 13 | resources: {} 14 | imagePullPolicy: {{ .Values.image.pullPolicy }} 15 | volumeMounts: 16 | # Not needed because pod is priviledged: 17 | # - mountPath: /dev/kvm 18 | # name: dev-kvm 19 | # - mountPath: /dev/net/tun 20 | # name: dev-tun 21 | # - mountPath: /sys/fs/cgroup 22 | # name: cgroup 23 | - mountPath: /etc/opt/vmrunner 24 | name: config 25 | - mountPath: /var/local/vm-data 26 | name: vm-data 27 | volumeDevices: 28 | {{- range $index, $disk := .Values.vm.disks }} 29 | - devicePath: /dev/disk-{{ $index }} 30 | name: disk-{{ $index }} 31 | {{- end }} 32 | securityContext: 33 | privileged: true 34 | volumes: 35 | # Not needed because pod is priviledged: 36 | # - name: dev-kvm 37 | # hostPath: 38 | # path: /dev/kvm 39 | # type: CharDevice 40 | # - hostPath: 41 | # path: /dev/net/tun 42 | # type: CharDevice 43 | # name: dev-tun 44 | # - name: cgroup 45 | # hostPath: 46 | # path: /sys/fs/cgroup 47 | - name: config 48 | configMap: 49 | name: {{ $.Release.Name }} 50 | - name: vm-data 51 | hostPath: 52 | path: /var/local/vmrunner/{{ .Release.Name }} 53 | {{- range $index, $disk := .Values.vm.disks }} 54 | - name: disk-{{ $index }} 55 | persistentVolumeClaim: 56 | claimName: {{ $.Release.Name }}-pvc-{{ $index }} 57 | {{- end }} 58 | hostNetwork: true 59 | terminationGracePeriodSeconds: 60 60 | restartPolicy: Never 61 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/helm-test/templates/pv.yaml: -------------------------------------------------------------------------------- 1 | {{- range $index, $disk := .Values.vm.disks }} 2 | --- 3 | apiVersion: v1 4 | kind: PersistentVolume 5 | metadata: 6 | name: {{ $.Release.Name }}-pv-{{ $index }} 7 | spec: 8 | capacity: 9 | storage: {{ .size }} 10 | volumeMode: Block 11 | accessModes: 12 | - ReadWriteOnce 13 | persistentVolumeReclaimPolicy: Retain 14 | storageClassName: "" 15 | claimRef: 16 | name: {{ $.Release.Name }}-pvc-{{ $index }} 17 | namespace: {{ $.Release.Namespace }} 18 | local: 19 | path: {{ .device }} 20 | nodeAffinity: 21 | required: 22 | nodeSelectorTerms: 23 | - matchExpressions: 24 | - key: kubernetes.io/hostname 25 | operator: In 26 | values: 27 | - {{ required "Valid .Values.vm.host entry required" $.Values.vm.host }} 28 | {{- end }} -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/helm-test/templates/pvc.yaml: -------------------------------------------------------------------------------- 1 | {{- range $index, $disk := .Values.vm.disks }} 2 | --- 3 | kind: PersistentVolumeClaim 4 | apiVersion: v1 5 | metadata: 6 | namespace: {{ $.Release.Namespace }} 7 | name: {{ $.Release.Name }}-pvc-{{ $index }} 8 | spec: 9 | accessModes: 10 | - ReadWriteOnce 11 | storageClassName: "" 12 | volumeMode: Block 13 | resources: 14 | requests: 15 | storage: {{ .size }} 16 | {{- end }} 17 | 18 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/helm-test/values.yaml: -------------------------------------------------------------------------------- 1 | # Default values for vmrunner helm test. 2 | 3 | image: 4 | repository: ghcr.io 5 | path: mnlipp/org.jdrupes.vmoperator.runner.qemu-arch 6 | version: latest 7 | pullPolicy: IfNotPresent 8 | 9 | vm: 10 | # machineUuid: "generated" 11 | # host: "No default" 12 | useTpm: false 13 | firmware: "uefi" 14 | cpuModel: "host" 15 | maximumCpus: 4 16 | currentCpus: 2 17 | maximumMemory: "1G" 18 | # currentMemory: "Optional" 19 | rtcBase: "utc" 20 | spicePort: 5901 21 | disks: 22 | - device: /dev/vg/lv 23 | size: 40Gi 24 | networks: 25 | - bridge: {} 26 | # name: br0 27 | # mac: "Optional" 28 | powerdownTimeout: 60 -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/logging.properties: -------------------------------------------------------------------------------- 1 | # 2 | # VM-Operator 3 | # Copyright (C) 2023 Michael N. Lipp 4 | # 5 | # This program is free software; you can redistribute it and/or modify it 6 | # under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | # for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License along 16 | # with this program; if not, see . 17 | # 18 | 19 | 20 | handlers=java.util.logging.ConsoleHandler 21 | 22 | org.jgrapes.level=FINE 23 | org.jgrapes.core.handlerTracking.level=FINER 24 | 25 | org.jdrupes.vmoperator.runner.qemu.level=FINE 26 | 27 | java.util.logging.ConsoleHandler.level=ALL 28 | java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter 29 | java.util.logging.SimpleFormatter.format=%1$tb %1$td %1$tT %4$s %5$s%6$s%n 30 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/password-expiry: -------------------------------------------------------------------------------- 1 | +1800 -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/resources/org/jdrupes/vmoperator/runner/qemu/defaults.yaml: -------------------------------------------------------------------------------- 1 | # Candidate paths for code and templates for firmware rom and vars 2 | "firmware": 3 | "bios": 4 | "rom": [] 5 | "vars": [] 6 | "uefi": 7 | "rom": 8 | - "/usr/share/edk2/ovmf/OVMF_CODE.fd" 9 | - "/usr/share/edk2/x64/OVMF_CODE.fd" 10 | - "/usr/share/OVMF/OVMF_CODE.fd" 11 | # Use 4M version as fallback (if smaller version not available) 12 | - "/usr/share/edk2/ovmf-4m/OVMF_CODE.fd" 13 | - "/usr/share/edk2/x64/OVMF_CODE.4m.fd" 14 | "vars": 15 | - "/usr/share/edk2/ovmf/OVMF_VARS.fd" 16 | - "/usr/share/edk2/x64/OVMF_VARS.fd" 17 | - "/usr/share/OVMF/OVMF_VARS.fd" 18 | # Use 4M version as fallback (if smaller version not available) 19 | - "/usr/share/edk2/ovmf-4m/OVMF_VARS.fd" 20 | - "/usr/share/edk2/x64/OVMF_VARS.4m.fd" 21 | "uefi-4m": 22 | "rom": 23 | - "/usr/share/edk2/ovmf-4m/OVMF_CODE.fd" 24 | - "/usr/share/edk2/x64/OVMF_CODE.4m.fd" 25 | "vars": 26 | - "/usr/share/edk2/ovmf-4m/OVMF_VARS.fd" 27 | - "/usr/share/edk2/x64/OVMF_VARS.4m.fd" 28 | "secure": 29 | "rom": 30 | - "/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd" 31 | - "/usr/share/edk2/x64/OVMF_CODE.secboot.fd" 32 | "vars": 33 | - "/usr/share/edk2/ovmf/OVMF_VARS.secboot.fd" 34 | - "/usr/share/edk2/x64/OVMF_VARS.fd" 35 | "secure-4m": 36 | "rom": 37 | - "/usr/share/edk2/ovmf-4m/OVMF_CODE.secboot.fd" 38 | - "/usr/share/edk2/x64/OVMF_CODE.secboot.4m.fd" 39 | "vars": 40 | - "/usr/share/edk2/ovmf-4m/OVMF_CODE.secboot.fd" 41 | - "/usr/share/edk2/x64/OVMF_VARS.4m.fd" 42 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/resources/org/jdrupes/vmoperator/runner/qemu/logging.properties: -------------------------------------------------------------------------------- 1 | # 2 | # VM-Operator 3 | # Copyright (C) 2023 Michael N. Lipp 4 | # 5 | # This program is free software; you can redistribute it and/or modify it 6 | # under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, but 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | # for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License along 16 | # with this program; if not, see . 17 | # 18 | 19 | handlers=java.util.logging.ConsoleHandler 20 | 21 | java.util.logging.ConsoleHandler.level=ALL 22 | java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter 23 | java.util.logging.SimpleFormatter.format=%1$tb %1$td %1$tT %4$s %5$s%6$s%n 24 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu; 20 | 21 | /** 22 | * Some constants. 23 | */ 24 | @SuppressWarnings("PMD.DataClass") 25 | public class Constants extends org.jdrupes.vmoperator.common.Constants { 26 | 27 | /** 28 | * Process names. 29 | */ 30 | public static class ProcessName { 31 | 32 | /** The Constant QEMU. */ 33 | public static final String QEMU = "qemu"; 34 | 35 | /** The Constant SWTPM. */ 36 | public static final String SWTPM = "swtpm"; 37 | 38 | /** The Constant CLOUD_INIT_IMG. */ 39 | public static final String CLOUD_INIT_IMG = "cloudInitImg"; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/Containerfile.alpine: -------------------------------------------------------------------------------- 1 | FROM docker.io/alpine 2 | 3 | RUN apk update 4 | 5 | RUN apk add qemu-system-x86_64 qemu-modules ovmf swtpm openjdk21 mtools 6 | 7 | RUN mkdir -p /etc/qemu && echo "allow all" > /etc/qemu/bridge.conf 8 | 9 | COPY build/install/vm-runner.qemu /opt/vmrunner 10 | COPY templates/* /opt/vmrunner/templates/ 11 | 12 | CMD ["/opt/vmrunner/bin/vm-runner.qemu"] 13 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/Containerfile.arch: -------------------------------------------------------------------------------- 1 | FROM docker.io/archlinux/archlinux:latest 2 | 3 | RUN systemd-firstboot 4 | 5 | RUN pacman-key --init \ 6 | && pacman -Sy --noconfirm archlinux-keyring && pacman -Su --noconfirm \ 7 | && pacman -S --noconfirm which qemu-full virtiofsd \ 8 | edk2-ovmf swtpm iproute2 bridge-utils jre21-openjdk-headless \ 9 | mtools \ 10 | && pacman -Scc --noconfirm 11 | 12 | # Remove all targets. 13 | RUN (cd /lib/systemd/system/sysinit.target.wants/; \ 14 | for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ 15 | rm -f /lib/systemd/system/multi-user.target.wants/*;\ 16 | rm -f /etc/systemd/system/*.wants/*;\ 17 | rm -f /lib/systemd/system/local-fs.target.wants/*; \ 18 | rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ 19 | rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ 20 | rm -f /lib/systemd/system/basic.target.wants/*;\ 21 | rm -f /lib/systemd/system/anaconda.target.wants/*; \ 22 | systemctl set-default multi-user.target 23 | 24 | RUN mkdir -p /etc/qemu && echo "allow all" > /etc/qemu/bridge.conf 25 | 26 | COPY build/install/vm-runner.qemu /opt/vmrunner 27 | COPY templates/* /opt/vmrunner/templates/ 28 | 29 | CMD ["/opt/vmrunner/bin/vm-runner.qemu"] 30 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/commands/QmpCapabilities.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.commands; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | 23 | /** 24 | * A {@link QmpCommand} that configures the Qmp capabilities. 25 | */ 26 | public class QmpCapabilities extends QmpCommand { 27 | 28 | @SuppressWarnings({ "PMD.FieldNamingConventions", 29 | "PMD.VariableNamingConventions" }) 30 | private static final JsonNode jsonTemplate 31 | = parseJson("{ \"execute\": \"qmp_capabilities\" }"); 32 | 33 | @Override 34 | public JsonNode toJson() { 35 | return jsonTemplate.deepCopy(); 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return "QmpCapabilities()"; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/commands/QmpCont.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.commands; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | 23 | /** 24 | * A {@link QmpCommand} that causes the Qemu process to continue execution. 25 | */ 26 | public class QmpCont extends QmpCommand { 27 | 28 | @SuppressWarnings({ "PMD.FieldNamingConventions", 29 | "PMD.VariableNamingConventions" }) 30 | private static final JsonNode jsonTemplate 31 | = parseJson("{ \"execute\": \"cont\" }"); 32 | 33 | @Override 34 | public JsonNode toJson() { 35 | return jsonTemplate.deepCopy(); 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return "QmpCont()"; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/commands/QmpDelCpu.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.commands; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | import com.fasterxml.jackson.databind.node.ObjectNode; 23 | 24 | // TODO: Auto-generated Javadoc 25 | /** 26 | * A {@link QmpCommand} that removes a CPU with the given id. 27 | */ 28 | public class QmpDelCpu extends QmpCommand { 29 | 30 | @SuppressWarnings({ "PMD.FieldNamingConventions", 31 | "PMD.VariableNamingConventions" }) 32 | private static final JsonNode jsonTemplate 33 | = parseJson("{ \"execute\": \"device_del\", " 34 | + "\"arguments\": " + "{ \"id\": 0 } }"); 35 | private final String cpuId; 36 | 37 | /** 38 | * Instantiates a new qmp del cpu. 39 | * 40 | * @param cpuId the cpu id 41 | */ 42 | public QmpDelCpu(String cpuId) { 43 | this.cpuId = cpuId; 44 | } 45 | 46 | @Override 47 | public JsonNode toJson() { 48 | var cmd = jsonTemplate.deepCopy(); 49 | ((ObjectNode) cmd.get("arguments")).put("id", cpuId); 50 | return cmd; 51 | } 52 | 53 | @Override 54 | public String toString() { 55 | return "QmpDelCpu(" + cpuId + ")"; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/commands/QmpGuestGetOsinfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2025 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.commands; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | import com.fasterxml.jackson.databind.node.ObjectNode; 23 | 24 | /** 25 | * A {@link QmpCommand} that pings the guest agent. 26 | */ 27 | public class QmpGuestGetOsinfo extends QmpCommand { 28 | 29 | @Override 30 | public JsonNode toJson() { 31 | ObjectNode cmd = mapper.createObjectNode(); 32 | cmd.put("execute", "guest-get-osinfo"); 33 | return cmd; 34 | } 35 | 36 | @Override 37 | public String toString() { 38 | return "QmpGuestGetOsinfo()"; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/commands/QmpGuestInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2025 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.commands; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | import com.fasterxml.jackson.databind.node.ObjectNode; 23 | 24 | /** 25 | * A {@link QmpCommand} that requests the guest info. 26 | */ 27 | public class QmpGuestInfo extends QmpCommand { 28 | 29 | @Override 30 | public JsonNode toJson() { 31 | ObjectNode cmd = mapper.createObjectNode(); 32 | cmd.put("execute", "guest-info"); 33 | return cmd; 34 | } 35 | 36 | @Override 37 | public String toString() { 38 | return "QmpGuestInfo()"; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/commands/QmpGuestPing.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.commands; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | import com.fasterxml.jackson.databind.node.ObjectNode; 23 | 24 | /** 25 | * A {@link QmpCommand} that pings the guest agent. 26 | */ 27 | public class QmpGuestPing extends QmpCommand { 28 | 29 | @Override 30 | public JsonNode toJson() { 31 | ObjectNode cmd = mapper.createObjectNode(); 32 | cmd.put("execute", "guest-ping"); 33 | return cmd; 34 | } 35 | 36 | @Override 37 | public String toString() { 38 | return "QmpGuestPing()"; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/commands/QmpGuestPowerdown.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2025 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.commands; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | import com.fasterxml.jackson.databind.node.ObjectNode; 23 | 24 | /** 25 | * A {@link QmpCommand} that powers down the guest. 26 | */ 27 | public class QmpGuestPowerdown extends QmpCommand { 28 | 29 | @Override 30 | public JsonNode toJson() { 31 | ObjectNode cmd = mapper.createObjectNode(); 32 | cmd.put("execute", "guest-shutdown"); 33 | return cmd; 34 | } 35 | 36 | @Override 37 | public String toString() { 38 | return "QmpGuestPowerdown()"; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/commands/QmpOpenTray.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.commands; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | import com.fasterxml.jackson.databind.node.ObjectNode; 23 | 24 | // TODO: Auto-generated Javadoc 25 | /** 26 | * A {@link QmpCommand} that causes a CDROM drive's tray to be opened. 27 | */ 28 | public class QmpOpenTray extends QmpCommand { 29 | 30 | @SuppressWarnings({ "PMD.FieldNamingConventions", 31 | "PMD.VariableNamingConventions" }) 32 | private static final JsonNode jsonTemplate 33 | = parseJson("{ \"execute\": \"blockdev-open-tray\",\"arguments\": {" 34 | + "\"id\": \"\" } }"); 35 | private final String driveId; 36 | 37 | /** 38 | * Instantiates a new qmp open tray. 39 | * 40 | * @param driveId the drive id 41 | */ 42 | public QmpOpenTray(String driveId) { 43 | this.driveId = driveId; 44 | } 45 | 46 | @Override 47 | public JsonNode toJson() { 48 | var cmd = jsonTemplate.deepCopy(); 49 | ((ObjectNode) cmd.get("arguments")).put("id", driveId); 50 | return cmd; 51 | } 52 | 53 | @Override 54 | public String toString() { 55 | return "QmpOpenTray(" + driveId + ")"; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/commands/QmpPowerdown.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.commands; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | 23 | /** 24 | * A {@link QmpCommand} that send a system_powerdown to the VM. 25 | */ 26 | public class QmpPowerdown extends QmpCommand { 27 | 28 | @SuppressWarnings({ "PMD.FieldNamingConventions", 29 | "PMD.VariableNamingConventions" }) 30 | private static final JsonNode jsonTemplate 31 | = parseJson("{ \"execute\": \"system_powerdown\" }"); 32 | 33 | @Override 34 | public JsonNode toJson() { 35 | return jsonTemplate.deepCopy(); 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return "QmpPowerdown()"; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/commands/QmpQueryHotpluggableCpus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.commands; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | 23 | /** 24 | * A {@link QmpCommand} that queries the hotpluggable CPUs. 25 | */ 26 | public class QmpQueryHotpluggableCpus extends QmpCommand { 27 | 28 | @SuppressWarnings({ "PMD.FieldNamingConventions", 29 | "PMD.VariableNamingConventions" }) 30 | private static final JsonNode jsonTemplate = parseJson( 31 | "{\"execute\":\"query-hotpluggable-cpus\",\"arguments\":{}}"); 32 | 33 | @Override 34 | public JsonNode toJson() { 35 | return jsonTemplate.deepCopy(); 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return "QmpQueryHotpluggableCpus()"; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/commands/QmpReset.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.commands; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | 23 | /** 24 | * A {@link QmpCommand} that send a system_reset to the VM. 25 | */ 26 | public class QmpReset extends QmpCommand { 27 | 28 | @SuppressWarnings({ "PMD.FieldNamingConventions", 29 | "PMD.VariableNamingConventions" }) 30 | private static final JsonNode jsonTemplate 31 | = parseJson("{ \"execute\": \"system_reset\" }"); 32 | 33 | @Override 34 | public JsonNode toJson() { 35 | return jsonTemplate.deepCopy(); 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return "QmpReset()"; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/commands/QmpSetBalloon.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.commands; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | import com.fasterxml.jackson.databind.node.ObjectNode; 23 | import java.math.BigInteger; 24 | 25 | // TODO: Auto-generated Javadoc 26 | /** 27 | * A {@link QmpCommand} that sets the balloon value. 28 | */ 29 | public class QmpSetBalloon extends QmpCommand { 30 | 31 | @SuppressWarnings({ "PMD.FieldNamingConventions", 32 | "PMD.VariableNamingConventions" }) 33 | private static final JsonNode jsonTemplate 34 | = parseJson("{ \"execute\": \"balloon\", " 35 | + "\"arguments\": " + "{ \"value\": 0 } }"); 36 | private final BigInteger size; 37 | 38 | /** 39 | * Instantiates a new qmp set balloon. 40 | * 41 | * @param size the size 42 | */ 43 | public QmpSetBalloon(BigInteger size) { 44 | this.size = size; 45 | } 46 | 47 | @Override 48 | public JsonNode toJson() { 49 | var cmd = jsonTemplate.deepCopy(); 50 | ((ObjectNode) cmd.get("arguments")).put("value", size); 51 | return cmd; 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | return "QmpSetBalloon(" + size + ")"; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/commands/package-info.java: -------------------------------------------------------------------------------- 1 | package org.jdrupes.vmoperator.runner.qemu.commands; -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/events/BalloonChangeEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.events; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | import java.math.BigInteger; 23 | 24 | /** 25 | * Signals a change of the balloon. 26 | */ 27 | public class BalloonChangeEvent extends MonitorEvent { 28 | 29 | /** 30 | * Instantiates a new tray moved. 31 | * 32 | * @param kind the kind 33 | * @param data the data 34 | */ 35 | public BalloonChangeEvent(Kind kind, JsonNode data) { 36 | super(kind, data); 37 | } 38 | 39 | /** 40 | * Returns the actual value. 41 | * 42 | * @return the actual value 43 | */ 44 | public BigInteger size() { 45 | return new BigInteger(data().get("actual").asText()); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/events/CpuAdded.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.events; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | import org.jdrupes.vmoperator.runner.qemu.commands.QmpCommand; 23 | 24 | /** 25 | * A {@link MonitorResult} that indicates that a CPU has been added. 26 | */ 27 | public class CpuAdded extends MonitorResult { 28 | 29 | /** 30 | * Instantiates a new cpu added. 31 | * 32 | * @param command the command 33 | * @param response the response 34 | */ 35 | public CpuAdded(QmpCommand command, JsonNode response) { 36 | super(command, response); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/events/CpuDeleted.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.events; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | import org.jdrupes.vmoperator.runner.qemu.commands.QmpCommand; 23 | 24 | /** 25 | * A {@link MonitorResult} that indicates that a CPU has been deleted. 26 | */ 27 | public class CpuDeleted extends MonitorResult { 28 | 29 | /** 30 | * Instantiates a new cpu deleted. 31 | * 32 | * @param command the command 33 | * @param response the response 34 | */ 35 | public CpuDeleted(QmpCommand command, JsonNode response) { 36 | super(command, response); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/events/DisplayPasswordChanged.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2024 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.events; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | import org.jdrupes.vmoperator.runner.qemu.commands.QmpCommand; 23 | 24 | /** 25 | * A {@link MonitorResult} that indicates that the display password has changed. 26 | */ 27 | public class DisplayPasswordChanged extends MonitorResult { 28 | 29 | /** 30 | * Instantiates a new display password changed. 31 | * 32 | * @param command the command 33 | * @param response the response 34 | */ 35 | public DisplayPasswordChanged(QmpCommand command, JsonNode response) { 36 | super(command, response); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/events/Exit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2024 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.events; 20 | 21 | import org.jgrapes.core.events.Stop; 22 | 23 | /** 24 | * Like {@link Stop}, but sets an exit status. 25 | */ 26 | @SuppressWarnings("PMD.ShortClassName") 27 | public class Exit extends Stop { 28 | 29 | private final int exitStatus; 30 | 31 | /** 32 | * Instantiates a new exit. 33 | * 34 | * @param exitStatus the exit status 35 | */ 36 | public Exit(int exitStatus) { 37 | this.exitStatus = exitStatus; 38 | } 39 | 40 | public int exitStatus() { 41 | return exitStatus; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/events/MonitorReady.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.events; 20 | 21 | /** 22 | * Signals that the connection to the Qemu monitor socket has been 23 | * established successfully. 24 | */ 25 | public class MonitorReady extends MonitorEvent { 26 | 27 | /** 28 | * Instantiates a new monitor ready. 29 | */ 30 | public MonitorReady() { 31 | super(Kind.READY, null); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/events/OsinfoEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2025 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.events; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | import org.jgrapes.core.Channel; 23 | import org.jgrapes.core.Components; 24 | import org.jgrapes.core.Event; 25 | 26 | /** 27 | * Signals information about the guest OS. 28 | */ 29 | public class OsinfoEvent extends Event { 30 | 31 | private final JsonNode osinfo; 32 | 33 | /** 34 | * Instantiates a new osinfo event. 35 | * 36 | * @param data the data 37 | */ 38 | public OsinfoEvent(JsonNode data) { 39 | osinfo = data; 40 | } 41 | 42 | public JsonNode osinfo() { 43 | return osinfo; 44 | } 45 | 46 | /* 47 | * (non-Javadoc) 48 | * 49 | * @see java.lang.Object#toString() 50 | */ 51 | @Override 52 | public String toString() { 53 | StringBuilder builder = new StringBuilder(); 54 | builder.append(Components.objectName(this)).append(" [") 55 | .append(osinfo); 56 | if (channels() != null) { 57 | builder.append(", channels=").append(Channel.toString(channels())); 58 | } 59 | builder.append(']'); 60 | return builder.toString(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/events/PowerdownEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.events; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | import org.jdrupes.vmoperator.runner.qemu.commands.QmpPowerdown; 23 | 24 | /** 25 | * Signals the processing of the {@link QmpPowerdown} event. 26 | */ 27 | public class PowerdownEvent extends MonitorEvent { 28 | 29 | /** 30 | * Instantiates a new powerdown event. 31 | * 32 | * @param kind the kind 33 | * @param data the data 34 | */ 35 | public PowerdownEvent(Kind kind, JsonNode data) { 36 | super(kind, data); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/events/QmpConfigured.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.events; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | import org.jdrupes.vmoperator.runner.qemu.commands.QmpCommand; 23 | 24 | /** 25 | * Signals that the QMP capabilities have been enabled. 26 | */ 27 | public class QmpConfigured extends MonitorResult { 28 | 29 | /** 30 | * Instantiates a new monitor ready. 31 | */ 32 | public QmpConfigured(QmpCommand command, JsonNode response) { 33 | super(command, response); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/events/ShutdownEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2024 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.events; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | 23 | /** 24 | * Signals the reception of a SHUTDOWN event. 25 | */ 26 | public class ShutdownEvent extends MonitorEvent { 27 | 28 | /** 29 | * Instantiates a new shutdown event. 30 | * 31 | * @param kind the kind 32 | * @param data the data 33 | */ 34 | public ShutdownEvent(Kind kind, JsonNode data) { 35 | super(kind, data); 36 | } 37 | 38 | /** 39 | * returns if this is initiated by the guest. 40 | * 41 | * @return the value 42 | */ 43 | public boolean byGuest() { 44 | return data().get("guest").asBoolean(); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/events/SpiceConnectedEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.events; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | 23 | /** 24 | * Signals a connection from a client. 25 | */ 26 | public class SpiceConnectedEvent extends SpiceEvent { 27 | 28 | /** 29 | * Instantiates a new spice connected event. 30 | * 31 | * @param kind the kind 32 | * @param data the data 33 | */ 34 | public SpiceConnectedEvent(Kind kind, JsonNode data) { 35 | super(kind, data); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/events/SpiceDisconnectedEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.events; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | 23 | /** 24 | * Signals a connection from a client. 25 | */ 26 | public class SpiceDisconnectedEvent extends SpiceEvent { 27 | 28 | /** 29 | * Instantiates a new spice disconnected event. 30 | * 31 | * @param kind the kind 32 | * @param data the data 33 | */ 34 | public SpiceDisconnectedEvent(Kind kind, JsonNode data) { 35 | super(kind, data); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/events/SpiceEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.events; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | 23 | /** 24 | * Signals a connection from a client. 25 | */ 26 | public class SpiceEvent extends MonitorEvent { 27 | 28 | /** 29 | * Instantiates a new tray moved. 30 | * 31 | * @param kind the kind 32 | * @param data the data 33 | */ 34 | public SpiceEvent(Kind kind, JsonNode data) { 35 | super(kind, data); 36 | } 37 | 38 | /** 39 | * Returns the client's host. 40 | * 41 | * @return the client's host address 42 | */ 43 | public String clientHost() { 44 | return data().get("client").get("host").asText(); 45 | } 46 | 47 | /** 48 | * Returns the client's port. 49 | * 50 | * @return the client's port number 51 | */ 52 | public long clientPort() { 53 | return data().get("client").get("port").asLong(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/events/SpiceInitializedEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.events; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | 23 | /** 24 | * Signals a connection from a client. 25 | */ 26 | public class SpiceInitializedEvent extends SpiceEvent { 27 | 28 | /** 29 | * Instantiates a new spice connected event. 30 | * 31 | * @param kind the kind 32 | * @param data the data 33 | */ 34 | public SpiceInitializedEvent(Kind kind, JsonNode data) { 35 | super(kind, data); 36 | } 37 | 38 | /** 39 | * Returns the channel type. 40 | * 41 | * @return the channel type 42 | */ 43 | public int channelType() { 44 | return data().get("client").get("channel-type").asInt(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/events/TrayMovedEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.events; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | import org.jdrupes.vmoperator.runner.qemu.CdMediaController.TrayState; 23 | 24 | /** 25 | * Signals a change of tray state of one of the VM's CDROM drives. 26 | */ 27 | public class TrayMovedEvent extends MonitorEvent { 28 | 29 | /** 30 | * Instantiates a new tray moved. 31 | * 32 | * @param kind the kind 33 | * @param data the data 34 | */ 35 | public TrayMovedEvent(Kind kind, JsonNode data) { 36 | super(kind, data); 37 | } 38 | 39 | /** 40 | * returns the drive id. 41 | * 42 | * @return the string 43 | */ 44 | public String driveId() { 45 | return data().get("id").asText(); 46 | } 47 | 48 | /** 49 | * Returns the tray state. 50 | * 51 | * @return the tray state 52 | */ 53 | public TrayState trayState() { 54 | return data().get("tray-open").asBoolean() 55 | ? TrayState.OPEN 56 | : TrayState.CLOSED; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/events/VmopAgentConnected.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2025 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.events; 20 | 21 | import org.jgrapes.core.Event; 22 | 23 | /** 24 | * Signals information about the guest OS. 25 | */ 26 | public class VmopAgentConnected extends Event { 27 | } 28 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/events/VmopAgentLogIn.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2025 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.events; 20 | 21 | import org.jgrapes.core.Event; 22 | 23 | /** 24 | * Sends the login command to the VM operator agent. 25 | */ 26 | public class VmopAgentLogIn extends Event { 27 | 28 | private final String user; 29 | 30 | /** 31 | * Instantiates a new vmop agent logout. 32 | */ 33 | public VmopAgentLogIn(String user) { 34 | this.user = user; 35 | } 36 | 37 | /** 38 | * Returns the user. 39 | * 40 | * @return the user 41 | */ 42 | public String user() { 43 | return user; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/events/VmopAgentLogOut.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2025 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.events; 20 | 21 | import org.jgrapes.core.Event; 22 | 23 | /** 24 | * Sends the logout command to the VM operator agent. 25 | */ 26 | public class VmopAgentLogOut extends Event { 27 | } 28 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/events/VmopAgentLoggedIn.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2025 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.events; 20 | 21 | import org.jgrapes.core.Event; 22 | 23 | /** 24 | * Signals that the logout command has been processes by the 25 | * VM operator agent. 26 | */ 27 | public class VmopAgentLoggedIn extends Event { 28 | 29 | private final VmopAgentLogIn triggering; 30 | 31 | /** 32 | * Instantiates a new vmop agent logged in. 33 | * 34 | * @param triggeringEvent the triggering event 35 | */ 36 | public VmopAgentLoggedIn(VmopAgentLogIn triggeringEvent) { 37 | this.triggering = triggeringEvent; 38 | } 39 | 40 | /** 41 | * Gets the triggering event. 42 | * 43 | * @return the triggering 44 | */ 45 | public VmopAgentLogIn triggering() { 46 | return triggering; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/events/VmopAgentLoggedOut.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2025 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.events; 20 | 21 | import org.jgrapes.core.Event; 22 | 23 | /** 24 | * Signals that the logout command has been processes by the 25 | * VM operator agent. 26 | */ 27 | public class VmopAgentLoggedOut extends Event { 28 | 29 | private final VmopAgentLogOut triggering; 30 | 31 | /** 32 | * Instantiates a new vmop agent logged out. 33 | * 34 | * @param triggeringEvent the triggering event 35 | */ 36 | public VmopAgentLoggedOut(VmopAgentLogOut triggeringEvent) { 37 | this.triggering = triggeringEvent; 38 | } 39 | 40 | /** 41 | * Gets the triggering event. 42 | * 43 | * @return the triggering 44 | */ 45 | public VmopAgentLogOut triggering() { 46 | return triggering; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/events/VserportChangeEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu.events; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | 23 | /** 24 | * Signals a virtual serial port's open state change. 25 | */ 26 | public class VserportChangeEvent extends MonitorEvent { 27 | 28 | /** 29 | * Initializes a new instance. 30 | * 31 | * @param kind the kind 32 | * @param data the data 33 | */ 34 | public VserportChangeEvent(Kind kind, JsonNode data) { 35 | super(kind, data); 36 | } 37 | 38 | /** 39 | * Return the channel's id. 40 | * 41 | * @return the string 42 | */ 43 | @SuppressWarnings("PMD.ShortMethodName") 44 | public String id() { 45 | return data().get("id").asText(); 46 | } 47 | 48 | /** 49 | * Returns the open state of the port. 50 | * 51 | * @return true, if is open 52 | */ 53 | public boolean isOpen() { 54 | return Boolean.parseBoolean(data().get("open").asText()); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/events/package-info.java: -------------------------------------------------------------------------------- 1 | package org.jdrupes.vmoperator.runner.qemu.events; -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.runner.qemu/src/org/jdrupes/vmoperator/runner/qemu/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.runner.qemu; 20 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.util/.checkstyle: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.util/.eclipse-pmd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.util/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | arguments= 2 | auto.sync=false 3 | build.scans.enabled=false 4 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) 5 | connection.project.dir=.. 6 | eclipse.preferences.version=1 7 | gradle.user.home= 8 | java.home= 9 | jvm.arguments= 10 | offline.mode=false 11 | override.workspace.settings=false 12 | show.console.view=false 13 | show.executions.view=false 14 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.util/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.util/.settings/org.eclipse.core.runtime.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | line.separator=\n 3 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.util/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * This project uses @Incubating APIs which are subject to change. 5 | */ 6 | 7 | plugins { 8 | id 'org.jdrupes.vmoperator.java-library-conventions' 9 | } 10 | 11 | dependencies { 12 | api 'org.freemarker:freemarker:[2.3.32,2.4)' 13 | api 'com.google.code.gson:gson:2.10.1' 14 | } 15 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.util/src/org/jdrupes/vmoperator/util/Dto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.util; 20 | 21 | /** 22 | * Marks a class as the definition of a data transfer object. 23 | * DTOs have public attributes and usually no behavior (though 24 | * the can have e.g. methods for checking the consistency. 25 | * 26 | * The DTO marker affects the conversion of objects to other 27 | * representations. 28 | */ 29 | @SuppressWarnings("PMD.ShortClassName") 30 | public interface Dto { 31 | 32 | } 33 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.util/src/org/jdrupes/vmoperator/util/ExtendedObjectWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.util; 20 | 21 | import freemarker.template.DefaultObjectWrapper; 22 | import freemarker.template.TemplateModel; 23 | import freemarker.template.TemplateModelException; 24 | import freemarker.template.Version; 25 | 26 | /** 27 | * Provides an object wrapper that handles {@link Dto}s. 28 | */ 29 | public class ExtendedObjectWrapper extends DefaultObjectWrapper { 30 | 31 | /** 32 | * Instantiates a new extended object wrapper. 33 | * 34 | * @param incompatibleImprovements the incompatible improvements 35 | */ 36 | public ExtendedObjectWrapper(Version incompatibleImprovements) { 37 | super(incompatibleImprovements); 38 | } 39 | 40 | @Override 41 | protected TemplateModel handleUnknownType(final Object obj) 42 | throws TemplateModelException { 43 | if (obj instanceof Dto dto) { 44 | return new DtoTemplateModel(this, dto); 45 | } 46 | return super.handleUnknownType(obj); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.util/src/org/jdrupes/vmoperator/util/LongLoggingManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.util; 20 | 21 | import java.util.logging.LogManager; 22 | 23 | /** 24 | * A logging manager that isn't disabled by a shutdown hook. 25 | */ 26 | public class LongLoggingManager extends LogManager { 27 | private static LongLoggingManager instance; 28 | 29 | /** 30 | * Instantiates a new long logging manager. 31 | */ 32 | @SuppressWarnings("PMD.AssignmentToNonFinalStatic") 33 | public LongLoggingManager() { 34 | instance = this; 35 | } 36 | 37 | @Override 38 | public void reset() { 39 | /* don't reset yet. */ 40 | } 41 | 42 | private void reset0() { 43 | super.reset(); 44 | } 45 | 46 | /** 47 | * Reset finally. 48 | */ 49 | public static void resetFinally() { 50 | instance.reset0(); 51 | } 52 | } -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.util/src/org/jdrupes/vmoperator/util/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | /** 20 | * General utility classes and methods that are independent of the 21 | * specific domain (VM operator). 22 | */ 23 | package org.jdrupes.vmoperator.util; -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.util/test/org/jdrupes/vmoperator/util/DataPathTests.java: -------------------------------------------------------------------------------- 1 | package org.jdrupes.vmoperator.util; 2 | 3 | import static org.junit.jupiter.api.Assertions.*; 4 | import org.junit.jupiter.api.Test; 5 | 6 | class DataPathTests { 7 | 8 | @Test 9 | void testArray() { 10 | int[] orig 11 | = { Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3) }; 12 | var copy = DataPath.deepCopy(orig); 13 | for (int i = 0; i < orig.length; i++) { 14 | assertEquals(orig[i], copy[i]); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/.checkstyle: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/.eclipse-pmd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/.eslintignore: -------------------------------------------------------------------------------- 1 | rollup.config.mjs 2 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "eslint:recommended", 4 | "plugin:@typescript-eslint/recommended" 5 | ], 6 | "parser": "@typescript-eslint/parser", 7 | "parserOptions": { "project": ["./tsconfig.json"] }, 8 | "plugins": [ 9 | "@typescript-eslint" 10 | ], 11 | "rules": { 12 | "constructor-super": "off" 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | /bin_test/ 3 | /generated/ 4 | /build/ 5 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | build.commands=org.eclipse.jdt.core.javabuilder 2 | connection.arguments= 3 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) 4 | connection.java.home=null 5 | connection.jvm.arguments= 6 | connection.project.dir=.. 7 | derived.resources=.gradle,generated 8 | eclipse.preferences.version=1 9 | natures=org.eclipse.jdt.groovy.core.groovyNature,org.eclipse.jdt.core.javanature 10 | project.path=\:org.jgrapes.osgi.conlets.services 11 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/.settings/org.eclipse.core.runtime.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | line.separator=\n 3 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'org.jdrupes.vmoperator.java-library-conventions' 3 | } 4 | 5 | dependencies { 6 | implementation project(':org.jdrupes.vmoperator.manager.events') 7 | 8 | implementation 'org.jgrapes:org.jgrapes.webconsole.base:[2.1.0,3)' 9 | implementation 'org.jgrapes:org.jgrapes.webconsole.provider.vue:[1,2)' 10 | implementation 'org.jgrapes:org.jgrapes.webconsole.provider.jgwcvuecomponents:[1.2,2)' 11 | implementation 'org.jgrapes:org.jgrapes.webconsole.provider.chartjs:[1.2,2)' 12 | 13 | } 14 | 15 | apply plugin: 'com.github.node-gradle.node' 16 | 17 | node { 18 | download = true 19 | } 20 | 21 | task extractDependencies(type: Copy) { 22 | from configurations.compileClasspath 23 | .findAll{ it.name.contains('.provider.') 24 | || it.name.contains('org.jgrapes.webconsole.base') 25 | } 26 | .collect{ zipTree (it) } 27 | exclude '*.class' 28 | into 'build/unpacked' 29 | duplicatesStrategy 'include' 30 | } 31 | 32 | task compileTs(type: NodeTask) { 33 | dependsOn ':npmInstall' 34 | dependsOn extractDependencies 35 | inputs.dir project.file('src') 36 | inputs.file project.file('tsconfig.json') 37 | inputs.file project.file('rollup.config.mjs') 38 | outputs.dir project.file('build/generated/resources') 39 | script = file("${rootProject.rootDir}/node_modules/rollup/dist/bin/rollup") 40 | args = ["-c"] 41 | } 42 | 43 | sourceSets { 44 | main { 45 | resources { 46 | srcDir project.file('build/generated/resources') 47 | } 48 | } 49 | } 50 | 51 | processResources { 52 | dependsOn compileTs 53 | } 54 | 55 | eclipse { 56 | autoBuildTasks compileTs 57 | } 58 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/resources/META-INF/services/org.jgrapes.webconsole.base.ConletComponentFactory: -------------------------------------------------------------------------------- 1 | org.jdrupes.vmoperator.vmaccess.VmAccessFactory 2 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/resources/org/jdrupes/vmoperator/vmaccess/VmAccess-confirmReset.ftl.html: -------------------------------------------------------------------------------- 1 |
3 |

${_("confirmResetMsg")}

4 |

5 | 7 | 8 | 9 | 10 | 11 | 12 |

13 |
-------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/resources/org/jdrupes/vmoperator/vmaccess/VmAccess-edit.ftl.html: -------------------------------------------------------------------------------- 1 |
6 |
7 |
8 |
9 | {{ localize("Select VM or pool") }} 10 |
    11 |
  • 12 | 22 |
  • 23 |
  • 24 | 34 |
  • 35 |
36 |
37 |
38 |
39 |
40 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/resources/org/jdrupes/vmoperator/vmaccess/VmAccess-l10nBundles.ftl.js: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2024 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | "use strict"; 20 | 21 | const l10nBundles = new Map(); 22 | let entries = null; 23 | // <#list supportedLanguages() as l> 24 | entries = new Map(); 25 | l10nBundles.set("${l.locale.toLanguageTag()}", entries); 26 | // <#list l.l10nBundle.keys as key> 27 | entries.set("${key}", "${l.l10nBundle.getString(key)}"); 28 | // 29 | // 30 | 31 | export default l10nBundles; 32 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/resources/org/jdrupes/vmoperator/vmaccess/VmAccess-preview.ftl.html: -------------------------------------------------------------------------------- 1 |
7 |
8 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/resources/org/jdrupes/vmoperator/vmaccess/l10n.properties: -------------------------------------------------------------------------------- 1 | conletName = VM Access 2 | 3 | okayLabel = Apply and Close 4 | 5 | confirmResetTitle = Confirm reset 6 | confirmResetMsg = Resetting the VM may cause loss of data. \ 7 | Please confirm to continue. 8 | consoleInaccessibleNotification = Console is not ready or in use. 9 | poolEmptyNotification = No VM available. Please consult your administrator. 10 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/resources/org/jdrupes/vmoperator/vmaccess/l10n_de.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnlipp/VM-Operator/76b579c404f4ea691bf5a00cde47ddb8d35b1342/org.jdrupes.vmoperator.vmaccess/resources/org/jdrupes/vmoperator/vmaccess/l10n_de.properties -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/resources/org/jdrupes/vmoperator/vmaccess/l10n_en.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnlipp/VM-Operator/76b579c404f4ea691bf5a00cde47ddb8d35b1342/org.jdrupes.vmoperator.vmaccess/resources/org/jdrupes/vmoperator/vmaccess/l10n_en.properties -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/resources/org/jdrupes/vmoperator/vmaccess/osicons/Licenses.txt: -------------------------------------------------------------------------------- 1 | almalinux.svg: 2 | Source: https://commons.wikimedia.org/wiki/File:AlmaLinux_Icon_Logo.svg 3 | License: https://github.com/AlmaLinux/wiki/blob/master/LICENSE 4 | 5 | archlinux.svg: 6 | Source: https://commons.wikimedia.org/wiki/File:Arch_Linux_%22Crystal%22_icon.svghttps://commons.wikimedia.org/wiki/File:Arch_Linux_%22Crystal%22_icon.svg 7 | License: GPL v2 or later 8 | 9 | debian.svg: 10 | Source: https://commons.wikimedia.org/wiki/File:Openlogo-debianV2.svg 11 | License : LGPL 12 | 13 | fedora.svg: 14 | Source: https://commons.wikimedia.org/wiki/File:Fedora_icon_(2021).svg 15 | License: Public Domain 16 | 17 | tux.svg: 18 | Source: https://commons.wikimedia.org/wiki/File:Tux.svghttps://commons.wikimedia.org/wiki/File:Tux.svg 19 | License: Creative Commons CC0 1.0 Universal Public Domain Dedication. Creative Commons CC0 1.0 Universal Public Domain Dedication. 20 | 21 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/resources/org/jdrupes/vmoperator/vmaccess/osicons/fedora.svg: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 12 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/resources/org/jdrupes/vmoperator/vmaccess/osicons/ubuntu.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/resources/org/jdrupes/vmoperator/vmaccess/osicons/windows.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/rollup.config.mjs: -------------------------------------------------------------------------------- 1 | import typescript from 'rollup-plugin-typescript2'; 2 | import postcss from 'rollup-plugin-postcss'; 3 | 4 | let packagePath = "org/jdrupes/vmoperator/vmaccess"; 5 | let baseName = "VmAccess" 6 | let module = "build/generated/resources/" + packagePath 7 | + "/" + baseName + "-functions.js"; 8 | 9 | let pathsMap = { 10 | "aash-plugin": "../../page-resource/aash-vue-components/lib/aash-vue-components.js", 11 | "jgconsole": "../../console-base-resource/jgconsole.js", 12 | "jgwc": "../../page-resource/jgwc-vue-components/jgwc-components.js", 13 | "l10nBundles": "./" + baseName + "-l10nBundles.ftl.js", 14 | "vue": "../../page-resource/vue/vue.esm-browser.js" 15 | } 16 | 17 | export default { 18 | external: ['aash-plugin', 'jgconsole', 'jgwc', 'l10nBundles', 'vue', 'chartjs'], 19 | input: "src/" + packagePath + "/browser/" + baseName + "-functions.ts", 20 | output: [ 21 | { 22 | format: "esm", 23 | file: module, 24 | sourcemap: true, 25 | sourcemapPathTransform: (relativeSourcePath, _sourcemapPath) => { 26 | return relativeSourcePath.replace(/^([^/]*\/){12}/, "./"); 27 | }, 28 | paths: pathsMap 29 | } 30 | ], 31 | plugins: [ 32 | typescript(), 33 | postcss() 34 | ] 35 | }; 36 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/src/org/jdrupes/vmoperator/vmaccess/VmAccessFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.vmaccess; 20 | 21 | import java.util.Map; 22 | import java.util.Optional; 23 | import org.jgrapes.core.Channel; 24 | import org.jgrapes.core.ComponentType; 25 | import org.jgrapes.webconsole.base.ConletComponentFactory; 26 | 27 | /** 28 | * The factory service for {@link VmAccess}s. 29 | */ 30 | public class VmAccessFactory implements ConletComponentFactory { 31 | 32 | /* 33 | * (non-Javadoc) 34 | * 35 | * @see org.jgrapes.core.ComponentFactory#componentType() 36 | */ 37 | @Override 38 | public Class componentType() { 39 | return VmAccess.class; 40 | } 41 | 42 | /* 43 | * (non-Javadoc) 44 | * 45 | * @see org.jgrapes.core.ComponentFactory#create(org.jgrapes.core.Channel, 46 | * java.util.Map) 47 | */ 48 | @Override 49 | public Optional create(Channel componentChannel, 50 | Map properties) { 51 | return Optional.of(new VmAccess(componentChannel)); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/src/org/jdrupes/vmoperator/vmaccess/browser/l10nBundles-stub.d.ts: -------------------------------------------------------------------------------- 1 | export default new Map>(); 2 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/src/org/jdrupes/vmoperator/vmaccess/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023, 2024 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.vmaccess; 20 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmaccess/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2015", 4 | "module": "es2015", 5 | "sourceMap": true, 6 | "inlineSources": true, 7 | "declaration": true, 8 | "importHelpers": true, 9 | "strict": true, 10 | "moduleResolution": "node", 11 | "experimentalDecorators": true, 12 | "lib": ["DOM", "ES2020"], 13 | "paths": { 14 | "aash-plugin": ["./build/unpacked/org/jgrapes/webconsole/provider/jgwcvuecomponents/aash-vue-components/lib/AashPlugin"], 15 | "jgconsole": ["./build/unpacked/org/jgrapes/webconsole/base/JGConsole"], 16 | "jgwc": ["./build/unpacked/org/jgrapes/webconsole/provider/jgwcvuecomponents/jgwc-vue-components/jgwc-components"], 17 | "l10nBundles": ["./src/org/jdrupes/vmoperator/vmaccess/browser/l10nBundles-stub"], 18 | "vue": ["./build/unpacked/org/jgrapes/webconsole/provider/vue/vue/vue"] 19 | } 20 | }, 21 | "include": ["src/**/*.ts"], 22 | "exclude": ["node_modules", "l10nBundles-stub.ts"] 23 | } 24 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmmgmt/.checkstyle: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmmgmt/.eclipse-pmd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmmgmt/.eslintignore: -------------------------------------------------------------------------------- 1 | rollup.config.mjs 2 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmmgmt/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "eslint:recommended", 4 | "plugin:@typescript-eslint/recommended" 5 | ], 6 | "parser": "@typescript-eslint/parser", 7 | "parserOptions": { "project": ["./tsconfig.json"] }, 8 | "plugins": [ 9 | "@typescript-eslint" 10 | ], 11 | "rules": { 12 | "constructor-super": "off" 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmmgmt/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | /bin_test/ 3 | /generated/ 4 | /build/ 5 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmmgmt/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | build.commands=org.eclipse.jdt.core.javabuilder 2 | connection.arguments= 3 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) 4 | connection.java.home=null 5 | connection.jvm.arguments= 6 | connection.project.dir=.. 7 | derived.resources=.gradle,generated 8 | eclipse.preferences.version=1 9 | natures=org.eclipse.jdt.groovy.core.groovyNature,org.eclipse.jdt.core.javanature 10 | project.path=\:org.jgrapes.osgi.conlets.services 11 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmmgmt/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmmgmt/.settings/org.eclipse.core.runtime.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | line.separator=\n 3 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmmgmt/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'org.jdrupes.vmoperator.java-library-conventions' 3 | } 4 | 5 | dependencies { 6 | implementation project(':org.jdrupes.vmoperator.manager.events') 7 | 8 | implementation 'org.jgrapes:org.jgrapes.webconsole.base:[2.1.0,3)' 9 | implementation 'org.jgrapes:org.jgrapes.webconsole.provider.vue:[1,2)' 10 | implementation 'org.jgrapes:org.jgrapes.webconsole.provider.jgwcvuecomponents:[1.2,2)' 11 | implementation 'org.jgrapes:org.jgrapes.webconsole.provider.chartjs:[1.2,2)' 12 | 13 | } 14 | 15 | apply plugin: 'com.github.node-gradle.node' 16 | 17 | node { 18 | download = true 19 | } 20 | 21 | task extractDependencies(type: Copy) { 22 | from configurations.compileClasspath 23 | .findAll{ it.name.contains('.provider.') 24 | || it.name.contains('org.jgrapes.webconsole.base') 25 | } 26 | .collect{ zipTree (it) } 27 | exclude '*.class' 28 | into 'build/unpacked' 29 | duplicatesStrategy 'include' 30 | } 31 | 32 | task compileTs(type: NodeTask) { 33 | dependsOn ':npmInstall' 34 | dependsOn extractDependencies 35 | inputs.dir project.file('src') 36 | inputs.file project.file('tsconfig.json') 37 | inputs.file project.file('rollup.config.mjs') 38 | outputs.dir project.file('build/generated/resources') 39 | script = file("${rootProject.rootDir}/node_modules/rollup/dist/bin/rollup") 40 | args = ["-c"] 41 | } 42 | 43 | sourceSets { 44 | main { 45 | resources { 46 | srcDir project.file('build/generated/resources') 47 | } 48 | } 49 | } 50 | 51 | processResources { 52 | dependsOn compileTs 53 | } 54 | 55 | eclipse { 56 | autoBuildTasks compileTs 57 | } 58 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmmgmt/package.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmmgmt/resources/META-INF/services/org.jgrapes.webconsole.base.ConletComponentFactory: -------------------------------------------------------------------------------- 1 | org.jdrupes.vmoperator.vmmgmt.VmMgmtFactory 2 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmmgmt/resources/org/jdrupes/vmoperator/vmmgmt/VmMgmt-confirmReset.ftl.html: -------------------------------------------------------------------------------- 1 |
3 |

${_("confirmResetMsg")}

4 |

5 | 7 | 8 | 9 | 10 | 11 | 12 |

13 |
-------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmmgmt/resources/org/jdrupes/vmoperator/vmmgmt/VmMgmt-l10nBundles.ftl.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Moodle Tools Console 3 | * Copyright (C) 2022 Michael N. Lipp 4 | * 5 | * This program is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 | * for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along 16 | * with this program; if not, see . 17 | */ 18 | 19 | "use strict"; 20 | 21 | const l10nBundles = new Map(); 22 | let entries = null; 23 | // <#list supportedLanguages() as l> 24 | entries = new Map(); 25 | l10nBundles.set("${l.locale.toLanguageTag()}", entries); 26 | // <#list l.l10nBundle.keys as key> 27 | entries.set("${key}", "${l.l10nBundle.getString(key)}"); 28 | // 29 | // 30 | 31 | export default l10nBundles; 32 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmmgmt/resources/org/jdrupes/vmoperator/vmmgmt/VmMgmt-preview.ftl.html: -------------------------------------------------------------------------------- 1 |
5 | 6 |
7 |
8 | {{ localize("Period") }}: 9 |
    10 |
  • 11 | 15 |
  • 16 |
  • 17 | 21 |
  • 22 |
23 |
24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 |
{{ localize("VMsSummary") }}:{{ vmSummary.runningVms }} / {{ vmSummary.totalVms }}
{{ localize("currentCpus") }}:{{ vmSummary.usedCpus }}
{{ localize("currentRam") }}:{{ formatMemory(Number(vmSummary.usedRam)) }}
42 |
43 | 44 |
45 | 46 |
47 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmmgmt/resources/org/jdrupes/vmoperator/vmmgmt/l10n.properties: -------------------------------------------------------------------------------- 1 | conletName = VM Management 2 | 3 | VMsSummary = VMs (running/total) 4 | 5 | assignedTo = Assigned to 6 | currentCpus = Current vCPUs 7 | currentRam = Current vRAM 8 | guestOs = Guest OS 9 | maximumCpus = Maximum vCPUs 10 | maximumRam = Maximum vRAM 11 | notInUse = Currently closed 12 | nodeName = Node 13 | requestedCpus = Requested vCPUs 14 | requestedRam = Requested vRAM 15 | runnerVersion = Runner version 16 | running = Running 17 | since = Since 18 | usedBy = Used by 19 | usedFrom = Used from 20 | vmActions = Actions 21 | vmname = Name 22 | 23 | confirmResetTitle = Confirm reset 24 | confirmResetMsg = Resetting the VM may cause loss of data. \ 25 | Please confirm to continue. 26 | consoleTakenNotification = Console access is locked by another user. 27 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmmgmt/resources/org/jdrupes/vmoperator/vmmgmt/l10n_de.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnlipp/VM-Operator/76b579c404f4ea691bf5a00cde47ddb8d35b1342/org.jdrupes.vmoperator.vmmgmt/resources/org/jdrupes/vmoperator/vmmgmt/l10n_de.properties -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmmgmt/resources/org/jdrupes/vmoperator/vmmgmt/l10n_en.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnlipp/VM-Operator/76b579c404f4ea691bf5a00cde47ddb8d35b1342/org.jdrupes.vmoperator.vmmgmt/resources/org/jdrupes/vmoperator/vmmgmt/l10n_en.properties -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmmgmt/rollup.config.mjs: -------------------------------------------------------------------------------- 1 | import typescript from 'rollup-plugin-typescript2'; 2 | import postcss from 'rollup-plugin-postcss'; 3 | 4 | let packagePath = "org/jdrupes/vmoperator/vmmgmt"; 5 | let baseName = "VmMgmt" 6 | let module = "build/generated/resources/" + packagePath 7 | + "/" + baseName + "-functions.js"; 8 | 9 | let pathsMap = { 10 | "aash-plugin": "../../page-resource/aash-vue-components/lib/aash-vue-components.js", 11 | "jgconsole": "../../console-base-resource/jgconsole.js", 12 | "jgwc": "../../page-resource/jgwc-vue-components/jgwc-components.js", 13 | "l10nBundles": "./" + baseName + "-l10nBundles.ftl.js", 14 | "vue": "../../page-resource/vue/vue.esm-browser.js", 15 | "chartjs": "../../page-resource/chart.js/auto.js" 16 | } 17 | 18 | export default { 19 | external: ['aash-plugin', 'jgconsole', 'jgwc', 'l10nBundles', 'vue', 'chartjs'], 20 | input: "src/" + packagePath + "/browser/" + baseName + "-functions.ts", 21 | output: [ 22 | { 23 | format: "esm", 24 | file: module, 25 | sourcemap: true, 26 | sourcemapPathTransform: (relativeSourcePath, _sourcemapPath) => { 27 | return relativeSourcePath.replace(/^([^/]*\/){12}/, "./"); 28 | }, 29 | paths: pathsMap 30 | } 31 | ], 32 | plugins: [ 33 | typescript(), 34 | postcss() 35 | ] 36 | }; 37 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmmgmt/src/org/jdrupes/vmoperator/vmmgmt/VmMgmtFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.vmmgmt; 20 | 21 | import java.util.Map; 22 | import java.util.Optional; 23 | import org.jgrapes.core.Channel; 24 | import org.jgrapes.core.ComponentType; 25 | import org.jgrapes.webconsole.base.ConletComponentFactory; 26 | 27 | /** 28 | * The factory service for {@link VmMgmt}s. 29 | */ 30 | public class VmMgmtFactory implements ConletComponentFactory { 31 | 32 | /* 33 | * (non-Javadoc) 34 | * 35 | * @see org.jgrapes.core.ComponentFactory#componentType() 36 | */ 37 | @Override 38 | public Class componentType() { 39 | return VmMgmt.class; 40 | } 41 | 42 | /* 43 | * (non-Javadoc) 44 | * 45 | * @see org.jgrapes.core.ComponentFactory#create(org.jgrapes.core.Channel, 46 | * java.util.Map) 47 | */ 48 | @Override 49 | public Optional create(Channel componentChannel, 50 | Map properties) { 51 | return Optional.of(new VmMgmt(componentChannel)); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmmgmt/src/org/jdrupes/vmoperator/vmmgmt/browser/l10nBundles-stub.d.ts: -------------------------------------------------------------------------------- 1 | export default new Map>(); 2 | -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmmgmt/src/org/jdrupes/vmoperator/vmmgmt/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * VM-Operator 3 | * Copyright (C) 2023 Michael N. Lipp 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as 7 | * published by the Free Software Foundation, either version 3 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.jdrupes.vmoperator.vmmgmt; -------------------------------------------------------------------------------- /org.jdrupes.vmoperator.vmmgmt/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2015", 4 | "module": "es2015", 5 | "sourceMap": true, 6 | "inlineSources": true, 7 | "declaration": true, 8 | "importHelpers": true, 9 | "strict": true, 10 | "moduleResolution": "node", 11 | "experimentalDecorators": true, 12 | "lib": ["DOM", "ES2020"], 13 | "paths": { 14 | "aash-plugin": ["./build/unpacked/org/jgrapes/webconsole/provider/jgwcvuecomponents/aash-vue-components/lib/AashPlugin"], 15 | "jgconsole": ["./build/unpacked/org/jgrapes/webconsole/base/JGConsole"], 16 | "jgwc": ["./build/unpacked/org/jgrapes/webconsole/provider/jgwcvuecomponents/jgwc-vue-components/jgwc-components"], 17 | "l10nBundles": ["./src/org/jdrupes/vmoperator/vmmgmt/browser/l10nBundles-stub"], 18 | "vue": ["./build/unpacked/org/jgrapes/webconsole/provider/vue/vue/vue"], 19 | "chartjs": ["./build/unpacked/org/jgrapes/webconsole/provider/chartjs/chart.js/auto/auto"] 20 | } 21 | }, 22 | "include": ["src/**/*.ts"], 23 | "exclude": ["node_modules", "l10nBundles-stub.ts"] 24 | } 25 | -------------------------------------------------------------------------------- /overview.md: -------------------------------------------------------------------------------- 1 | A Kubernetes operator for running VMs as pods. 2 | 3 | VM-Operator 4 | =========== 5 | 6 | The VM-operator enables you to easily run Qemu based VMs as pods 7 | in Kubernetes. It is built on the 8 | [JGrapes](https://mnlipp.github.io/jgrapes/) event driven framework. 9 | 10 | See the project's [home page](https://vm-operator.jdrupes.org/) for details. 11 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "devDependencies": { 3 | "@rollup/plugin-node-resolve": "^15.0.1", 4 | "@rollup/plugin-replace": "^5.0.2", 5 | "@rollup/plugin-terser": "^0.4.0", 6 | "@typescript-eslint/eslint-plugin": "^6.9.1", 7 | "documentation": "^14.0.1", 8 | "install": "^0.13.0", 9 | "jsdoc": "^4.0.2", 10 | "markdownlint": "^0.37.4", 11 | "node-sass": "^9.0.0", 12 | "npm": "^8.11.0", 13 | "rollup": "^4.1.5", 14 | "rollup-plugin-peer-deps-external": "^2.2.3", 15 | "rollup-plugin-postcss": "^4.0.2", 16 | "rollup-plugin-typescript2": "^0.36.0", 17 | "rollup-plugin-vue": "^6.0.0", 18 | "sass": "^1.49.9", 19 | "terser": "^5.14.2", 20 | "tslib": "^2.3.1", 21 | "typedoc": "^0.25.1", 22 | "typedoc-plugin-missing-exports": "^2.1.0", 23 | "typescript": "^5.2.2" 24 | }, 25 | "overrides": { 26 | "node-gyp": "^10.1.0", 27 | "glob": "^9.0.0" 28 | }, 29 | "eslintConfig": { 30 | "root": true, 31 | "extends": "eslint:recommended", 32 | "rules": { 33 | "quotes": "off" 34 | } 35 | }, 36 | "eslintIgnore": [ 37 | "node_modules/**" 38 | ], 39 | "dependencies": { 40 | "markdownlint-cli": "^0.44.0" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user manual at https://docs.gradle.org/8.0.2/userguide/multi_project_builds.html 8 | * This project uses @Incubating APIs which are subject to change. 9 | */ 10 | 11 | rootProject.name = 'VM-Operator' 12 | 13 | include 'org.jdrupes.vmoperator.manager' 14 | include 'org.jdrupes.vmoperator.manager.events' 15 | include 'org.jdrupes.vmoperator.vmaccess' 16 | include 'org.jdrupes.vmoperator.vmmgmt' 17 | include 'org.jdrupes.vmoperator.runner.qemu' 18 | include 'org.jdrupes.vmoperator.common' 19 | include 'org.jdrupes.vmoperator.util' 20 | include 'spice-squid' 21 | -------------------------------------------------------------------------------- /spice-squid/.checkstyle: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /spice-squid/.eclipse-pmd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /spice-squid/.settings/net.sf.jautodoc.prefs: -------------------------------------------------------------------------------- 1 | add_header=true 2 | eclipse.preferences.version=1 3 | header_text=/*\n * VM-Operator\n * Copyright (C) 2024 Michael N. Lipp\n * \n * This program is free software\: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see .\n */ 4 | project_specific_settings=true 5 | replacements=\n\n\nReturns the\nSets the\nAdds the\nEdits the\nRemoves the\nInits the\nParses the\nCreates the\nBuilds the\nChecks if is\nPrints the\nChecks for\n\n\n 6 | visibility_package=false 7 | visibility_private=false 8 | visibility_protected=false 9 | -------------------------------------------------------------------------------- /spice-squid/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | arguments= 2 | auto.sync=false 3 | build.scans.enabled=false 4 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) 5 | connection.project.dir=.. 6 | eclipse.preferences.version=1 7 | gradle.user.home= 8 | java.home= 9 | jvm.arguments= 10 | offline.mode=false 11 | override.workspace.settings=false 12 | show.console.view=false 13 | show.executions.view=false 14 | -------------------------------------------------------------------------------- /spice-squid/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /spice-squid/.settings/org.eclipse.core.runtime.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | line.separator=\n 3 | -------------------------------------------------------------------------------- /spice-squid/Containerfile: -------------------------------------------------------------------------------- 1 | FROM docker.io/alpine:3.19 2 | 3 | RUN apk update &&\ 4 | apk add --no-cache inotify-tools &&\ 5 | apk add --no-cache squid 6 | 7 | COPY run.sh /usr/local/bin/run-squid.sh 8 | 9 | CMD ["/usr/local/bin/run-squid.sh"] 10 | 11 | EXPOSE 3128 12 | -------------------------------------------------------------------------------- /spice-squid/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | CONF_OPT="-f /run/etc/squid/squid.conf" 4 | /usr/sbin/squid $CONF_OPT 5 | 6 | inotifywait -m -e create -r /run/etc/squid | 7 | while read file_path file_event file_name; do 8 | if [ "$file_event" != "CREATE" ]; then 9 | continue 10 | fi 11 | if [ -r /run/squid/squid.pid ]; then 12 | echo "Reconfiguring squid" 13 | /usr/sbin/squid $CONF_OPT -k reconfigure 14 | else 15 | echo "Restarting squid" 16 | /usr/sbin/squid $CONF_OPT 17 | fi 18 | echo "Processed event" 19 | done 20 | -------------------------------------------------------------------------------- /spice-squid/squid.conf: -------------------------------------------------------------------------------- 1 | http_access deny all 2 | 3 | # Squid normally listens to port 3128 4 | http_port 3128 5 | -------------------------------------------------------------------------------- /webpages/.gitignore: -------------------------------------------------------------------------------- 1 | _site 2 | Gemfile.lock 3 | .bundle 4 | .jekyll-cache -------------------------------------------------------------------------------- /webpages/.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | # Read the Docs configuration file 2 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 3 | 4 | # Required 5 | version: 2 6 | # Set the OS, Python version, and other tools you might need 7 | build: 8 | os: ubuntu-24.04 9 | tools: 10 | ruby: "3.3" 11 | commands: 12 | # Install dependencies 13 | - cd webpages && gem install bundle 14 | - cd webpages && bundle install 15 | # Build the site and save generated files into Read the Docs directory 16 | - cd webpages && jekyll build --destination $READTHEDOCS_OUTPUT/html 17 | - cp webpages/robots-readthedocs.txt $READTHEDOCS_OUTPUT/html/robots.txt 18 | -------------------------------------------------------------------------------- /webpages/02_2_operator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnlipp/VM-Operator/76b579c404f4ea691bf5a00cde47ddb8d35b1342/webpages/02_2_operator.png -------------------------------------------------------------------------------- /webpages/BingSiteAuth.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 0309051EFD625D32489366E1BE8189EF 4 | -------------------------------------------------------------------------------- /webpages/ConfigAccess-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnlipp/VM-Operator/76b579c404f4ea691bf5a00cde47ddb8d35b1342/webpages/ConfigAccess-preview.png -------------------------------------------------------------------------------- /webpages/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | # gem 'github-pages', group: :jekyll_plugins 3 | gem "jekyll", "~> 4.0" 4 | gem "jekyll-seo-tag" 5 | gem 'webrick', '~> 1.3', '>= 1.3.1' 6 | -------------------------------------------------------------------------------- /webpages/PoolAccess-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnlipp/VM-Operator/76b579c404f4ea691bf5a00cde47ddb8d35b1342/webpages/PoolAccess-preview.png -------------------------------------------------------------------------------- /webpages/VM-Operator-GUI-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnlipp/VM-Operator/76b579c404f4ea691bf5a00cde47ddb8d35b1342/webpages/VM-Operator-GUI-preview.png -------------------------------------------------------------------------------- /webpages/VM-Operator-GUI-view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnlipp/VM-Operator/76b579c404f4ea691bf5a00cde47ddb8d35b1342/webpages/VM-Operator-GUI-view.png -------------------------------------------------------------------------------- /webpages/VmAccess-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnlipp/VM-Operator/76b579c404f4ea691bf5a00cde47ddb8d35b1342/webpages/VmAccess-preview.png -------------------------------------------------------------------------------- /webpages/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-seo-tag 3 | 4 | url: "https://vm-operator.jdrupes.org" 5 | 6 | author: Michael N. Lipp 7 | 8 | logo: VM-Operator.svg 9 | 10 | tagline: VM-Operator by mnlipp 11 | 12 | description: >- 13 | A Kubernetes operator for running virtual machines (notably Qemu VMs) 14 | as pods. 15 | -------------------------------------------------------------------------------- /webpages/_includes/matomo.html: -------------------------------------------------------------------------------- 1 | 2 | 19 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /webpages/_includes/umami.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /webpages/admin-gui.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "VM-Operator: Administrator View — Provides an overview of running VMs" 3 | description: >- 4 | Information about the administrator view of the VM-Operator, which provides 5 | an overview of the defined VMs, their state and resource consumptions and 6 | actions for starting, stopping and accessing the VMs. 7 | layout: vm-operator 8 | --- 9 | 10 | # Administrator view 11 | 12 | An overview display shows the current CPU and RAM usage and a graph 13 | with recent changes. 14 | 15 | ![VM-Operator admin GUI preview](VM-Operator-GUI-preview.png) 16 | 17 | The detail display lists all VMs. From here you can start and stop 18 | the VMs and adjust the CPU and RAM usages (modifies the definition 19 | in kubernetes). 20 | 21 | ![VM-Operator admin GUI view](VM-Operator-GUI-view.png) 22 | -------------------------------------------------------------------------------- /webpages/hints.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "VM-Operator: Hints — Miscellaneous hints for using VM-Operator" 3 | layout: vm-operator 4 | --- 5 | 6 | # Hints 7 | 8 | ## Disable suspend and hibernate 9 | 10 | Suspend and hibernate are poorly supported in VMs and usually do not 11 | work as expected. To disable these on systemd based systems, use the 12 | following command: 13 | 14 | ```console 15 | # systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target 16 | ``` 17 | -------------------------------------------------------------------------------- /webpages/robots-readthedocs.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Allow: / 3 | Sitemap: https://kubernetes-vm-operator.readthedocs.io/sitemap.xml 4 | -------------------------------------------------------------------------------- /webpages/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Allow: / 3 | Sitemap: https://vm-operator.jdrupes.org/sitemap.xml 4 | --------------------------------------------------------------------------------