How to debug docker-machine-driver usage in rancher-server

I notice a different behavior in using the native docker-machine-driver rm than using the driver via rancher gui.
How can I debug the usage of the used driver.
For creating a host, I can see in the docker logs for rancher the command which is used to create the host:

level=info msg="Cmd slice: [create -d businesscloud --engine-install-url https://releases.rancher.com/install-docker/1.10.sh …etc.

But when deleting the host via gui, there isn´t such a message.
I want to find out, how the docker-machine-driver is called in the particular case, because of the different behavior I mentioned when dealing with native cli command.

That message is specifically logged on create.

There is nothing interesting in the command to delete, so the command isn’t logged, but other things are.

please correct me if I´m wrong, in line 85:

command := buildCommand(machineDir, []string{"rm", "-f", machine.Name})

this command will execute the docker-machine-driver with parameter rm -f nameOfMachine

so in my case:

docker-machine rm -f nameOfMachine

right?

yes, that’s how machines are removed.

Could you please explain what happens when the host will be purged?
Do you also fire docker-machine rm -f nameOfMachine in that situation?

In <= v1.1, you create a machine resource to create a VM. It eventually finishes provisioning and registers itself as a host. Deleting the machine deletes the VM via docker-machine. I think deleting the host also causes the machine to be removed.

In >= v1.2 + using the v2-beta API, you create a host resource directly with the provider-specific options specified. That same resource goes through the provisioning states and eventually becomes active. When you deactivate and remove it, the provider VM is removed via docker-machine. There is just only one resource to manipulate.

(>= v1.2 + v1 API works the same as v1.1, but the UI does not show machine resources anywhere anymore so it will appear that nothing happened after you create the machine until the host eventually sets up and registers in)

I guess for removing a host via gui, the docker-machine rm -f command is fired twice. Once after deactivate/remove and later for purge.