xenserver / xscontainer

Support for Docker and Container Management
BSD 2-Clause "Simplified" License
25 stars 14 forks source link

xscontainer-prepare-vm not working #42

Closed geek-baba closed 7 years ago

geek-baba commented 7 years ago

I dont know if its bug with Xen Server 7.1 or what but no matter how I try xscontainer-prepare-vm -v -u , I get the following error (obiviously I use the real UUID and real username).

usage: xscontainer-prepare-vm [-h] -v VMUUID [--mode {ssh,tls}] [-u USERNAME]
[--client-cert CLIENT_CERT]
[--client-key CLIENT_KEY] [--ca-cert CA_CERT]
[--generate-certs]
xscontainer-prepare-vm: error: argument -v/--vmuuid is required
thomasmck commented 7 years ago

Hi, I've tried reproducing this issue but haven't experienced any issues when using "xscontainer-prepare-vm -v -u ". What is the version number of the xscontainer iso you installed?

Could you take a look at /bin/xscontainer-prepare-vm and paste the code from the parse_options function here to double check it looks as it should do.

geek-baba commented 7 years ago

Hi, I used XenServer-7.1.0-xscontainer.iso, just to make sure I am doing the right thing, I created a new Ubuntu VM (16.04.2 LTS) followed this guide also posting the code from the parse_options function here:

def main():
    options = parse_options()
    session = None
    try:
        session = api_helper.get_local_api_session()
        if not api_helper.get_vm_is_running(session, options.vmuuid):
            print ("Error: The VM must be running for the preparation.\n"
                   "Please start the VM.")
            return 1
        if options.mode == 'ssh':
            resultcode = _handle_ssh(session, options)
        elif options.mode == 'tls':
            resultcode = _handle_tls(session, options)
        if resultcode == 0:
            api_helper.set_vm_xscontainer_mode(
                session, options.vmuuid, options.mode)
            resultcode = verify_monitoring(
                session, options.vmuuid, options.username)
            while resultcode!=0:
                print "Do you wish to retry?"
                if ask_yes_or_no():
                    resultcode = verify_monitoring(
                        session, options.vmuuid, options.username)
                else:
                    break
        if resultcode == 0:
            register_vm_for_monitoring(session, options.vmuuid)
    except KeyboardInterrupt:
        resultcode = 1
    finally:
        if session is not None:
            session.xenapi.session.logout()
    return resultcode

if __name__ == "__main__":
    sys.exit(main())
geek-baba commented 7 years ago

Still getting the same error:

[root@xenserver ~]# xscontainer-prepare-vm –v xxxxxxxxx-5f6c-528c-73d0-xxxxxxxxxxxx  -u xxxxx
usage: xscontainer-prepare-vm [-h] -v VMUUID [--mode {ssh,tls}] [-u USERNAME]
                              [--client-cert CLIENT_CERT]
                              [--client-key CLIENT_KEY] [--ca-cert CA_CERT]
                              [--generate-certs]
xscontainer-prepare-vm: error: argument -v/--vmuuid is required
thomasmck commented 7 years ago

Would you be able to upload your iso file to here (https://citrix.sharefile.com/r-racec1473e35493e8) so I can test it.

Also could you point me to the location you downloaded xscontainer from? If there is something you with it I will make sure to update the download file

geek-baba commented 7 years ago

Sure, uploaded the file and here is the link I downloaded it from: http://downloadns.citrix.com.edgesuite.net/11993/XenServer-7.1.0-xscontainer.iso

thomasmck commented 7 years ago

capture

Just tested with the xscontainer iso that you uploaded and the one from the download path both of which work fine for me. I assume you haven't played around with any of the xscontainer files after you installed it?

Was your XS install from fresh? Was there a pre-existing version of xscontainer?

At this point I would suggest that you re-download XS and xscontainer and install them from stratch if possible.

thomasmck commented 7 years ago

Ok @robertbreker has cracked it. You are using a different kind of dash. Yours looks like '–' (n-dash) when it should be '-' (hyphen) (note it is much smaller). If you copy and paste in "xscontainer-prepare-vm -v [uuid] -u [username]" then it should work fine.

We will update the documentation from the guide to fix this issue.

olivierlambert commented 7 years ago

Nice catch!

geek-baba commented 7 years ago

You guys rock! The amazing part is I have tried at least 15 different online tutorials and all of them copied the long dash for some reason :)

Also you may want to add the step before running the script to assign user to docker group, that would be helpful for n00bs: sudo usermod -aG docker $(whoami)

thomasmck commented 7 years ago

Might be worth adding comments on the tutorials to save people from this confusion in the future. If they are Citrix tutorials I might be able to get them updated if you provide me with the urls.

geek-baba commented 7 years ago

Sure:

  1. https://xenserver.org/partners/docker/23-guides.html This one for Olivier, if he would like to get it updated
  2. https://xen-orchestra.com/blog/docker-support-in-xenserver-the-ultimate-guide/
thomasmck commented 7 years ago

Ok I've spoken to the xenserver.org admins, hopefully this should be fixed soon

olivierlambert commented 7 years ago

My tutorial is OK with the dash - char, but I'll update with the usermod :) edit: post updated with the usermod command :)

geek-baba commented 7 years ago

Looks like this feature "xscontainer-prepare-vm" stooped working XenServer 7.2.0, I stopped seeing all my containers and when I run the command from UUID i get "-bash: xscontainer-prepare-vm: command not found"

thomasmck commented 7 years ago

Hi, I think the issue is that you need to install the new XS 7.2 xscontainer supp-pack. This can be found on the download page (https://www.citrix.com/downloads/xenserver/product-software/xenserver-72-standard-edition.html) under 'Container Management Supplemental Pack'. Kind regards, Tom

geek-baba commented 7 years ago

Yes - that was the issue, I did not realize that I need to install the supp pack after the upgrade.

thomasmck commented 7 years ago

No problem, we should probably have made it a bit clearer that they don't carry over