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 25, 2021
1 parent 703f42a commit a4c4aba
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion internal/providers/azure/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,16 @@ func FetchFromOvfDevice(f *resource.Fetcher, ovfFsTypes []string) (types.Config,
logger := f.Logger
logger.Debug("waiting for config DVD...")

waitForCdrom(logger, devicePath)
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 +117,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 a4c4aba

Please sign in to comment.