aboutsummaryrefslogtreecommitdiff
path: root/libvirt
diff options
context:
space:
mode:
Diffstat (limited to 'libvirt')
-rw-r--r--libvirt/disk_def.go2
-rw-r--r--libvirt/resource_libvirt_domain.go13
2 files changed, 3 insertions, 12 deletions
diff --git a/libvirt/disk_def.go b/libvirt/disk_def.go
index 3283f03b..785542b6 100644
--- a/libvirt/disk_def.go
+++ b/libvirt/disk_def.go
@@ -1,6 +1,7 @@
package libvirt
import (
+ "fmt"
"math/rand"
"github.com/libvirt/libvirt-go-xml"
@@ -14,6 +15,7 @@ func newDefDisk() libvirtxml.DomainDisk {
Device: "disk",
Target: &libvirtxml.DomainDiskTarget{
Bus: "virtio",
+ Dev: fmt.Sprintf("vd%s", DiskLetterForIndex(i)),
},
Driver: &libvirtxml.DomainDiskDriver{
Name: "qemu",
diff --git a/libvirt/resource_libvirt_domain.go b/libvirt/resource_libvirt_domain.go
index 90a0896d..dfb9d2f9 100644
--- a/libvirt/resource_libvirt_domain.go
+++ b/libvirt/resource_libvirt_domain.go
@@ -368,18 +368,7 @@ func resourceLibvirtDomainCreate(d *schema.ResourceData, meta interface{}) error
var disks []libvirtxml.DomainDisk
var scsiDisk = false
for i := 0; i < disksCount; i++ {
- disk := libvirtxml.DomainDisk{
- Type: "file",
- Device: "disk",
- Target: &libvirtxml.DomainDiskTarget{
- Bus: "virtio",
- Dev: fmt.Sprintf("vd%s", DiskLetterForIndex(i)),
- },
- Driver: &libvirtxml.DomainDiskDriver{
- Name: "qemu",
- Type: "qcow2",
- },
- }
+ disk := newDefDisk()
diskKey := fmt.Sprintf("disk.%d", i)
diskMap := d.Get(diskKey).(map[string]interface{})