Skip to main content

Switch among Guest VMs organized by Resource Pool

Project description

logo

Proxmox PCI Switcher

GitHub all releases PyPI - Downloads Quality Gate Status

Switch among Guest VMs organized by Resource Pool.

main features:

  • ONE GPU card, N OS (at once)
  • Guest VM command client
  • Handler power off
  • Reset framebuffer

TOC

Proxmox Configuration

Create Resource Pool

Resource Pool

Assign Guest VM

Assign Guest VM

Install Proxmox Snippet

curl -fsSL https://github.com/rosineygp/proxmox-pci-switcher/releases/latest/download/pci-group-switcher.sh > pci-group-switcher.sh

# set execution permission
chmod +x pci-group-switcher.sh

# move for your snippets <storage>/<folder>

Proxmox Config

Snippet Variables

NAME Default Description
_POOL_NAME * <auto_discovery> The name of Resource Pool
_SHUTDOWN_TIMEOUT 300 Checking if resource was released (Current VM Running is down)
_RESET_GPU_FRAMEBUFFER true Reset GPU framebuffer
_PIN_CPU_IDS false Pin CPU using taskset (syntax equals taskset cpu-list parameter)
_RENICE_PRIORITY false Renice process using renice

All variables must be changed in pci-group-switcher.sh at proxmox ve.

_POOL_NAME * By default it will scan for VMID in all Resource Pools, in case of long delays replace function call to Resource Pool name (eg. desktop, gpu, ...).

The following variables can be passed using /etc/pve/qemu-server/<vmid>.vars file, the script will load variables from file if it exists.

If you need to overwrite an Default value set at /etc/environment the variable name without the _ prefix. (eg. RESET_GPU_FRAMEBUFFER=false)

Assign VM to Snippet

qm set <vmid> -hookscript <storage>:snippets/pci-group-switcher.sh

After proxmox configuration is possible to switch using proxmox api or web interface.

Guest Client Switcher

  • requirements: python 3
pip install proxmox-pci-switcher

# create config folder
mkdir -p ~/.config/proxmox-pci-switcher/

# create config file
cat <<EOF > ~/.config/proxmox-pci-switcher/config.yaml
proxmox:
  host: '<ip or dns>'
  user: '<user>@<method>'
  password: '<password>'
  api_id: '<name>'          # only for api access
  api_token: '<token>'      # only for api access
  verify_ssl: false

gui:                        # optional
  theme: Dark               # Light or Dark

pools:
  - '<desktop>'
  - '<gpu-nvidia>'
  - '<gpu-amd>'

EOF

Edit config.yaml with your proxmox credentials and pools.

API access has priority over user and password access.

List Resources

proxmox-pci-switcher list

pool(s)       vmid  name             status    type
----------  ------  ---------------  --------  ------
desktop        119  catalina         stopped   qemu
desktop        116  win10-desktop    stopped   qemu
desktop        117  mini-desktop     stopped   qemu
desktop        103  u20-desktop      running   qemu
desktop        115  u20-srv-desktop  stopped   qemu

Switch Resource

# run command directly
proxmox-pci-switcher switch win10-desktop

# create a alias for better experience
alias windows="proxmox-pci-switcher switch win10-desktop"

# and just run
windows

Using GUI

proxmox-pci-switcher gui

GUI

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

proxmox-pci-switcher-0.15.11.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

proxmox_pci_switcher-0.15.11-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

Details for the file proxmox-pci-switcher-0.15.11.tar.gz.

File metadata

File hashes

Hashes for proxmox-pci-switcher-0.15.11.tar.gz
Algorithm Hash digest
SHA256 96a17b754786e399dddd3da5e554f5174d20412417523d0dee226e1b617272db
MD5 0bc43e73f8dc5e79e31c058480a85680
BLAKE2b-256 40284ad87b4e46f1e2d3911671385b5d1097858d3a5cf2862f131cff3db84512

See more details on using hashes here.

File details

Details for the file proxmox_pci_switcher-0.15.11-py3-none-any.whl.

File metadata

File hashes

Hashes for proxmox_pci_switcher-0.15.11-py3-none-any.whl
Algorithm Hash digest
SHA256 6601feddbe1c93956dc460b74d11db63cda28905ae9b1cb8027f639ff4edfec4
MD5 ace9b1ad9e0be7e86de8fa102d0244e3
BLAKE2b-256 b5000470b650cf1841b87d11a14b7a5aa127b4cd2c31b4ef29628c3ce9c6116f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page