mirror of
https://github.com/letic/terraform-provider-proxmox.git
synced 2024-10-05 02:01:04 +00:00
switch to /cluster/nextid instead of maxid
This commit is contained in:
parent
ac80ff229d
commit
821ceb8d0d
@ -76,7 +76,7 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
|
|||||||
Client: client,
|
Client: client,
|
||||||
MaxParallel: d.Get("pm_parallel").(int),
|
MaxParallel: d.Get("pm_parallel").(int),
|
||||||
CurrentParallel: 0,
|
CurrentParallel: 0,
|
||||||
MaxVmId: 0,
|
MaxVmId: -1,
|
||||||
Mutex: &mut,
|
Mutex: &mut,
|
||||||
Cond: sync.NewCond(&mut),
|
Cond: sync.NewCond(&mut),
|
||||||
}, nil
|
}, nil
|
||||||
@ -97,13 +97,10 @@ func getClient(pm_api_url string, pm_user string, pm_password string, pm_tls_ins
|
|||||||
|
|
||||||
func nextVmId(pconf *providerConfiguration) (nextId int, err error) {
|
func nextVmId(pconf *providerConfiguration) (nextId int, err error) {
|
||||||
pconf.Mutex.Lock()
|
pconf.Mutex.Lock()
|
||||||
if pconf.MaxVmId == 0 {
|
pconf.MaxVmId, err = pconf.Client.GetNextID(pconf.MaxVmId + 1)
|
||||||
pconf.MaxVmId, err = pxapi.MaxVmId(pconf.Client)
|
if err != nil {
|
||||||
if err != nil {
|
return 0, err
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
pconf.MaxVmId++
|
|
||||||
nextId = pconf.MaxVmId
|
nextId = pconf.MaxVmId
|
||||||
pconf.Mutex.Unlock()
|
pconf.Mutex.Unlock()
|
||||||
return nextId, nil
|
return nextId, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user