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

Fix: Create QEMU VMs directly in a configured Pool #367

Merged
merged 2 commits into from
Oct 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions proxmox/config_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -717,18 +717,18 @@ func (newConfig ConfigQemu) setAdvanced(currentConfig *ConfigQemu, rebootIfNeede
if err != nil {
return
}
// pool field unsupported by /nodes/%s/vms/%d/config used by update (currentConfig != nil).
// To be able to create directly in a configured pool, add pool to mapped params from ConfigQemu, before creating VM
if newConfig.Pool != nil && *newConfig.Pool != "" {
params["pool"] = *newConfig.Pool
}
exitStatus, err = client.CreateQemuVm(vmr.node, params)
if err != nil {
return false, fmt.Errorf("error creating VM: %v, error status: %s (params: %v)", err, exitStatus, params)
}
if err = resizeNewDisks(vmr, client, newConfig.Disks, nil); err != nil {
return
}
if newConfig.Pool != nil && *newConfig.Pool != "" { // add guest to pool
if err = newConfig.Pool.addGuests_Unsafe(client, []uint{uint(vmr.vmId)}, nil, version); err != nil {
return
}
}
if err = client.insertCachedPermission(permissionPath(permissionCategory_GuestPath) + "/" + permissionPath(strconv.Itoa(vmr.vmId))); err != nil {
return
}
Expand Down
Loading