Merge pull request #27628 from justinsb/fix_27534
Automatic merge from submit-queue AWS volumes: Use /dev/xvdXX names with EC2 We are using HVM style names, which cannot be paravirtual style names. See http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html This also fixes problems introduced when moving volume mounting to KCM. Fix #27534
This commit is contained in:
		| @@ -22,7 +22,6 @@ import ( | |||||||
| 	"io" | 	"io" | ||||||
| 	"net" | 	"net" | ||||||
| 	"net/url" | 	"net/url" | ||||||
| 	"os" |  | ||||||
| 	"regexp" | 	"regexp" | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"strings" | 	"strings" | ||||||
| @@ -1296,12 +1295,9 @@ func (c *AWSCloud) AttachDisk(diskName string, instanceName string, readOnly boo | |||||||
|  |  | ||||||
| 	// Inside the instance, the mountpoint always looks like /dev/xvdX (?) | 	// Inside the instance, the mountpoint always looks like /dev/xvdX (?) | ||||||
| 	hostDevice := "/dev/xvd" + string(mountDevice) | 	hostDevice := "/dev/xvd" + string(mountDevice) | ||||||
| 	// In the EC2 API, it is sometimes is /dev/sdX and sometimes /dev/xvdX | 	// We are using xvd names (so we are HVM only) | ||||||
| 	// We are running on the node here, so we check if /dev/xvda exists to determine this | 	// See http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html | ||||||
| 	ec2Device := "/dev/xvd" + string(mountDevice) | 	ec2Device := "/dev/xvd" + string(mountDevice) | ||||||
| 	if _, err := os.Stat("/dev/xvda"); os.IsNotExist(err) { |  | ||||||
| 		ec2Device = "/dev/sd" + string(mountDevice) |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	// attachEnded is set to true if the attach operation completed | 	// attachEnded is set to true if the attach operation completed | ||||||
| 	// (successfully or not) | 	// (successfully or not) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 k8s-merge-robot
					k8s-merge-robot