-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allows for the mounting of ISOs when a Proxmox VM s created. Same as … #9653
Conversation
Sorry that I created that many commits for PR. I was trying to get all tests to pass but somehow I did add the definition of I have tested the build after manually adding the definitions of |
Codecov Report
|
I'm a big fan of squashing if you have a ton of little tweak commits. |
…in PR 9055 but working Fixed check-lint errors Fixed bus_number check Fixed check-genereate error Revert "Fixed bus_number check" This reverts commit ac8dc15. fmt Naming Fixed hcl2 autogenerated code issue fmt less than is not greater than
6043c9d
to
4fd76f3
Compare
Fixed Template Finalization Error fmt Documentation and fixes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @paginabianca!
I've left a couple of comments below. Additionally, as was discussed in the previous PR, we probably need to tackle uploads of ISOs as well.
} else { | ||
changes[cdrom] = c.AdditionalISOFiles[idx].Filename + ",media=cdrom" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wouldn't be a change, right? It is what you set already in the StartVM step.
@@ -213,6 +213,29 @@ builder. | |||
- `cloud_init_storage_pool` - (string) - Name of the Proxmox storage pool | |||
to store the Cloud-Init CDROM on. If not given, the storage pool of the boot device will be used. | |||
|
|||
- `additional_iso_files` (array of objects) - Additional ISO filess attached to the virtual machine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo
- `additional_iso_files` (array of objects) - Additional ISO filess attached to the virtual machine. | |
- `additional_iso_files` (array of objects) - Additional ISO files attached to the virtual machine. |
} | ||
] | ||
``` | ||
- `device` (string) - Bus type that the ISO will be mountet on. Can be `ide`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo
- `device` (string) - Bus type that the ISO will be mountet on. Can be `ide`, | |
- `device` (string) - Bus type that the ISO will be mounted on. Can be `ide`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, wouldn't it semantically be a device_type
or similar, since a device
would include the number as well?
builder/proxmox/config.go
Outdated
if c.AdditionalISOFiles[idx].Device == "" { | ||
log.Printf("AdditionalISOFile %d Device not set, using default 'ide'", idx) | ||
c.AdditionalISOFiles[idx].Device = "ide" | ||
} | ||
if !contains([]string{"ide", "sata", "scsi"}, c.AdditionalISOFiles[idx].Device) { | ||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("%q is not a valid AdditionalISOFile Device", c.AdditionalISOFiles[idx].Device)) | ||
} | ||
if c.AdditionalISOFiles[idx].BusNumber == 0 { | ||
log.Printf("AdditionalISOFile %d number not set, using default: '3'", idx) | ||
c.AdditionalISOFiles[idx].BusNumber = 3 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I leave multiple additional isos without a bus number, they will overwrite each other this way. I can see three options:
- Make bus_number mandatory (and in that case, maybe merge it with device_type so you'd specify the entire device like
device="ide3"
) - Keep track of what device numbers we've used and use the next unused one. This will probably get tricky.
- Error out if there's more than one element without a set number.
I'd lean towards option 1 because it will more obvious, although it does sacrifice a small amount of convenience when just adding a single additional iso.
{ | ||
"device": "scsi", | ||
"bus_number": "3", | ||
"filemane": "local:iso/virtio-win-0.1.185.iso", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo
"filemane": "local:iso/virtio-win-0.1.185.iso", | |
"filename": "local:iso/virtio-win-0.1.185.iso", |
|
||
- `bus_number` (string) - Number of the device. Can be 0 to 3 for `ide`, 0 to 5 | ||
for `sata` and 0 to 30 for `scsi`. | ||
Defaults to 3 sice `ide` bus 2 is generally the boot drive. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo
Defaults to 3 sice `ide` bus 2 is generally the boot drive. | |
Defaults to 3 since `ide` bus 2 is generally the boot drive. |
Thanks for the feedback and sorry for the typos. I'll fix those and the naming eather today or tomorrow. I've looked into uploads of ISOs but I'm not sure where and how it would be best to implement that. |
Fixed Template Finalization Error fmt Documentation and fixes Finalize Fix Description fix Typos Finalize Fix Prepared ISO upload feature Preparations for ISO upload More preparations Even more preparations Hopefully Final preparation removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This notification apparently drowned in a bunch of other email, sorry for taking so long! Nice work on the upload part, looks good 🎉 Ideally we could merge the main/additional iso uploads, but this works.
Other than that, one final naming nit and I think a minor bug, otherwise 👍
for idx := range c.AdditionalISOFiles { | ||
if !c.AdditionalISOFiles[idx].shouldUploadISO { | ||
state.Put("additional_iso_files", c.AdditionalISOFiles) | ||
return multistep.ActionContinue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a continue
, right? Otherwise we'll skip uploading any iso:s later in the list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah you're right. Thanks for the heads up 👍
builder/proxmox/config.go
Outdated
@@ -87,6 +90,15 @@ type vgaConfig struct { | |||
Type string `mapstructure:"type"` | |||
Memory int `mapstructure:"memory"` | |||
} | |||
type storageConfig struct { | |||
common.ISOConfig `mapstructure:",squash"` | |||
DeviceType string `mapstructure:"device_type"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I had a couple of comments around this last time round, which addressed the naming here in different ways and we got a bit of a mix of all now 😄 I think it's great that we no longer have the number as a separate field, but now it should probably be called device
rather than device_type
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. Will change it shortly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Just one small typo, apart from that LGTM!
fix typo Co-authored-by: Calle Pettersson <carlpett@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM, nice work @paginabianca. I applied your last suggestion @carlpett awesome reviewing 😄 , I'm also trusting your review as the owner of this builder on this and I think this can be merged. ( just waiting for the tests to be green )
🎉
Awesome 😄 thanks @carlpett for providing all the feedback. |
Yes thank you 🥰🥰
|
🎉 Nice work! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
…in PR #9055
Allows the mounting of additional ISOs when the VM is created. The config option was taken from PR #9055 and slightly changed. Users can specify an array of bus names, bus numbers and filenames.
"cd_drive":[
{
"bus": "ide",
"bus_number": 3,
"filename": "isos:iso/virtio-win-0.1.187.iso"
},
{
"bus": "sata",
"bus_number": 3,
"filename": "isos:iso/someother.iso"
}
]
Closes: #7950