QVM Formula

Salt can manage many Qubes settings via the qvm state module.

Management declarations are typically rather simple:

appvm:
  qvm.prefs
    - label: green

Also see _modules/ext_module_qvm.py for inline documentation

Available State Commands

Verify the named VM is present or exists. Return True only if the named VM exists. Will not create the VM if missing.

qvm.exists:
    - name: <vmname>
        - flags:
            - quiet

Verify the named VM is missing. Return True only if the named VM is missing. Will not remove the VM if present.

qvm-missing-id:
    qvm.missing:
        - name: <vmname>
        - flags:
            - quiet

Return True is vmname is running.

qvm-running-id:
    qvm.running:
        - name: <vmname>

Return True is vmname is halted.

qvm-halted-id:
    qvm.halted:
        - name: <vmname>

Start vmname.

qvm-start-id:
    qvm.start:
        - name: <vmname>
        - drive: <string>
        - hddisk: <string>
        - cdrom: <string>
        - custom-config: <string>
        - flags:
            - quiet  # *** salt default ***
            - no-guid  # *** salt default ***
            - tray
            - dvm
            - debug
            - install-windows-tools

Shutdown vmname.

qvm-shutdown-id:
    qvm.shutdown:
        - name: <vmname>
        - exclude: [exclude_list,]
        - flags:
            - quiet
            - force
            - wait
            - all
            - kill

Kill vmname.

qvm-kill-id:
    qvm.kill:
        - name: <vmname>

Pause vmname.

qvm-pause-id:
    qvm.pause:
        - name: <vmname>

Unpause vmname.

qvm-unpause-id:
    qvm.unpause:
        - name: <vmname>

Make sure the named VM is present. VM will be created if missing.

qvm-present-id:
    qvm.present:
        - name: <vmname>
        - template: fedora-21
        - label: red
        - mem: 3000
        - vcpus: 4
        - root-move-from: </path/xxx>
        - root-copy-from: </path/xxx>
        - flags:
            - proxy
            - hvm
            - hvm-template
            - net
            - standalone
            - internal
            - force-root
            - quiet

Make sure the named VM is absent. VM will be deleted (removed) if present.

qvm-absent-id:
    qvm.absent:
        - name: <vmname>
        - flags:
            - just-db
            - force-root
            - quiet

Clone a VM.

qvm-clone-id:
    qvm.clone:
        - name: <vmname>-clone
        - source: <vmname>
        - path: </path/xxx>
        - flags:
            - shutdown
            - quiet
            - force-root

Run command in virtual machine domain.

qvm-run-id:
    qvm.run:
        - name: <vmname>
        - cmd: gnome-terminal
        - user: <string>
        - exclude: [sys-net, sys-firewall]
        - localcmd: </dev/null>
        - color-output: 31
        - flags:
            - quiet
            - auto
            - tray
            - all
            - pause
            - unpause
            - pass-io
            - nogui
            - filter-escape-chars
            - no-filter-escape-chars
            - no-color-output

Set vmname preferences.

qvm-prefs-id:
    qvm.prefs:
        - name:               <vmname>
        - label:              orange
        - template:           debian-jessie
        - memory:             400
        - maxmem:             4000
        - include-in-backups: True
        - netvm:              sys-firewall
        - pcidevs:            ['04:00.0']
        - kernel:             default
        - vcpus:              2
        - kernelopts:         nopat iommu=soft swiotlb=8192
        - mac:                auto
        - debug:              true
        - virt-mode:          hvm
        - default-user:       tester
        - qrexec-timeout:     120
        - internal:           true
        - autostart:          true
        - flags:
            - force-root

List vmname preferences.

qvm-prefs-list1-id:
    qvm.prefs:
        - name: <vmname>
        - action: list

qvm-prefs-list2-id:
    qvm.prefs:
        - name: <vmname>

Get vmname preferences.

qvm-prefs-get-id:
    qvm.prefs:
        - name: <vmname>
        - get:
            - label
            - template
            - memory
            - maxmem
            - include-in-backups

Backward compatibility wrapper. Use features with service. prefix.

qvm-service-id:
    qvm.service:
        - name: <vmname>
        - enable:
            - test
            - test2
            - another_test
            - another_test2
            - another_test3
        - disable:
            - meminfo-writer
            - test3
            - test4
            - another_test4
            - another_test5
        - default:
            - another_test5
            - does_not_exist
        # list: []
        # list: [string,]

Manage vmname features.

qvm-features-id:
    qvm.features:
        - name: <vmname>
        - enable:
            - test
            - test2
            - another_test
            - another_test2
            - another_test3
        - disable:
            - service.meminfo-writer
            - test3
            - test4
            - another_test4
            - another_test5
        - default:
            - another_test5
            - does_not_exist
        # list: []
        # list: [string,]

Manage vmname tags.

qvm-tags-id:
    qvm.tags:
        - name: <vmname>
        - add:
            - test
            - test2
            - another_test
            - another_test2
            - another_test3
        - del:
            - test3
            - test4
            - another_test4
            - another_test5
        # list: []
        # list: [string,]

Wrapper to contain all VM state functions.

  • State:

    • exists
    • missing
    • present
    • absent
    • clone
    • prefs
    • service
    • features
    • tags
  • Power:

    • running
    • halted
    • start
    • shutdown
    • kill
    • pause
    • unpause
    • run

Sample test VM creation containing all of the state actions:

qvm-vm-id:
    qvm.vm:
    - name: <vmname>
    - actions:
        - kill: pass
        - halted: pass
        - absent: pass
        - missing
        - present
        - exists
        - prefs
        - features
        - start
        - running
        - pause
        - unpause
        - shutdown
        - run
        - clone
    - kill: []
    - halted: []
    - absent: []
    - missing: []
    - present:
        - template: fedora-21
        - label: red
        - mem: 3000
        - vcpus: 4
        - flags:
            - proxy
    - exists: []
    - prefs:
        - label: green  # red|yellow|green|blue|purple|orange|gray|black
        - template: debian-jessie
        - memory: 400
        - maxmem: 4000
        - include-in-backups: false
        - netvm: sys-firewall
    - features:
        - enable:
            - test
            - test2
            - another_test
            - another_test2
            - another_test3
        - disable:
            - service.meminfo-writer
            - test3
            - test4
            - another_test4
            - another_test5
        - default:
            - another_test5
            - does_not_exist
    - tags:
        - add:
            - tag1
            - tag2
        - del:
            - tag3
            - tag4
    - start: []
    - running: []
    - pause: []
    - unpause: []
    - shutdown: []
    - run:
        - cmd: gnome-terminal
        - flags:
            - auto