diff --git a/pkg/controller/machine.go b/pkg/controller/machine.go index 98a358268..932879f45 100644 --- a/pkg/controller/machine.go +++ b/pkg/controller/machine.go @@ -419,7 +419,7 @@ func (c *controller) machineDelete(machine *v1alpha1.Machine, driver driver.CMID // If Finalizers are present if finalizers := sets.NewString(machine.Finalizers...); finalizers.Has(DeleteFinalizerName) { - glog.V(2).Infof("Deleting Machine %s", machine.Name) + glog.V(2).Infof("Deleting Machine %q with MachineID %q", machine.Name, driver.MachineID) // Getting the machine-ID on the cloud provider machineID := driver.MachineID @@ -492,20 +492,17 @@ func (c *controller) machineDelete(machine *v1alpha1.Machine, driver driver.CMID } // Check for existance of machine at cloud provider - _, err := driver.GetMachine(machineID) - if err == nil || status.Code(err) == codes.Unimplemented { - // Either there is no err - // or the GetMachine is not implemented - // then continue - - err = driver.ShutDownMachine(machineID) - if err == nil || status.Code(err) == codes.Unimplemented { - // Either there is no err - // or the ShutDownMachine is not implemented - // then continue - err = driver.DeleteMachine(machineID) - } + _, err = driver.GetMachine(machineID) + if err != nil && status.Code(err) != codes.Unimplemented { + // If GetMachine was implemented and error occurred + glog.V(2).Infof("Get Machine called failed with the following error: %s", err) + } + err = driver.ShutDownMachine(machineID) + if err != nil && status.Code(err) != codes.Unimplemented { + // If ShutDownMachine was implemented and error occurred + glog.V(2).Infof("Shutdown Machine called failed with the following error: %s", err) } + err = driver.DeleteMachine(machineID) } if err != nil { diff --git a/pkg/controller/machine_safety.go b/pkg/controller/machine_safety.go index c64aa6b74..d6de02068 100644 --- a/pkg/controller/machine_safety.go +++ b/pkg/controller/machine_safety.go @@ -302,7 +302,7 @@ func (c *controller) checkMachineClass( listOfVMs, err := dvr.ListMachines() if err != nil { - glog.Warningf("Orphan VM handler is not running. Failed to list VMs at provider. Err - %s", err) + glog.Warningf("Orphan VM handler is not running. Failed to list VMs at provider. \nErr - %s", err) return } diff --git a/pkg/driver/cmi-client.go b/pkg/driver/cmi-client.go index 4f839bd64..5a1b81c48 100644 --- a/pkg/driver/cmi-client.go +++ b/pkg/driver/cmi-client.go @@ -142,7 +142,7 @@ func (c *CMIDriverClient) GetMachine(MachineID string) (bool, error) { defer closer.Close() req := &cmipb.GetMachineRequest{ - MachineID: c.MachineID, + MachineID: MachineID, Secrets: c.Secret.Data, } ctx := context.Background() @@ -219,7 +219,7 @@ func newGrpcConn(driverName string) (*grpc.ClientConn, error) { network := "tcp" - glog.V(2).Infof("Creating new gRPC connection for [%s://%s] for driver: %s", network, addr, name) + glog.V(5).Infof("Creating new gRPC connection for [%s://%s] for driver: %s", network, addr, name) return grpc.Dial( addr,