karmab / kcli

Management tool for virtualization and kubernetes platforms
https://kcli.readthedocs.io/en/latest/
Apache License 2.0
516 stars 141 forks source link

No configuration found nor local hypervisor #195

Closed brokedba closed 4 years ago

brokedba commented 4 years ago

Hi , I just installed kvm in my Rhel7 clone (Oracle L7) and when I install kcli and try the list command I receive the below error . Is anything wrong?

`

docker.io/karmab/kcli:latest
the input device is not a TTY
Installed kcli
Launch a new shell for aliases kcli, kclishell and kweb to work
[root@localhost ~]# /usr/libexec/qemu-kvm --version
QEMU emulator version 1.5.3 (qemu-kvm-1.5.3-173.el7_8.1), Copyright (c) 2003-2008 Fabrice Bellard
[root@localhost ~]# lsmod | grep kvm
kvm                   659456  0
irqbypass              16384  1 kvm
 [root@localhost ~]# kcli list product
No configuration found nor local hypervisor

`

brokedba commented 4 years ago

btw, I was using Virtuabox so I had to upgrade to the las version to enable nested virtualization. Intel VT cpu instruction set (vmx) is now visible in the KVM host but I still have the same error.

[vagrant@localhost ~]$ lsmod | grep kvm
kvm_intel             229376  0
kvm                   659456  1 kvm_intel
irqbypass              16384  1 kvm

[root@localhost vagrant]# kcli list product
No configuration found nor local hypervisor
brokedba commented 4 years ago

I don't know why but it works now . I wanted to know if this error is normal

`[root@localhost .kcli]# kcli download image centos7
Using pool guest_images
Using url https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2...
Grabbing image centos7...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: Failed to create the file
Warning: /u01/guest_images/CentOS-7-x86_64-GenericCloud.qcow2: No such file or
Warning: directory
  0  898M    0 16384    0     0  48761      0  5:22:07 --:--:--  5:22:07 48761
curl: (23) Failed writing body (0 != 16384)
Image centos7 not Added because Unable to download indicated image`

by the way where is the list of cloud image aliases stored ?? I wanted to download ubuntu but don't know what name to put in the command .

karmab commented 4 years ago

hello,

alias kcli="docker run --net host -it --rm --security-opt label=disable -v $HOME/.kcli:/root/.kcli -v /var/lib/libvirt/images:/var/lib/libvirt/images -v /var/run/libvirt:/var/run/libvirt -v $PWD:/workdir -v /var/tmp:/ignitiondir karmab/kcli"
usage: kcli download image [-h] [-c CMD] [-p POOL] [-u URL] [-s] IMAGE

Download Cloud Image

positional arguments:
  IMAGE                 Image to download. Choose between arch centos6 centos7
                        centos8 cirros coreos debian8 debian9 debian10
                        fedora28 fedora29 fedora30 fcos fedora31 freebsd112
                        freebsd121 netbsd81 netbsd90 openbsd66 gentoo opensuse
                        rhcos41 rhcos42 rhcos43 rhcos44 rhcos45 rhcoslatest
                        rhel7 rhel8 ubuntu1804 ubuntu1810 ubuntu1904
                        ubuntu1910

optional arguments:
  -h, --help            show this help message and exit
  -c CMD, --cmd CMD     Extra command to launch after downloading
  -p POOL, --pool POOL  Pool to use. Defaults to default
  -u URL, --url URL     Url to use
  -s, --skip-profile    Skip Profile update
brokedba commented 4 years ago

Hi , Thanks a lot for the feedback . I thought there was something wrong with the pool access as well. I just didn't get how to add the container alias for the pool directory in the kcli invocation. Do you know which argument I should ad the alias to ? or is it a separate alias command run beforehand . Thanks

[root@localhost terraform]#  kcli download image ubuntu1804    /u01/guest_images:/u01/guest_images
usage: kcli [-h] [-C CLIENT] [--containerclient CONTAINERCLIENT]
            [--dnsclient DNSCLIENT] [-d] [-n NAMESPACE] [-r REGION] [-z ZONE]
karmab commented 4 years ago

this alias should do the trick for you

alias kcli="docker run --net host -it --rm --security-opt label=disable -v $HOME/.kcli:/root/.kcli -v /var/lib/libvirt/images:/var/lib/libvirt/images -v /var/run/libvirt:/var/run/libvirt -v $PWD:/workdir -v /var/tmp:/ignitiondir karmab/kcli"

about your example, the command would be

kcli download image ubuntu1804 -p your_pool

where your_pool would be the storage pool associated to your /u01/guest_images directory, which should be listed with the command kcli list pool

karmab commented 4 years ago

also, consider joining my slack channel on k8s for more live troubleshooting https://app.slack.com/client/T09NY5SBT/CU76B52JE

brokedba commented 4 years ago

whats your slack workspace ? I wanted to join way before submitting the issue.

karmab commented 4 years ago

kcli on slack kubernetes!

brokedba commented 4 years ago

Thanks Karmab for your help, Here is a little wrap up of what had to be done to get the above issue resolved. In case other users face the same symptoms.

  1. Adapt the pool parameter in the ~/.kcli/config.yml file accordingly.

  2. Edit the alias for kcli : i.e my pool was named guest_images and the path is : /u01/guest_images The alias will hence look like this :

    alias kcli='docker run --net host -it --rm --security-opt label=disable -v /root/.kcli:/root/.kcli -v /root/.ssh:/root/.ssh -v /u01/guest_images:/u01/guest_images -v /var/run/libvirt:/var/run/libvirt -v $PWD:/workdir -v /var/tmp:/ignitiondir karmab/kcli'

Cheers