Skip to content
This repository has been archived by the owner on Sep 26, 2021. It is now read-only.

Commit

Permalink
Merge pull request #505 from saturnism/google-driver-disk-size
Browse files Browse the repository at this point in the history
Added a Disk Size parameter for Google Compute Engine.
  • Loading branch information
ehazlett committed Feb 10, 2015
2 parents 6feb419 + 56d832d commit 87a5b43
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions drivers/google/compute_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 9 additions & 0 deletions drivers/google/google.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type Driver struct {
MachineName string
Zone string
MachineType string
DiskSize int
storePath string
UserName string
Project string
Expand All @@ -38,6 +39,7 @@ type CreateFlags struct {
MachineType *string
UserName *string
Project *string
DiskSize *int
}

func init() {
Expand Down Expand Up @@ -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",
},
}
}

Expand All @@ -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 == "" {
Expand Down

0 comments on commit 87a5b43

Please sign in to comment.