Merge pull request #6702 from shield-9/disk_format
Add disk_format option for OpenStack builder
This commit is contained in:
commit
ed38fe9bef
|
@ -52,6 +52,10 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
|
|||
return nil, errs
|
||||
}
|
||||
|
||||
if b.config.ImageConfig.ImageDiskFormat != "" && !b.config.RunConfig.UseBlockStorageVolume {
|
||||
return nil, fmt.Errorf("use_blockstorage_volume must be true if image_disk_format is specified.")
|
||||
}
|
||||
|
||||
// By default, instance name is same as image name
|
||||
if b.config.InstanceName == "" {
|
||||
b.config.InstanceName = b.config.ImageName
|
||||
|
|
|
@ -14,6 +14,7 @@ type ImageConfig struct {
|
|||
ImageMetadata map[string]string `mapstructure:"metadata"`
|
||||
ImageVisibility imageservice.ImageVisibility `mapstructure:"image_visibility"`
|
||||
ImageMembers []string `mapstructure:"image_members"`
|
||||
ImageDiskFormat string `mapstructure:"image_disk_format"`
|
||||
}
|
||||
|
||||
func (c *ImageConfig) Prepare(ctx *interpolate.Context) []error {
|
||||
|
|
|
@ -47,6 +47,7 @@ func (s *stepCreateImage) Run(_ context.Context, state multistep.StateBag) multi
|
|||
}
|
||||
volume := state.Get("volume_id").(string)
|
||||
image, err := volumeactions.UploadImage(blockStorageClient, volume, volumeactions.UploadImageOpts{
|
||||
DiskFormat: config.ImageDiskFormat,
|
||||
ImageName: config.ImageName,
|
||||
}).Extract()
|
||||
if err != nil {
|
||||
|
|
|
@ -275,6 +275,9 @@ builder.
|
|||
zones aren't specified, the default enforced by your OpenStack cluster will
|
||||
be used.
|
||||
|
||||
- `image_disk_format` (string) - Disk format of the resulting image.
|
||||
This option works if `use_blockstorage_volume` is true.
|
||||
|
||||
## Basic Example: DevStack
|
||||
|
||||
Here is a basic example. This is a example to build on DevStack running in a VM.
|
||||
|
|
Loading…
Reference in New Issue