|
|
@ -34,7 +34,6 @@ package kvmvm
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"context"
|
|
|
|
"encoding/json"
|
|
|
|
"encoding/json"
|
|
|
|
"errors"
|
|
|
|
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
|
|
|
|
// "net/url"
|
|
|
|
// "net/url"
|
|
|
@ -107,14 +106,15 @@ func parseBootDiskId(disks []DiskRecord) uint {
|
|
|
|
return 0
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func findBootDisk(disks []DiskRecord) (*DiskRecord, error) {
|
|
|
|
func findBootDisk(disks []DiskRecord) *DiskRecord {
|
|
|
|
for _, d := range disks {
|
|
|
|
for _, d := range disks {
|
|
|
|
if d.Type == "B" {
|
|
|
|
if d.Type == "B" {
|
|
|
|
return &d, nil
|
|
|
|
return &d
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return nil, errors.New("boot disk not found")
|
|
|
|
// some computes don't have a boot disk, so...
|
|
|
|
|
|
|
|
return &DiskRecord{}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Parse the list of interfaces from compute/get response into a list of networks
|
|
|
|
// Parse the list of interfaces from compute/get response into a list of networks
|
|
|
@ -181,10 +181,7 @@ func flattenCompute(d *schema.ResourceData, compFacts string) error {
|
|
|
|
d.Set("started", false)
|
|
|
|
d.Set("started", false)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bootDisk, err := findBootDisk(model.Disks)
|
|
|
|
bootDisk := findBootDisk(model.Disks)
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
d.Set("boot_disk_size", bootDisk.SizeMax)
|
|
|
|
d.Set("boot_disk_size", bootDisk.SizeMax)
|
|
|
|
d.Set("boot_disk_id", bootDisk.ID) // we may need boot disk ID in resize operations
|
|
|
|
d.Set("boot_disk_id", bootDisk.ID) // we may need boot disk ID in resize operations
|
|
|
|