Merge branch 'googlecompute-disk-type' of https://github.com/meatballhat/packer into f-google-disk-type

This commit is contained in:
Chris Bednarski 2016-03-10 14:51:30 -08:00
commit 1b1bbb604e
4 changed files with 8 additions and 0 deletions

View File

@ -25,6 +25,7 @@ type Config struct {
DiskName string `mapstructure:"disk_name"`
DiskSizeGb int64 `mapstructure:"disk_size"`
DiskType string `mapstructure:"disk_type"`
ImageName string `mapstructure:"image_name"`
ImageDescription string `mapstructure:"image_description"`
InstanceName string `mapstructure:"instance_name"`
@ -74,6 +75,10 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
c.DiskSizeGb = 10
}
if c.DiskType == "" {
c.DiskType = "pd-standard"
}
if c.ImageDescription == "" {
c.ImageDescription = "Created by Packer"
}

View File

@ -42,6 +42,7 @@ type Image struct {
type InstanceConfig struct {
Description string
DiskSizeGb int64
DiskType string
Image Image
MachineType string
Metadata map[string]string

View File

@ -274,6 +274,7 @@ func (d *driverGCE) RunInstance(c *InstanceConfig) (<-chan error, error) {
InitializeParams: &compute.AttachedDiskInitializeParams{
SourceImage: image.SelfLink,
DiskSizeGb: c.DiskSizeGb,
DiskType: fmt.Sprintf("zones/%s/diskTypes/%s", zone.Name, c.DiskType),
},
},
},

View File

@ -54,6 +54,7 @@ func (s *StepCreateInstance) Run(state multistep.StateBag) multistep.StepAction
errCh, err := driver.RunInstance(&InstanceConfig{
Description: "New instance created by Packer",
DiskSizeGb: config.DiskSizeGb,
DiskType: config.DiskType,
Image: config.getImage(),
MachineType: config.MachineType,
Metadata: config.getInstanceMetadata(sshPublicKey),