Skip to content

Commit

Permalink
Use real NVME device name
Browse files Browse the repository at this point in the history
  • Loading branch information
sevagh committed Aug 11, 2019
1 parent 81f1aa3 commit 1eb1a2b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
11 changes: 7 additions & 4 deletions attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,15 @@ func (e *EC2Instance) AttachEbsVolumes() {
if !filesystem.DoesDriveExistWithTimeout(deviceName, 10) {
volLogger.Fatalf("Drive %s doesn't exist after attaching - checked with stat 10 times", deviceName)
}

volume.AttachedName = deviceName
localVolumes[key] = append(localVolumes[key], volume)
} else {
localVolumes[key] = append(localVolumes[key], volume)
deviceName = volume.AttachedName
}
realDeviceName, err := filesystem.GetActualBlockDeviceName(deviceName)
if err != nil {
volLogger.Fatalf("Couldn't get real device name of %s", deviceName)
}
volume.AttachedName = realDeviceName
localVolumes[key] = append(localVolumes[key], volume)
}
}
e.Vols = localVolumes
Expand Down
4 changes: 2 additions & 2 deletions ebs.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func prepAndMountDrives(volName string, vols []EbsVol) {
driveNames = append(driveNames, driveName)
}
if driveName, err = filesystem.CreateRaidArray(driveNames, volName, raidLevel); err != nil {
driveLogger.Fatalf("Error when creating reaid array: %v", err)
driveLogger.Fatalf("Error when creating RAID array: %v", err)
}
}

Expand All @@ -101,7 +101,7 @@ func prepAndMountDrives(volName string, vols []EbsVol) {
return
}

driveLogger.Info("Checking if something already mounted at %s", mountPath)
driveLogger.Infof("Checking if something already mounted at %s", mountPath)
if isMounted, err := filesystem.IsMounted(mountPath); err != nil {
driveLogger.Fatalf("Error when checking mount point for existing mounts: %v", err)
} else {
Expand Down
2 changes: 1 addition & 1 deletion filesystem/drive.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func DoesDriveExist(driveName string) bool {
return true
}

// GetLocalBlockDeviceName returns the actual name of the block device seen
// GetActualBlockDeviceName returns the actual name of the block device seen
// within the instance (useful for nitros)
func GetActualBlockDeviceName(name string) (string, error) {
for _, device := range listNvmeBlockDevices() {
Expand Down

0 comments on commit 1eb1a2b

Please sign in to comment.