Skip to main content

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

Metadata

Release files for proxmox-pci-switcher 0.15.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for proxmox-pci-switcher 0.15.11
File Size Uploaded
proxmox-pci-switcher-0.15.11.tar.gz 7.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for proxmox-pci-switcher 0.15.11
File Interpreter ABI Platform
proxmox_pci_switcher-0.15.11-py3-none-any.whl Python 3 none any Details

Total release size: 29.0 kB

Release files / proxmox-pci-switcher-0.15.11.tar.gz

Download URL proxmox-pci-switcher-0.15.11.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
96a17b754786e399dddd3da5e554f5174d20412417523d0dee226e1b617272db
BLAKE2b-256 checksum
How to use checksums
40284ad87b4e46f1e2d3911671385b5d1097858d3a5cf2862f131cff3db84512
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.8.19

Release files / proxmox_pci_switcher-0.15.11-py3-none-any.whl

Download URL proxmox_pci_switcher-0.15.11-py3-none-any.whl
Size 22.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6601feddbe1c93956dc460b74d11db63cda28905ae9b1cb8027f639ff4edfec4
BLAKE2b-256 checksum
How to use checksums
b5000470b650cf1841b87d11a14b7a5aa127b4cd2c31b4ef29628c3ce9c6116f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.8.19
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page