Skip to content

Commit

Permalink
Made changes
Browse files Browse the repository at this point in the history
  • Loading branch information
prashanth26 committed Dec 19, 2018
1 parent 3bb9022 commit af16517
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
17 changes: 12 additions & 5 deletions pkg/driver/driver_azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (d *AzureDriver) Create() (string, string, error) {
Name: &nicName,
InterfaceIPConfigurationPropertiesFormat: &network.InterfaceIPConfigurationPropertiesFormat{
PrivateIPAllocationMethod: network.Dynamic,
Subnet: &subnet,
Subnet: &subnet,
},
},
},
Expand Down Expand Up @@ -218,13 +218,20 @@ func (d *AzureDriver) Delete() error {
listOfResources := make(map[string]string)
d.getvms(d.MachineID, listOfResources)
if len(listOfResources) != 0 {
_, errChan := vmClient.Delete(resourceGroup, vmName, cancel)
_, errChan := vmClient.PowerOff(resourceGroup, vmName, cancel)
err = onErrorFail(<-errChan, fmt.Sprintf("vmClient.PowerOff failed for '%s'", vmName))
if err != nil {
return err
}
glog.V(2).Infof("PowerOff VM %s", vmName)

_, errChan = vmClient.Delete(resourceGroup, vmName, cancel)
err = onErrorFail(<-errChan, fmt.Sprintf("vmClient.Delete failed for '%s'", vmName))
if err != nil {
return err
}
}
glog.V(3).Infof("Deleted VM %s", vmName)
glog.V(2).Infof("Deleted VM %s", vmName)

listOfResources = make(map[string]string)
d.getnics(d.MachineID, listOfResources)
Expand All @@ -235,7 +242,7 @@ func (d *AzureDriver) Delete() error {
return err
}
}
glog.V(3).Infof("Deleted NIC %s", nicName)
glog.V(2).Infof("Deleted NIC %s", nicName)

listOfResources = make(map[string]string)
d.getdisks(d.MachineID, listOfResources)
Expand All @@ -246,7 +253,7 @@ func (d *AzureDriver) Delete() error {
return err
}
}
glog.V(3).Infof("Deleted OS-Disk %s", nicName)
glog.V(2).Infof("Deleted OS-Disk %s", nicName)

return err
}
Expand Down
15 changes: 11 additions & 4 deletions vendor/k8s.io/client-go/tools/leaderelection/leaderelection.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit af16517

Please sign in to comment.