lnxbil/docker-machine-driver-proxmox-ve

Does it support Proxmox VE 6?

onegreyonewhite opened this issue · 11 comments

I have tried to use it in Rancher 2.3.2 as node driver but always got:

failed with : Error with pre-create check: "unexpected end of JSON input"

The main problems - at least in my experience - come from the used OS. Can you please enable debug and state all arguments (mask sensitive information properly) you used to try?

Output:

$ ./pve-machine.sh 
Docker Machine Version:  0.13.0, build 
Found binary path at /home/grey/.local/bin/docker-machine-driver-proxmox-ve
Launching plugin server for driver proxmox-ve
Plugin server listening at address 127.0.0.1:46835
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(flag-lookup) Calling .GetMachineName
(flag-lookup) Calling .DriverName
(flag-lookup) Calling .GetCreateFlags
Found binary path at /home/grey/.local/bin/docker-machine-driver-proxmox-ve
Launching plugin server for driver proxmox-ve
Plugin server listening at address 127.0.0.1:43655
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(boot2docker) Calling .GetMachineName
(boot2docker) Calling .DriverName
(boot2docker) Calling .GetCreateFlags
(boot2docker) Calling .SetConfigFromFlags
Creating CA: /home/grey/.docker/machine/certs/ca.pem
Creating client certificate: /home/grey/.docker/machine/certs/cert.pem
Running pre-create checks...
(boot2docker) Calling .PreCreateCheck
Error with pre-create check: "unexpected end of JSON input"
notifying bugsnag: [Error with pre-create check: "unexpected end of JSON input"]

Script:

#!/bin/bash

PVE_NODE="cloud.domain.lan"
PVE_HOST="$PVE_NODE"
PVE_USER="root"
PVE_MEMORY=4
PVE_REALM="pam"
PVE_PASSWD="PASSWORD"
PVE_POOL="rancher"
PVE_STORAGE="local-lvm-thinpool"
PVE_STORAGE_TYPE="RAW"
PVE_IMAGE_FILE="isos:iso/boot2docker.iso"
VM_NAME="boot2docker"

docker-machine rm --force $VM_NAME >/dev/null 2>&1 || true

docker-machine --debug \
    create \
    --driver proxmox-ve \
    --proxmox-host $PVE_HOST \
    --proxmox-user $PVE_USER \
    --proxmox-realm $PVE_REALM \
    --proxmox-password $PVE_PASSWD \
    --proxmox-node $PVE_NODE \
    --proxmox-memory-gb $PVE_MEMORY \
    --proxmox-image-file "$PVE_IMAGE_FILE" \
    --proxmox-storage $PVE_STORAGE \
    --proxmox-pool $PVE_POOL \
    --proxmox-storage-type $PVE_STORAGE_TYPE \
    $* \
    $VM_NAME || exit 1

eval $(docker-machine env boot2docker) || exit 1

docker ps || exit 1

OS:

$ uname -a
Linux onegreyonewhite 5.3.10-calculate #1 SMP PREEMPT Mon Nov 11 11:18:18 UTC 2019 x86_64 Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz GenuineIntel GNU/Linux
$ cat /etc/gentoo-release 
Calculate Linux Desktop 18.12 KDE

Thank you. From where did you download the boot2docker.iso image?

Please also enable the resty debug flag --proxmox-resty-debug for the driver so that the API communication is also printed (be careful in posting, credentials are readable in clear text).

So, just released a new version with polishes the error handling and is exclusively focussed on RancherOS and works out-of-the-box with the recent RancherOS version for PVE. I also tried it with PVE 6.0-15.

Please try the new version with the RancherOS iso.

I found cert error. It may be main problem. Maybe there is some kind of flag that disables certificate verification?

$ ./pve-machine.sh      
Docker Machine Version:  0.13.0, build 
Found binary path at /home/grey/.local/bin/docker-machine-driver-proxmox-ve
Launching plugin server for driver proxmox-ve
Plugin server listening at address 127.0.0.1:32955
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(flag-lookup) Calling .GetMachineName
(flag-lookup) Calling .DriverName
(flag-lookup) Calling .GetCreateFlags
Found binary path at /home/grey/.local/bin/docker-machine-driver-proxmox-ve
Launching plugin server for driver proxmox-ve
Plugin server listening at address 127.0.0.1:37211
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(rancheros-autoformat) Calling .GetMachineName
(rancheros-autoformat) Calling .DriverName
(rancheros-autoformat) Calling .GetCreateFlags
(rancheros-autoformat) Calling .SetConfigFromFlags
Running pre-create checks...
(rancheros-autoformat) Calling .PreCreateCheck
(rancheros-autoformat) DBG | RESTY 2019/11/27 14:23:42 
(rancheros-autoformat) DBG | ---------------------- REQUEST LOG -----------------------
(rancheros-autoformat) DBG | GET  /api2/json/cluster/nextid  HTTP/1.1
(rancheros-autoformat) DBG | HOST   : cloud.domain.lan:8006
(rancheros-autoformat) DBG | HEADERS:
(rancheros-autoformat) DBG |       Csrfpreventiontoken: somecookie
(rancheros-autoformat) DBG |                User-Agent: go-resty v1.3 - https://github.com/go-resty/resty
(rancheros-autoformat) DBG |                    Cookie: PVEAuthCookie=PVE:root@pam:somecookie
(rancheros-autoformat) DBG | BODY   :
(rancheros-autoformat) DBG | ***** NO CONTENT *****
(rancheros-autoformat) DBG | ----------------------------------------------------------
(rancheros-autoformat) DBG | RESTY 2019/11/27 14:23:42 
(rancheros-autoformat) DBG | ---------------------- RESPONSE LOG -----------------------
(rancheros-autoformat) DBG | STATUS             : 200 OK
(rancheros-autoformat) DBG | RECEIVED AT        : 2019-11-27T14:23:42.446113887+10:00
(rancheros-autoformat) DBG | RESPONSE TIME      : 2.189639ms
(rancheros-autoformat) DBG | HEADERS:
(rancheros-autoformat) DBG |                           Date: Wed, 27 Nov 2019 04:23:42 GMT
(rancheros-autoformat) DBG |                         Pragma: no-cache
(rancheros-autoformat) DBG |                         Server: pve-api-daemon/3.0
(rancheros-autoformat) DBG |                 Content-Length: 14
(rancheros-autoformat) DBG |                   Content-Type: application/json;charset=UTF-8
(rancheros-autoformat) DBG |                        Expires: Wed, 27 Nov 2019 04:23:42 GMT
(rancheros-autoformat) DBG |                  Cache-Control: max-age=0
(rancheros-autoformat) DBG |                     Connection: Keep-Alive
(rancheros-autoformat) DBG | BODY   :
(rancheros-autoformat) DBG | {
(rancheros-autoformat) DBG |    "data": "106"
(rancheros-autoformat) DBG | }
(rancheros-autoformat) DBG | ----------------------------------------------------------
(rancheros-autoformat) DBG | RESTY 2019/11/27 14:23:42 
(rancheros-autoformat) DBG | ---------------------- REQUEST LOG -----------------------
(rancheros-autoformat) DBG | GET  /api2/json/nodes/cloud.domain.lan/storage  HTTP/1.1
(rancheros-autoformat) DBG | HOST   : cloud.domain.lan:8006
(rancheros-autoformat) DBG | HEADERS:
(rancheros-autoformat) DBG |                    Cookie: PVEAuthCookie=PVE:root@pam:somecookie
(rancheros-autoformat) DBG |                User-Agent: go-resty v1.3 - https://github.com/go-resty/resty
(rancheros-autoformat) DBG | BODY   :
(rancheros-autoformat) DBG | ***** NO CONTENT *****
(rancheros-autoformat) DBG | ----------------------------------------------------------
(rancheros-autoformat) DBG | RESTY 2019/11/27 14:23:42 
(rancheros-autoformat) DBG | ---------------------- RESPONSE LOG -----------------------
(rancheros-autoformat) DBG | STATUS             : 596 tls_process_server_certificate: certificate verify failed
(rancheros-autoformat) DBG | RECEIVED AT        : 2019-11-27T14:23:42.457038372+10:00
(rancheros-autoformat) DBG | RESPONSE TIME      : 10.744867ms
(rancheros-autoformat) DBG | HEADERS:
(rancheros-autoformat) DBG |                        Expires: Wed, 27 Nov 2019 04:23:42 GMT
(rancheros-autoformat) DBG |                  Cache-Control: max-age=0
(rancheros-autoformat) DBG |                           Date: Wed, 27 Nov 2019 04:23:42 GMT
(rancheros-autoformat) DBG |                         Pragma: no-cache
(rancheros-autoformat) DBG |                         Server: pve-api-daemon/3.0
(rancheros-autoformat) DBG | BODY   :
(rancheros-autoformat) DBG | 
(rancheros-autoformat) DBG | ----------------------------------------------------------
Error with pre-create check: "unexpected end of JSON input"
notifying bugsnag: [Error with pre-create check: "unexpected end of JSON input"]

Oh, that is strange indeed. I do not have a working certificate in my test environment either, but it works as it should. The validation is already skipped, so it has to be another certificate related issue like expired, wrong hostname, etc.

Expiration date in 2029 and hostname is valid - I have checked it.

It is also strange that some API calls work only the last one does not with the tls_process_server_certificate. AFAIK, the connection is never closed, so there should not be a revalidation Have you looked at the server side, maybe some stange error is reported there.

The DBG in the beginning suggests, that you're not using v2, is this correct?

I found problem!
I GUI node-name is cloud.domain.lan but in API node-name is just a cloud. Changing PVE_NODE='cloud' solves this problem.
ThanX for your help.

Glad it worked out.