mirror of
https://github.com/letic/terraform-provider-proxmox.git
synced 2024-07-01 07:02:40 +00:00
Merge branch 'master' of github.com:Telmate/terraform-provider-proxmox
This commit is contained in:
commit
471658bd10
|
@ -427,6 +427,8 @@ func resourceVmQemuCreate(d *schema.ResourceData, meta interface{}) error {
|
|||
pmParallelEnd(pconf)
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return fmt.Errorf("Either clone or iso must be set")
|
||||
}
|
||||
} else {
|
||||
log.Printf("[DEBUG] recycling VM vmId: %d", vmr.VmId())
|
||||
|
@ -475,19 +477,24 @@ func resourceVmQemuUpdate(d *schema.ResourceData, meta interface{}) error {
|
|||
pconf := meta.(*providerConfiguration)
|
||||
pmParallelBegin(pconf)
|
||||
client := pconf.Client
|
||||
vmr, err := client.GetVmRefByName(d.Get("name").(string))
|
||||
_, _, vmID, err := parseResourceId(d.Id())
|
||||
if err != nil {
|
||||
pmParallelEnd(pconf)
|
||||
return err
|
||||
}
|
||||
vmr := pxapi.NewVmRef(vmID)
|
||||
_, err = client.GetVmInfo(vmr)
|
||||
if err != nil {
|
||||
pmParallelEnd(pconf)
|
||||
return err
|
||||
}
|
||||
vmName := d.Get("name").(string)
|
||||
configDisksSet := d.Get("disk").(*schema.Set)
|
||||
qemuDisks := devicesSetToMap(configDisksSet)
|
||||
configNetworksSet := d.Get("network").(*schema.Set)
|
||||
qemuNetworks := devicesSetToMap(configNetworksSet)
|
||||
|
||||
config := pxapi.ConfigQemu{
|
||||
Name: vmName,
|
||||
Name: d.Get("name").(string),
|
||||
Description: d.Get("desc").(string),
|
||||
Onboot: d.Get("onboot").(bool),
|
||||
Memory: d.Get("memory").(int),
|
||||
|
@ -555,8 +562,15 @@ func resourceVmQemuRead(d *schema.ResourceData, meta interface{}) error {
|
|||
pconf := meta.(*providerConfiguration)
|
||||
pmParallelBegin(pconf)
|
||||
client := pconf.Client
|
||||
vmr, err := client.GetVmRefByName(d.Get("name").(string))
|
||||
_, _, vmID, err := parseResourceId(d.Id())
|
||||
if err != nil {
|
||||
pmParallelEnd(pconf)
|
||||
return err
|
||||
}
|
||||
vmr := pxapi.NewVmRef(vmID)
|
||||
_, err = client.GetVmInfo(vmr)
|
||||
if err != nil {
|
||||
pmParallelEnd(pconf)
|
||||
return err
|
||||
}
|
||||
config, err := pxapi.NewConfigQemuFromApi(vmr, client)
|
||||
|
|
Loading…
Reference in New Issue
Block a user