Skip to content

Commit

Permalink
providers/azure: add support for azure gen2 VMs
Browse files Browse the repository at this point in the history
  • Loading branch information
sohankunkerkar committed Jun 30, 2021
1 parent 7190748 commit f89adfb
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion internal/providers/azure/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,18 @@ func FetchFromOvfDevice(f *resource.Fetcher, ovfFsTypes []string) (types.Config,
logger := f.Logger
logger.Debug("waiting for config DVD...")

waitForCdrom(logger, devicePath)
// Look for the gen2 settings if avaialble
// else fall back to gen1 settings
device, err := execUtil.GetUdfBlockDevices()
if err != nil {
logger.Info("falling back to gen1 settings")
waitForCdrom(logger, devicePath)
} else if len(device) > 0 {
for _, dev := range device {
devicePath = dev
waitForCdrom(logger, devicePath)
}
}

fsType, err := checkOvfFsType(logger, devicePath, ovfFsTypes)
if err != nil {
Expand Down Expand Up @@ -108,8 +119,13 @@ func FetchFromOvfDevice(f *resource.Fetcher, ovfFsTypes []string) (types.Config,
}

func waitForCdrom(logger *log.Logger, devicePath string) {
s := 10
for !isCdromPresent(logger, devicePath) {
if s == 0 {
break
}
time.Sleep(time.Second)
s--
}
}

Expand Down

0 comments on commit f89adfb

Please sign in to comment.