diff --git a/README.md b/README.md index 2f3a9c66..72723d35 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,7 @@ Options: - `--google-zone`: The zone to launch the instance. Default: `us-central1-a` - `--google-machine-type`: The type of instance. Default: `f1-micro` + - `--google-disk-size`: The disk size of the instance (in GB). Default: `10` - `--google-username`: The username to use for the instance. Default: `docker-user` - `--google-instance-name`: The name of the instance. Default: `docker-machine` - `--google-project`: The name of your project to use when launching the instance. diff --git a/drivers/google/compute_util.go b/drivers/google/compute_util.go index 6612737e..8ad5d1c4 100644 --- a/drivers/google/compute_util.go +++ b/drivers/google/compute_util.go @@ -149,6 +149,8 @@ func (c *ComputeUtil) createInstance(d *Driver) error { instance.Disks[0].InitializeParams = &raw.AttachedDiskInitializeParams{ DiskName: c.diskName(), SourceImage: imageName, + // The maximum supported disk size is 1000GB, the cast should be fine. + DiskSizeGb: int64(d.DiskSize), } } else { instance.Disks[0].Source = c.zoneURL + "/disks/" + c.instanceName + "-disk" diff --git a/drivers/google/google.go b/drivers/google/google.go index 0f2fccd5..6648abce 100644 --- a/drivers/google/google.go +++ b/drivers/google/google.go @@ -23,6 +23,7 @@ type Driver struct { MachineName string Zone string MachineType string + DiskSize int storePath string UserName string Project string @@ -38,6 +39,7 @@ type CreateFlags struct { MachineType *string UserName *string Project *string + DiskSize *int } func init() { @@ -74,6 +76,12 @@ func GetCreateFlags() []cli.Flag { Usage: "GCE Project", EnvVar: "GOOGLE_PROJECT", }, + cli.IntFlag{ + Name: "google-disk-size", + Usage: "GCE Instance Disk Size (in GB)", + Value: 10, + EnvVar: "GOOGLE_DISK_SIZE", + }, } } @@ -98,6 +106,7 @@ func (driver *Driver) DriverName() string { func (driver *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error { driver.Zone = flags.String("google-zone") driver.MachineType = flags.String("google-machine-type") + driver.DiskSize = flags.Int("google-disk-size") driver.UserName = flags.String("google-username") driver.Project = flags.String("google-project") if driver.Project == "" {