Always create volumes in the active k8s zone
This commit is contained in:
@@ -75,6 +75,10 @@ func main() {
|
|||||||
|
|
||||||
if *provider == "aws" {
|
if *provider == "aws" {
|
||||||
awsConfig := "[Global]\n"
|
awsConfig := "[Global]\n"
|
||||||
|
if *gceZone == "" {
|
||||||
|
glog.Error("gce_zone must be specified for AWS")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
awsConfig += fmt.Sprintf("Zone=%s\n", *gceZone)
|
awsConfig += fmt.Sprintf("Zone=%s\n", *gceZone)
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
@@ -64,7 +64,6 @@ type AWSMetadata interface {
|
|||||||
|
|
||||||
type VolumeOptions struct {
|
type VolumeOptions struct {
|
||||||
CapacityMB int
|
CapacityMB int
|
||||||
Zone string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Volumes is an interface for managing cloud-provisioned volumes
|
// Volumes is an interface for managing cloud-provisioned volumes
|
||||||
@@ -241,9 +240,9 @@ func newAWSCloud(config io.Reader, authFunc AuthFunc, instanceId string, metadat
|
|||||||
ec2 := &goamzEC2{ec2: ec2.New(auth, region)}
|
ec2 := &goamzEC2{ec2: ec2.New(auth, region)}
|
||||||
|
|
||||||
awsCloud := &AWSCloud{
|
awsCloud := &AWSCloud{
|
||||||
ec2: ec2,
|
ec2: ec2,
|
||||||
cfg: cfg,
|
cfg: cfg,
|
||||||
region: region,
|
region: region,
|
||||||
availabilityZone: zone,
|
availabilityZone: zone,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -894,7 +893,7 @@ func (aws *AWSCloud) DetachDisk(instanceName string, diskName string) error {
|
|||||||
// Implements Volumes.CreateVolume
|
// Implements Volumes.CreateVolume
|
||||||
func (aws *AWSCloud) CreateVolume(volumeOptions *VolumeOptions) (string, error) {
|
func (aws *AWSCloud) CreateVolume(volumeOptions *VolumeOptions) (string, error) {
|
||||||
request := &ec2.CreateVolume{}
|
request := &ec2.CreateVolume{}
|
||||||
request.AvailZone = volumeOptions.Zone
|
request.AvailZone = aws.availabilityZone
|
||||||
request.Size = (int64(volumeOptions.CapacityMB) + 1023) / 1024
|
request.Size = (int64(volumeOptions.CapacityMB) + 1023) / 1024
|
||||||
response, err := aws.ec2.CreateVolume(request)
|
response, err := aws.ec2.CreateVolume(request)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@@ -193,7 +193,6 @@ func createPD() (string, error) {
|
|||||||
}
|
}
|
||||||
volumeOptions := &aws_cloud.VolumeOptions{}
|
volumeOptions := &aws_cloud.VolumeOptions{}
|
||||||
volumeOptions.CapacityMB = 10 * 1024
|
volumeOptions.CapacityMB = 10 * 1024
|
||||||
volumeOptions.Zone = testContext.cloudConfig.Zone
|
|
||||||
return volumes.CreateVolume(volumeOptions)
|
return volumes.CreateVolume(volumeOptions)
|
||||||
} else {
|
} else {
|
||||||
return "", fmt.Errorf("Unsupported provider type")
|
return "", fmt.Errorf("Unsupported provider type")
|
||||||
|
Reference in New Issue
Block a user