dhiltgen / docker-machine-kvm

KVM driver for docker-machine
Apache License 2.0
377 stars 117 forks source link

Unable to run on CentOS #9

Closed lazyval closed 8 years ago

lazyval commented 8 years ago
$ cat /etc/issue
CentOS release 6.7 (Final)
Kernel \r on an \m
$ uname -a
Linux <snip> 2.6.32-573.12.1.el6.x86_64 #1 SMP Tue Dec 15 06:42:08 PST 2015 x86_64 x86_64 x86_64 GNU/Linux
$ bin/docker-machine-driver-kvm 
bin/docker-machine-driver-kvm: /usr/lib64/libvirt.so.0: version `LIBVIRT_1.1.1' not found (required by bin/docker-machine-driver-kvm)
bin/docker-machine-driver-kvm: /usr/lib64/libvirt.so.0: version `LIBVIRT_1.0.2' not found (required by bin/docker-machine-driver-kvm)
$ libvirtd --version
libvirtd (libvirt) 0.10.2

Any other info I need to provide in order to isolate issue?

For sure, I know that true way to use this driver is to issue following command, but it doesn't work either:

$ docker-machine create -d kvm myengine0
Error loading driver "kvm": dial tcp: missing address
dhiltgen commented 8 years ago

It looks like the centos 6.x version is too old. Not sure if RH has been backporting things for it upstream, but the mainline 0.10 release looks to be ~4 years old according to the libvirt.org page.

Not sure what the best course of action is. Looking at Centos 7, I see it has 1.2.17 libvirt, which is more likely to work (I don't have a physical centos box to test/confirm) If you're stuck on 6.x, you might consider downloading the source from http://libvirt.org/downloads.html to update it.

lazyval commented 8 years ago

Thanks for a quick response! Yup, we're stuck with Centos 6.x :-( I will test with a newer libvirt and let you know

jhmnieuwenhuis commented 8 years ago

I have the same issue as a normal user in centos 7:

docker-machine create -d kvm dockerhans1 dial tcp: missing address

When I login as root it works fine and the machine is created

Any ideas ?

dhiltgen commented 8 years ago

@jhmnieuwenhuis you probably haven't wired up group membership to allow your user account access to the libvirt socket. It depends on the distro, but I think most packaing sets it up as root only, but you can add members to a group (something like "libvirt" to allow access. Here's an example from my Ubuntu based system:

% ls -l /var/run/libvirt/libvirt-sock
srwxrwx--- 1 root libvirtd 0 Feb 29 17:24 /var/run/libvirt/libvirt-sock=
% groups
daniel adm cdrom sudo dip plugdev lpadmin sambashare docker libvirtd
jhmnieuwenhuis commented 8 years ago

spot on !! That solved the issue. B.t.w. Excellent job on the kvm plugin !!

Regards,

Hans Nieuwenhuis

jhmnieuwenhuis commented 8 years ago

One other question. When i create "normal" vm's on centos7 using virt-install i use lvm thin volumes. I suppose that's not possible when using docker-machine -d kvm ??

Regards, Hans

dhiltgen commented 8 years ago

That's not currently possible, but could be added.

If you wanted to take a crack at it and submit a PR, I think most of the logic would live within https://github.com/dhiltgen/docker-machine-kvm/blob/master/kvm.go#L654-L670 and perhaps a new command line flag to toggle the behavior.

jhmnieuwenhuis commented 8 years ago

Well that's not something I am able to do. My knowledge does not go that far. I consider myself a student although I am 60 years old and live in the Netherlands. Due to a serious accident I had to retire from work last year. I have always been a (project)manager in IT with an interest in programming and document management. These days I do voluntary work with elderly people, I love to tour on my bike and to keep my brain in shape I study. ( php, postgresql, symfony, drupal, centos7, kvm and since a week also docker) My plan is to create a drupal site with all kinds of information on above subjects and on bicycling. But thanks for the quick responses on my questions. If I can help by testing something, let me know.

Regards, Hans

jhmnieuwenhuis commented 8 years ago

Hi, two more observations

1) when I run docker-machine upgrade on a kvm machine as a non-root user it will not work. error : chmod /home/hn/.docker/machine/machines/docker1/boot2docker.iso: operation not permitted this file is owned by qemu:qemu

2) when I use "--kvm-network default" when creating the kvm machine, there wil be 2 network interfaces created one for source-network default and one for source-network docker-machines.

when i use "--kvm-network docker-machines" there are also two network interfaces created but they are both for source-network docker-machines

There where already kvm vm's created on my host before I used docker on it. They where created using virt-install and using source-network default.

Regards,

Hans

dhiltgen commented 8 years ago

1 is probably a genuine bug. I don't usually use upgrade in my workflow, so it may have regressed since I originally wrote the driver.

For #2, the driver could be enhanced to detect this case, but it shouldn't cause any major problems to have two interfaces on the same network.