Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PCI device using raw_id throws error #1186

Open
Cirx08 opened this issue Nov 27, 2024 · 12 comments
Open

PCI device using raw_id throws error #1186

Cirx08 opened this issue Nov 27, 2024 · 12 comments
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented resource/qemu Issue or PR related to Qemu resource type/documentation This issue/PR is mainly about documentation

Comments

@Cirx08
Copy link

Cirx08 commented Nov 27, 2024

Error: error updating VM: 500 only root can set 'hostpci0' config for non-mapped devices

pci {
id = 0
raw_id = "0000:01:00.0"
primary_gpu = false
rombar = true
}

I have tried multiple Ids and using the pcis block throws the same error. Using mapping_id works but raw_id does not.

@Tinyblargon
Copy link
Collaborator

@Cirx08 only user root@pam may set the raw_id field.

@Tinyblargon
Copy link
Collaborator

I should update this in the documentation.

@Tinyblargon Tinyblargon added the type/documentation This issue/PR is mainly about documentation label Nov 27, 2024
@Cirx08
Copy link
Author

Cirx08 commented Nov 27, 2024

Does this include root API tokens? I am using root@pam!terraform

@maksimsamt
Copy link
Contributor

maksimsamt commented Nov 27, 2024

Does this include root API tokens? I am using root@pam!terraform

What is your token root@pam!terraform - Privilege Separation - Yes or No (true/false)?
It should be No (false) to get working in your case.

@Cirx08
Copy link
Author

Cirx08 commented Nov 27, 2024

It is currently "No".

image

@maksimsamt
Copy link
Contributor

Can you set via Proxmox GUI raw_id field via root@pam user?

@Cirx08
Copy link
Author

Cirx08 commented Nov 27, 2024

Yes, my workaround for rc-4 was to set up VMs without PCI and manually attach via the web gui.

@maksimsamt
Copy link
Contributor

So, seems you cannot do it with root token:
#764 (comment)

@Tinyblargon Tinyblargon added issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented resource/qemu Issue or PR related to Qemu resource labels Nov 27, 2024
@jlengelbrecht
Copy link

Is it still the case that only root password auth can set raw PCI devices? I have a unique use case where i am using terrform to spin up talos linux VM's. I manage proxmox from a repo using a self hosted action runner. I would ideally like to avoid using root creds in the repo for obvious reasons. The plan was to then integrate corssplane into my setup at somepoint so it can add nodes to the cluster using terraform if needed, but again if this capability relies on allowing root user auth I think I am going to pass on this for now. Unless someone knows of a way to do this without root level authentication?

@Tinyblargon
Copy link
Collaborator

@jlengelbrecht the only alternative would be to use mapped pci devices. RC6 has support for them. You would have to create the mappings on each node first as root before you can reference them in Terraform.

@jlengelbrecht
Copy link

@jlengelbrecht the only alternative would be to use mapped pci devices. RC6 has support for them. You would have to create the mappings on each node first as root before you can reference them in Terraform.

Thank you i will take a look at doing this. I have never created a mapping like this so ill poke around for some documentation on how to do this. Hopefully this gets me unstuck. Thank you

@jlengelbrecht
Copy link

jlengelbrecht commented Jan 6, 2025

got this working. In case anyone else is looking for a way to do GPU passthrough per VM. Here is a code snippet for a dynamic block I created that I used in my main.tf

# Dynamically add PCI passthrough for GPU workers
  dynamic "pcis" {
    for_each = each.key == "gpu-worker1" ? [1] : []
    content {
      pci0 {
        mapping {
          mapping_id    = "gpu-group-name"
          pcie          = false
          primary_gpu   = false
          rombar        = false
          device_id     = "1b02"  # Device ID for the GPU
          vendor_id     = "10de"  # Vendor ID for NVIDIA
          sub_device_id = "123e"  # Sub-device ID for the GPU
          sub_vendor_id = "10de"  # Sub-vendor ID for NVIDIA
        }
      }
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented resource/qemu Issue or PR related to Qemu resource type/documentation This issue/PR is mainly about documentation
Projects
None yet
Development

No branches or pull requests

4 participants