Beispiel #1
0
func AttachVolumes(ec2Ref *ec2.EC2, InstanceId string, volumes []volume.Volume) error {
	for _, myVolume := range volumes {
		_, err := ec2Ref.AttachVolume(myVolume.Id, InstanceId, myVolume.Device)
		if err != nil {
			reqError := err.(*ec2.Error)
			if reqError.Code != "VolumeInUse" {
				return err
			}
		}
	}

	return nil
}
Beispiel #2
0
// AttachVolumes ...
func AttachVolumes(ec2Ref *ec2.EC2, InstanceID string, volumes []volume.Volume) error {
	for _, volumeConfig := range volumes {
		_, err := ec2Ref.AttachVolume(volumeConfig.ID, InstanceID, volumeConfig.Device)
		if err != nil {
			reqError := err.(*ec2.Error)
			if reqError.Code != "VolumeInUse" {
				return err
			}
		}
	}

	return nil
}