forked from terra-farm/go-virtualbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
storage.go
86 lines (77 loc) · 3.14 KB
/
storage.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package virtualbox
// StorageController represents a virtualized storage controller.
type StorageController struct {
SysBus SystemBus
Ports uint // SATA port count 1--30
Chipset StorageControllerChipset
HostIOCache bool
Bootable bool
}
// SystemBus represents the system bus of a storage controller.
type SystemBus string
const (
// SysBusIDE when the storage controller provides an IDE bus.
SysBusIDE = SystemBus("ide")
// SysBusSATA when the storage controller provides a SATA bus.
SysBusSATA = SystemBus("sata")
// SysBusSCSI when the storage controller provides an SCSI bus.
SysBusSCSI = SystemBus("scsi")
// SysBusFloppy when the storage controller provides access to Floppy drives.
SysBusFloppy = SystemBus("floppy")
// SysBusSAS storage controller provides a SAS bus.
SysBusSAS = SystemBus("sas")
// SysBusUSB storage controller proveds an USB bus.
SysBusUSB = SystemBus("usb")
// SysBusPCIE storage controller proveds a PCIe bus.
SysBusPCIE = SystemBus("pcie")
// SysBusVirtio storage controller proveds a Virtio bus.
SysBusVirtio = SystemBus("virtio")
)
// StorageControllerChipset represents the hardware of a storage controller.
type StorageControllerChipset string
const (
// CtrlLSILogic when the storage controller emulates LSILogic hardware.
CtrlLSILogic = StorageControllerChipset("LSILogic")
// CtrlLSILogicSAS when the storage controller emulates LSILogicSAS hardware.
CtrlLSILogicSAS = StorageControllerChipset("LSILogicSAS")
// CtrlBusLogic when the storage controller emulates BusLogic hardware.
CtrlBusLogic = StorageControllerChipset("BusLogic")
// CtrlIntelAHCI when the storage controller emulates IntelAHCI hardware.
CtrlIntelAHCI = StorageControllerChipset("IntelAHCI")
// CtrlPIIX3 when the storage controller emulates PIIX3 hardware.
CtrlPIIX3 = StorageControllerChipset("PIIX3")
// CtrlPIIX4 when the storage controller emulates PIIX4 hardware.
CtrlPIIX4 = StorageControllerChipset("PIIX4")
// CtrlICH6 when the storage controller emulates ICH6 hardware.
CtrlICH6 = StorageControllerChipset("ICH6")
// CtrlI82078 when the storage controller emulates I82078 hardware.
CtrlI82078 = StorageControllerChipset("I82078")
// CtrlUSB storage controller emulates USB hardware.
CtrlUSB = StorageControllerChipset("USB")
// CtrlNVME storage controller emulates NVME hardware.
CtrlNVME = StorageControllerChipset("NVMe")
// CtrlVirtIO storage controller emulates VirtIO hardware.
CtrlVirtIO = StorageControllerChipset("VirtIO")
)
// StorageMedium represents the storage medium attached to a storage controller.
type StorageMedium struct {
Port uint
Device uint
DriveType DriveType
Medium string // none|emptydrive|<uuid>|<filename|host:<drive>|iscsi
}
// DriveType represents the hardware type of a drive.
type DriveType string
const (
// DriveDVD when the drive is a DVD reader/writer.
DriveDVD = DriveType("dvddrive")
// DriveHDD when the drive is a hard disk or SSD.
DriveHDD = DriveType("hdd")
// DriveFDD when the drive is a floppy.
DriveFDD = DriveType("fdd")
)
// CloneHD virtual harddrive
func CloneHD(input, output string) error {
_, _, err := Manage().run("clonehd", input, output)
return err
}