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