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
|
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
|
// By default, instance name is same as image name
|
||||||
if b.config.InstanceName == "" {
|
if b.config.InstanceName == "" {
|
||||||
b.config.InstanceName = b.config.ImageName
|
b.config.InstanceName = b.config.ImageName
|
||||||
|
|
|
@ -14,6 +14,7 @@ type ImageConfig struct {
|
||||||
ImageMetadata map[string]string `mapstructure:"metadata"`
|
ImageMetadata map[string]string `mapstructure:"metadata"`
|
||||||
ImageVisibility imageservice.ImageVisibility `mapstructure:"image_visibility"`
|
ImageVisibility imageservice.ImageVisibility `mapstructure:"image_visibility"`
|
||||||
ImageMembers []string `mapstructure:"image_members"`
|
ImageMembers []string `mapstructure:"image_members"`
|
||||||
|
ImageDiskFormat string `mapstructure:"image_disk_format"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ImageConfig) Prepare(ctx *interpolate.Context) []error {
|
func (c *ImageConfig) Prepare(ctx *interpolate.Context) []error {
|
||||||
|
|
|
@ -47,7 +47,8 @@ func (s *stepCreateImage) Run(_ context.Context, state multistep.StateBag) multi
|
||||||
}
|
}
|
||||||
volume := state.Get("volume_id").(string)
|
volume := state.Get("volume_id").(string)
|
||||||
image, err := volumeactions.UploadImage(blockStorageClient, volume, volumeactions.UploadImageOpts{
|
image, err := volumeactions.UploadImage(blockStorageClient, volume, volumeactions.UploadImageOpts{
|
||||||
ImageName: config.ImageName,
|
DiskFormat: config.ImageDiskFormat,
|
||||||
|
ImageName: config.ImageName,
|
||||||
}).Extract()
|
}).Extract()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := fmt.Errorf("Error creating image: %s", err)
|
err := fmt.Errorf("Error creating image: %s", err)
|
||||||
|
|
|
@ -275,6 +275,9 @@ builder.
|
||||||
zones aren't specified, the default enforced by your OpenStack cluster will
|
zones aren't specified, the default enforced by your OpenStack cluster will
|
||||||
be used.
|
be used.
|
||||||
|
|
||||||
|
- `image_disk_format` (string) - Disk format of the resulting image.
|
||||||
|
This option works if `use_blockstorage_volume` is true.
|
||||||
|
|
||||||
## Basic Example: DevStack
|
## Basic Example: DevStack
|
||||||
|
|
||||||
Here is a basic example. This is a example to build on DevStack running in a VM.
|
Here is a basic example. This is a example to build on DevStack running in a VM.
|
||||||
|
|
Loading…
Reference in New Issue