Skip to content

Commit

Permalink
Merge pull request Telmate#45 from V-Paranoiaque/feature/bootdisk
Browse files Browse the repository at this point in the history
Allows to choose the boot order and the main disk
  • Loading branch information
ggongaware authored Aug 5, 2019
2 parents 9b819ec + 639b24b commit 6c97b76
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions proxmox/config_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ type ConfigQemu struct {
QemuSockets int `json:"sockets"`
QemuIso string `json:"iso"`
FullClone *int `json:"fullclone"`
Boot string `json:"boot"`
BootDisk string `json:"bootdisk,omitempty"`
Scsihw string `json:"scsihw,omitempty"`
QemuDisks QemuDevices `json:"disk"`
QemuNetworks QemuDevices `json:"network"`
Expand Down Expand Up @@ -80,6 +82,8 @@ func (config ConfigQemu) CreateVm(vmr *VmRef, client *Client) (err error) {
"cores": config.QemuCores,
"cpu": "host",
"memory": config.Memory,
"boot": config.Boot,
"bootdisk": config.BootDisk,
"scsihw": config.Scsihw,
"description": config.Description,
}
Expand Down Expand Up @@ -163,6 +167,8 @@ func (config ConfigQemu) UpdateConfig(vmr *VmRef, client *Client) (err error) {
"sockets": config.QemuSockets,
"cores": config.QemuCores,
"memory": config.Memory,
"boot": config.Boot,
"bootdisk": config.BootDisk,
"scsihw": config.Scsihw,
}

Expand Down Expand Up @@ -294,6 +300,15 @@ func NewConfigQemuFromApi(vmr *VmRef, client *Client) (config *ConfigQemu, err e
if _, isSet := vmConfig["sockets"]; isSet {
sockets = vmConfig["sockets"].(float64)
}
//boot by default from hard disk (c), CD-ROM (d), network (n).
boot := "cdn"
if _, isSet := vmConfig["boot"]; isSet {
boot = vmConfig["boot"].(string)
}
bootdisk := ""
if _, isSet := vmConfig["bootdisk"]; isSet {
bootdisk = vmConfig["bootdisk"].(string)
}
scsihw := "lsi"
if _, isSet := vmConfig["scsihw"]; isSet {
scsihw = vmConfig["scsihw"].(string)
Expand All @@ -308,6 +323,8 @@ func NewConfigQemuFromApi(vmr *VmRef, client *Client) (config *ConfigQemu, err e
QemuCores: int(cores),
QemuSockets: int(sockets),
QemuVlanTag: -1,
Boot: boot,
BootDisk: bootdisk,
Scsihw: scsihw,
QemuDisks: QemuDevices{},
QemuNetworks: QemuDevices{},
Expand Down

0 comments on commit 6c97b76

Please sign in to comment.