Arubacloud/docker-machine-driver-arubacloud

Unable to attach to existing server

gaberosser opened this issue · 11 comments

I have launched a new 'cloud server smart' instance using the admin interface on the website. It's in endpoint DC1-IT and running Ubuntu server 16.04. I supplied my SSH key at instantiation and can connect to my new server fine over SSH.
I tried to attach a docker machine to this existing server following the instructions:

docker-machine create --driver arubacloud \
--ac_username "AWI-93709" \
--ac_password "xxxxxx" \
--ac_endpoint "dc1" \
--ac_action "Attach" \
--ac_ip "212.237.10.229" \
--ac_ssh_key "/home/gabriel/.ssh/id_rsa" \
effington

However, this process fails as follows:

(effington) Trying to access option ac_package_id which does not exist
(effington) THIS ***WILL*** CAUSE UNEXPECTED BEHAVIOR
Running pre-create checks...
(effington) Type assertion did not go smoothly to int for key ac_package_id
Creating machine...
Error creating machine: Error in driver during machine creation: API Error: Authentication failed, token not found.

I think the problem is that I do not have API access credentials. The docs simply state "to acquire API access visit https://www.cloud.it". However, it is not obvious how to obtain access from here. Thanks.

Hi gaberosser
I think that you are using bad credentials:
--ac_username "AWI-93709"
--ac_password "xxxxxx"
These here are your api access credentials. They are the same used for the admin interface on the website.
Advise us if you have any other problem with the driver.

Thank you

Hello,

I am attaching to this thread since it seems to me that the problem could be similar in some ways.

we have a script like the following:

#!/bin/bash
docker-machine create --driver arubacloud \
 --ac_username "AWI-27705" \
 --ac_password "*********" \
 --ac_endpoint "dc1" \
 --ac_template "ubuntu1604_x64_1_0" \
 --ac_size "Small" \
 --ac_admin_password "*******" \
 --ac_action "NewSmart" \
ethicserver1

and we get the following output:

(ethicserver1) Trying to access option ac_package_id which does not exist
(ethicserver1) THIS ***WILL*** CAUSE UNEXPECTED BEHAVIOR
(ethicserver1) Type assertion did not go smoothly to int for key ac_package_id
Running pre-create checks...
Creating machine...

then it blocks for some minutes but then we get:

...
Running pre-create checks...
Creating machine...
Error creating machine: Error in driver during machine creation: Maximum number of retries (10) exceeded

within the aruba console at the address: https://admin.dc1.arubacloud.com/Manage/Server/ServerList.aspx we see:

aruba1

and if I execute the command docker-machine ls we get:

docker-machine ls
NAME           ACTIVE   DRIVER       STATE   URL   SWARM   DOCKER    ERRORS
ethicserver1   -        arubacloud   Error                 Unknown   API Error: Could not find Server Id 0

I forgot:

We are using: docker-machine version 0.10.0, build 76ed2a6

The machine got created finally:

aruba2

The command was launched at 13:14 GMT. It seems it took 4 hours for the provisioning.

However, the following command yet returns an invalid status:

docker-machine ls
NAME           ACTIVE   DRIVER       STATE   URL   SWARM   DOCKER    ERRORS
ethicserver1   -        arubacloud   Error                 Unknown   API Error: Could not find Server Id 0

I cannot remove the machine without forcing it, but if i pass --force I could remove it.

docker-machine rm --force ethicserver1
About to remove ethicserver1
WARNING: This action will delete both local reference and remote instance.
Error removing host "ethicserver1": API Error: Could not find Server Id 0
Successfully removed ethicserver1

then, I we try to attach it to the running instance, with the following command.

#!/bin/bash
docker-machine create --driver arubacloud \
 --ac_username "AWI-27705" \
 --ac_password "******" \
 --ac_endpoint "dc1" \
 --ac_ip "94.177.217.67" \
 --ac_action "Attach" \
ethicserver1

we get:

(ethicserver1) Trying to access option ac_package_id which does not exist
(ethicserver1) THIS ***WILL*** CAUSE UNEXPECTED BEHAVIOR
Running pre-create checks...
(ethicserver1) Type assertion did not go smoothly to int for key ac_package_id
Creating machine...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Error creating machine: Error detecting OS: Too many retries waiting for SSH to be available.  Last error: Maximum number of retries (60) exceeded

maybe do we need to create the instance with a provided private key that needs to be created before launching the provisioning command?

Yes you need of a private key that the docker-machine use it to make the ssh access.

The command to attach is:
docker-machine create --driver arubacloud
--ac_username "ARU-XXXX"
--ac_password "xxxxxxx"
--ac_endpoint "dc1"
--ac_action "Attach" \
--ac_ip "xx.xx.xx.xx" \
--ac_ssh_key "private_key_path"
MyDockerExistingHostName

you can find it here in the doc:
https://github.com/Arubacloud/docker-machine-driver-arubacloud#attach-to-an-existing-machine.

To find where is the private_key_path depend on how you created the machine.
If you created the machine using the docker-machine, and reading the comments it's your case, you can find the private key inside the .docker folder in your home, because it was created automatically by the docker-machine.
In the .docker folder you should find your file in this path:
/home/your-user/.docker/machine/machines/your-machine-name/id_rsa

If you created the machine by hand, in our Dashboard, that machine must have been created with an SSH key if you want attach in the docker-machine, so you should have that file.

Hello Luca,

Thanks for your answer. Actually no. We did not create the machine by hand. The ssh keys were generated by the command issued before, which anyway, created the machine within aruba cloud correctly, although it took a lot of time, as you can see on my previous comments.

And the command for creating it by using the arubacloud driver returned with an error.

We would like to do more creation tests but it costs 1 euro for each test! :D

you can attach to an existing machine without pay anything, we did that command fot that.

The command to attach is:
docker-machine create --driver arubacloud
--ac_username "ARU-XXXX"
--ac_password "xxxxxxx"
--ac_endpoint "dc1"
--ac_action "Attach"
--ac_ip "xx.xx.xx.xx"
--ac_ssh_key "private_key_path"
MyDockerExistingHostName

the only parameter you have to pay attention is:
--ac_ssh_key "private_key_path"

There you have to put the path for your ssh private key for that machine, and you can find it in the machine you ran the docker-machine create command in this path:
/home/your-user/.docker/machine/machines/your-machine-name/id_rsa

Hi Luca,

Yes you are right, I am sorry. I did not explain well the original issue. Maybe I should open a new issue, shouldn't I?

The original problem is that machine creation with action NewSmart fails. I will try to create another one right now.

Thanks for your help! :)

Hello Luca,

We don't know what happened but this time the procedure worked!

Thanks for you support.

Thank you for your patience.

The docker-machine when creates a machine try to connect in ssh to the machine that is creating, when the docker-machine achieves the ssh connection the creation will go in success but if the creation takes a long time the docker-machine create command will go in error. In that day there was an extraordinary work load for that data center 1, maybe this was that the cause for the delay.

However you could recover the machine in the docker-machine managing the docker-machine configuration or using the attach command.

Thank you again and for any problem or question contact us.