Skip to content

Commit

Permalink
Merge pull request #367 from mpywell/exp/289
Browse files Browse the repository at this point in the history
Fix: Create QEMU VMs directly in a configured Pool
  • Loading branch information
Tinyblargon authored Oct 22, 2024
2 parents 25d65da + 94debce commit 0f47ff7
Showing 1 changed file with 5 additions and 5 deletions.
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

0 comments on commit 0f47ff7

Please sign in to comment.