VirtualBox: added support for "virtio" ISO interface.
This commit is contained in:
parent
f48d7e3990
commit
591b1c2637
|
@ -80,6 +80,10 @@ func (s *StepAttachISOs) Run(ctx context.Context, state multistep.StateBag) mult
|
||||||
controllerName = "SATA Controller"
|
controllerName = "SATA Controller"
|
||||||
port = "1"
|
port = "1"
|
||||||
device = "0"
|
device = "0"
|
||||||
|
} else if s.ISOInterface == "virtio" {
|
||||||
|
controllerName = "VirtIO Controller"
|
||||||
|
port = "1"
|
||||||
|
device = "0"
|
||||||
}
|
}
|
||||||
ui.Message("Mounting boot ISO...")
|
ui.Message("Mounting boot ISO...")
|
||||||
case "guest_additions":
|
case "guest_additions":
|
||||||
|
@ -90,6 +94,10 @@ func (s *StepAttachISOs) Run(ctx context.Context, state multistep.StateBag) mult
|
||||||
controllerName = "SATA Controller"
|
controllerName = "SATA Controller"
|
||||||
port = "2"
|
port = "2"
|
||||||
device = "0"
|
device = "0"
|
||||||
|
} else if s.GuestAdditionsInterface == "virtio" {
|
||||||
|
controllerName = "VirtIO Controller"
|
||||||
|
port = "2"
|
||||||
|
device = "0"
|
||||||
}
|
}
|
||||||
ui.Message("Mounting guest additions ISO...")
|
ui.Message("Mounting guest additions ISO...")
|
||||||
case "cd_files":
|
case "cd_files":
|
||||||
|
@ -100,6 +108,10 @@ func (s *StepAttachISOs) Run(ctx context.Context, state multistep.StateBag) mult
|
||||||
controllerName = "SATA Controller"
|
controllerName = "SATA Controller"
|
||||||
port = "3"
|
port = "3"
|
||||||
device = "0"
|
device = "0"
|
||||||
|
} else if s.ISOInterface == "virtio" {
|
||||||
|
controllerName = "VirtIO Controller"
|
||||||
|
port = "3"
|
||||||
|
device = "0"
|
||||||
}
|
}
|
||||||
ui.Message("Mounting cd_files ISO...")
|
ui.Message("Mounting cd_files ISO...")
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,9 +211,9 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
|
||||||
errs, errors.New("nvme_port_count cannot be greater than 255"))
|
errs, errors.New("nvme_port_count cannot be greater than 255"))
|
||||||
}
|
}
|
||||||
|
|
||||||
if b.config.ISOInterface != "ide" && b.config.ISOInterface != "sata" {
|
if b.config.ISOInterface != "ide" && b.config.ISOInterface != "sata" && b.config.ISOInterface != "virtio" {
|
||||||
errs = packersdk.MultiErrorAppend(
|
errs = packersdk.MultiErrorAppend(
|
||||||
errs, errors.New("iso_interface can only be ide or sata"))
|
errs, errors.New("iso_interface can only be ide, sata or virtio"))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warnings
|
// Warnings
|
||||||
|
|
|
@ -66,15 +66,20 @@ func (s *stepCreateDisk) Run(ctx context.Context, state multistep.StateBag) mult
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.HardDriveInterface == "scsi" {
|
// Add a VirtIO controller if we were asked to use VirtIO. We still attach
|
||||||
if err := driver.CreateSCSIController(vmName, "SCSI Controller"); err != nil {
|
// the VirtIO controller above because some other things (disks) require
|
||||||
|
// that.
|
||||||
|
if config.HardDriveInterface == "virtio" || config.ISOInterface == "virtio" {
|
||||||
|
if err := driver.CreateVirtIOController(vmName, "VirtIO Controller"); err != nil {
|
||||||
err := fmt.Errorf("Error creating disk controller: %s", err)
|
err := fmt.Errorf("Error creating disk controller: %s", err)
|
||||||
state.Put("error", err)
|
state.Put("error", err)
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
}
|
}
|
||||||
} else if config.HardDriveInterface == "virtio" {
|
}
|
||||||
if err := driver.CreateVirtIOController(vmName, "VirtIO Controller"); err != nil {
|
|
||||||
|
if config.HardDriveInterface == "scsi" {
|
||||||
|
if err := driver.CreateSCSIController(vmName, "SCSI Controller"); err != nil {
|
||||||
err := fmt.Errorf("Error creating disk controller: %s", err)
|
err := fmt.Errorf("Error creating disk controller: %s", err)
|
||||||
state.Put("error", err)
|
state.Put("error", err)
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
|
|
Loading…
Reference in New Issue