Add machine-driver

I try to understand how to add a custom machine-driver in Rancher 1.0.

I wish to use OVH (Public Cloud Instance) to create dynamic servers, they used an openstack compatible api (so I can try with rancher openstack driver) however (and because I like OVH as provider) I wish to be able to use their specific machine-driver available at https://github.com/yadutaf/docker-machine-driver-ovh

I added the binary (available in release) in admin>settings

So now I see one line on top of the others drivers labeled as ā€œrequestedā€.

My question is, is it the right way to add a new driver ? And howto push custom info to the driver as describe here: https://github.com/yadutaf/docker-machine-driver-ovh/blob/master/README.md#2-create-a-configuration-file

Cheers,
Renaud

@renaudManda yes that is the intended way to add a driver. However, it sounds like something went wrong because Rancher should pick up that requested driver and activate it.

A couple debugging quwestions:

  1. Is this a fresh Rancher 1.0 install?
  2. On the settings page where the OVH driver is listed, there should be entries for Packet and Ubiquity. Are those both active? If either are in an error state, you should be able to retry them by clicking the drop down next to the state.

@cjellick

  1. nope, itā€™s an upgrade from the previous release.
  2. yes both are active

bellow the API export

{
"id": "1md4",
"type": "machineDriver",
"links": {
"self": "ā€¦/v1/machinedrivers/1md4",
"account": "ā€¦/v1/machinedrivers/1md4/account",
},
"actions": {
"remove": "ā€¦/v1/machinedrivers/1md4/?action=remove",
},
"name": "ovh",
"state": "requested",
"accountId": "1a1",
"created": "2016-03-29T16:40:32Z",
"createdTS": 1459269632000,
"data": { },
"description": null,
"kind": "machineDriver",
"md5checksum": null,
"removeTime": null,
"removed": null,
"transitioning": "no",
"transitioningMessage": null,
"transitioningProgress": null,
"uri": "https://github.com/yadutaf/docker-machine-driver-ovh/releases/download/v0.5.0/docker-machine-driver-ovh-linux-amd64",
"uuid": "e6a83b7f-798a-4e6b-9152-94df4464b010",
}

Cheers,
Renaud

Iā€™m assuming you are running rancher/server as a single all-in-one container and not in the ā€œHAā€ setup. If that is not accurate, let me know.

Assuming that you are, can you provide the output from this command?

docker logs <name of your rancher server container> 2>&1 | grep -e '^time'

I ask for this because there is a process (which logs to standard out with the prefix time) that is called go-machine-service that is responsible for all machine driver activities. My guess is that it is misbehaving. This command will give us the logs for it.

After doing that, you cold also kill the go-machine-service process via killall -3 go-machine-service to force it to restart and try again. Note that doing the killall -3 will cause go-machine-service to do a stack dump. Youā€™ll see this in the containerā€™s logs as a bunch of stacktraces look something like this:

goroutine 90 [syscall]:
syscall.Syscall(0x3, 0x1a, 0xc820115000, 0x1000, 0x0, 0x0, 0x0)

If you could grab that and share it as well (preferrably in a gist) that would be useful as well.

Please find bellow the links on gist with each asked actions:

But after doing that (I killed twice due the go-machine-service due to other errors and low buffer memory on the ā€˜logs screenā€™), and now I see the driver active.

So my assomption is the go-machine-service probably not executing the pending tasks. Maybe I can find thje first kill output in console ?

Now I gona try to make the ovh driver works :wink:

Renaud

Is the OVH machine driver workedā€¦? I couldnā€™t get this working, looking at the rancher server log, I could notice some usage errors of docker-machine create command. I am using the latest OVH driver (https://github.com/yadutaf/docker-machine-driver-ovh/releases/download/v1.0.0/docker-machine-driver-ovh-linux-amd64). I also didnā€™t find all the options available in the Add Host Interface when this driver is selected


time=ā€œ2016-07-20T00:23:17Zā€ level=info msg=ā€œstdout: Incorrect Usage.ā€ resourceId: =1ph14
time=ā€œ2016-07-20T00:23:17Zā€ level=info msg="stdout: " resourceId: =1ph14
time=ā€œ2016-07-20T00:23:17Zā€ level=info msg=ā€œstdout: Usage: docker-machine create [OPTIONS] [argā€¦]ā€ resourceId: =1ph14
time=ā€œ2016-07-20T00:23:17Zā€ level=info msg="stdout: " resourceId: =1ph14
time=ā€œ2016-07-20T00:23:17Zā€ level=info msg=ā€œstdout: Create a machineā€ resourceId: =1ph14
time=ā€œ2016-07-20T00:23:17Zā€ level=info msg="stdout: " resourceId: =1ph14
time=ā€œ2016-07-20T00:23:17Zā€ level=info msg=ā€œstdout: Description:ā€ resourceId: =1ph14
time=ā€œ2016-07-20T00:23:17Zā€ level=info msg=ā€œstdout: Run ā€˜docker-machine create --driver nameā€™ to include the create flags for that driver in the help text.ā€ resourceId: =1ph14
time=ā€œ2016-07-20T00:23:17Zā€ level=info msg=ā€œstdout: " resourceId: =1ph14
time=ā€œ2016-07-20T00:23:17Zā€ level=info msg=ā€œstdout: Options:ā€ resourceId: =1ph14
time=ā€œ2016-07-20T00:23:17Zā€ level=info msg=ā€œstdout: " resourceId: =1ph14
time=ā€œ2016-07-20T00:23:17Zā€ level=info msg=ā€œstdout: --driver, -d ā€œnoneā€\t\t\t\t\t\t\t\t\t\t\tDriver to create machine with.ā€ resourceId: =1ph14
time=ā€œ2016-07-20T00:23:17Zā€ level=info msg=ā€œstdout: --engine-env [ā€“engine-env option --engine-env option]\t\t\t\t\t\tSpecify environment variables to set in the engineā€ resourceId: =1ph14
time=ā€œ2016-07-20T00:23:17Zā€ level=info msg=ā€œstdout: --engine-insecure-registry [ā€“engine-insecure-registry option --engine-insecure-registry option]\tSpecify insecure registries to allow with the created engineā€ resourceId: =1ph14
time=ā€œ2016-07-20T00:23:17Zā€ level=info msg=ā€œstdout: --engine-install-url ā€œhttps://get.docker.comā€\t\t\t\t\t\t\tCustom URL to use for engine installation [$MACHINE_DOCKER_INSTALL_URL]ā€ resourceId: =1ph14
time=ā€œ2016-07-20T00:23:17Zā€ level=info msg=ā€œstdout: --engine-label [ā€“engine-label option --engine-label option]\t\t\t\t\t\tSpecify labels for the created engineā€ resourceId: =1ph14
time=ā€œ2016-07-20T00:23:17Zā€ level=info msg=ā€œstarting cleanupā€¦ā€ machine name=ovh-host2
time=ā€œ2016-07-20T00:23:17Zā€ level=error msg=ā€œError processing eventā€ err=ā€œexit status 1ā€ eventId=c1113176-c297-4e56-ae26-aa999b13a635 eventName=ā€œphysicalhost.create;handler=goMachineServiceā€ resourceId=1ph14
time=ā€œ2016-07-20T00:24:00Zā€ level=info msg=ā€œStack Create Event Receivedā€ eventId=cf5275ca-1589-4aec-919f-90e2c385c8f8 resourceId=1e4
time=ā€œ2016-07-20T00:24:00Zā€ level=info msg=ā€œStack Create Event Doneā€ eventId=cf5275ca-1589-4aec-919f-90e2c385c8f8 resourceId=1e4
time=ā€œ2016-07-20T00:31:34Zā€ level=info msg=ā€œPurging Machineā€ eventId=559a3e23-498e-48c3-b69d-3015fc8fa453 resourceId=1ph14
time=ā€œ2016-07-20T00:31:34Zā€ level=info msg=ā€œMachine purgedā€ machineDir=ā€/var/lib/cattle/machine/33d24829-4a8b-46f6-90e0-af941d8f80a8ā€ machineExternalId=33d24829-4a8b-46f6-90e0-af941d8f80a8 resourceId=1ph14

The URL you used is to docker-machine-driver-ovh-linux-amd64, but docker-machine expects the file to be named docker-machine-driver-NAME (i.e. docker-machine-driver-ovh). So we download and install the file but the call to docker-machine create --driver=ovh ... doesnā€™t find a driver binary.

Typically driver releases are uploaded as a tarball instead of a naked binary, named with the OS/architecture but containing an actual binary named just what docker-machine expects (e.g. https://github.com/janeczku/docker-machine-vultr/releases).

1 Like

Actually it seems still the case in 1.5.3. This is kind of annoying to restart the service for this case. Is there any sanity check that can be done there ?

Not really a machine-driver specialist but of iā€™m pointed to the right direction i might look into it