mirror of https://github.com/docker/docs.git
Merge pull request #505 from saturnism/google-driver-disk-size
Added a Disk Size parameter for Google Compute Engine.
This commit is contained in:
commit
87a5b43a93
|
@ -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.
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 == "" {
|
||||
|
|
Loading…
Reference in New Issue