Virtual Machines & VMMs
PiVirt manages virtual machines through a declarative, API-driven lifecycle model. VMs are defined via YAML specifications and orchestrated across QEMU/KVM and Cloud Hypervisor backends.
VM Lifecycle
Section titled “VM Lifecycle”stateDiagram-v2
[*] --> Pending
Pending --> Creating
Creating --> Running
Running --> Stopping
Stopping --> Stopped
Stopped --> Starting
Starting --> Running
Running --> Pausing
Pausing --> Paused
Paused --> Resuming
Resuming --> Running
Running --> Migrating
Migrating --> Running
Running --> Deleting
Deleting --> [*]
VM Specification
Section titled “VM Specification”apiVersion: pivirt.pilab.hu/v1kind: VirtualMachinemetadata: name: web-server namespace: production labels: app: web env: prodspec: cpu: cores: 2 model: host-passthrough memory: size: 4Gi hugepages: false disks: - name: root size: 20Gi pool: default bus: virtio bootOrder: 1 nics: - name: eth0 network: virbr0 model: virtio os: type: linux bootOrder: [disk, network] cloudInit: enabled: true userData: | #cloud-config packages: [nginx]Key Concepts
Section titled “Key Concepts”Namespaces
Section titled “Namespaces”- Logical isolation for VMs
- RBAC policies applied per namespace
- Network policies scoped to namespace
Labels & Selectors
Section titled “Labels & Selectors”- Attach metadata to VMs
- Filter and group VMs
- Used by networking and policies
Resource Quotas
Section titled “Resource Quotas”- CPU, memory, disk limits per namespace
- Prevent resource exhaustion
- Enforced at creation time
Affinity & Anti-Affinity
Section titled “Affinity & Anti-Affinity”- Co-locate VMs on same host
- Spread VMs across hosts
- Improve availability