add boot volume to builder instance
This commit is contained in:
parent
ca3bffcb0d
commit
b68f214ca4
|
@ -82,6 +82,12 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||
sourceImageList: b.config.SourceImageList,
|
||||
bootable: true,
|
||||
},
|
||||
&stepCreatePersistentVolume{
|
||||
volumeSize: fmt.Sprintf("%d", b.config.PersistentVolumeSize),
|
||||
volumeName: fmt.Sprintf("builder-boot_%s", runID),
|
||||
sourceImageList: b.config.SourceImageList,
|
||||
bootable: true,
|
||||
},
|
||||
&stepCreatePersistentVolume{
|
||||
volumeSize: fmt.Sprintf("%d", b.config.PersistentVolumeSize*2),
|
||||
volumeName: fmt.Sprintf("builder-storage_%s", runID),
|
||||
|
@ -109,6 +115,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||
name: fmt.Sprintf("builder-instance_%s", runID),
|
||||
masterVolumeName: fmt.Sprintf("master-storage_%s", runID),
|
||||
builderVolumeName: fmt.Sprintf("builder-storage_%s", runID),
|
||||
builderBootName: fmt.Sprintf("builder-boot_%s", runID),
|
||||
},
|
||||
&communicator.StepConnect{
|
||||
Config: &b.config.Comm,
|
||||
|
|
|
@ -31,6 +31,8 @@ type Config struct {
|
|||
// Image
|
||||
// PersistentVolumeSize lets us control the volume size by using persistent boot storage
|
||||
PersistentVolumeSize int `mapstructure:"persistent_volume_size"`
|
||||
//TODO
|
||||
// builder image
|
||||
|
||||
ImageName string `mapstructure:"image_name"`
|
||||
Shape string `mapstructure:"shape"`
|
||||
|
|
|
@ -13,6 +13,7 @@ type stepCreatePVBuilder struct {
|
|||
name string
|
||||
masterVolumeName string
|
||||
builderVolumeName string
|
||||
builderBootName string
|
||||
}
|
||||
|
||||
func (s *stepCreatePVBuilder) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
|
@ -40,15 +41,19 @@ func (s *stepCreatePVBuilder) Run(_ context.Context, state multistep.StateBag) m
|
|||
},
|
||||
Storage: []compute.StorageAttachmentInput{
|
||||
{
|
||||
Volume: s.builderVolumeName,
|
||||
Volume: s.builderBootName,
|
||||
Index: 1,
|
||||
},
|
||||
{
|
||||
Volume: s.masterVolumeName,
|
||||
Volume: s.builderVolumeName,
|
||||
Index: 2,
|
||||
},
|
||||
{
|
||||
Volume: s.masterVolumeName,
|
||||
Index: 3,
|
||||
},
|
||||
ImageList: config.SourceImageList,
|
||||
},
|
||||
BootOrder: []int{1},
|
||||
Attributes: config.attribs,
|
||||
SSHKeys: []string{config.Comm.SSHKeyPairName},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue