Open darkn3rd opened 4 years ago
This is related to https://github.com/libvirt/libvirt/commit/0f87054b61d73493fb505ecb97bd16615bc53699 since libvirt doesn't use a dnsmasq file for this anymore (--leasefile-ro
).
As you say, the error format is misleading. It should probably have been "file not found", not that it would have helped...
Also seen in #60 and #72
minikube uses virtio now
Actually it was not only using the correct code (status instead of leases), it also needs to use a different network card. The current "rtl8139" is not supported with the kernel config, it doesn't have to use virtio but can at least use "e1000".
model type rtl8139 (fails)
model type e1000 (works)
It is possible to backport code from minikube to this driver, but since it is not supported anymore there will be no releases. With enough interest it would be possible to make an version at https://github.com/machine-drivers/docker-machine-kvm
diff --git a/kvm.go b/kvm.go
index 1e6c891..c73de61 100644
--- a/kvm.go
+++ b/kvm.go
@@ -665,11 +667,22 @@ func (d *Driver) GetIP() (string, error) {
if err != nil {
return "", err
}
- /*
- * TODO - Figure out what version of libvirt changed behavior and
- * be smarter about selecting which algorithm to use
- */
- ip, err := d.getIPByMACFromLeaseFile(mac)
+ conn, err := d.getConn()
+ if err != nil {
+ return "", err
+ }
+ defer conn.Close()
+
+ var ip string
+ libVersion, err := conn.GetLibVersion()
+ if err != nil {
+ return "", err
+ }
+
+ // Earlier versions of libvirt use a lease file instead of a status file
+ if libVersion < 1002006 {
+ ip, err = d.getIPByMACFromLeaseFile(mac)
+ }
if ip == "" {
ip, err = d.getIPByMacFromSettings(mac)
}
As newbie to all of this, some questions:
Those were the virtual nics, the"rtl8139" is the default and I changed it to "e1000" in a local build:
--- a/kvm.go
+++ b/kvm.go
@@ -60,9 +60,11 @@ const (
</graphics>
<interface type='network'>
<source network='{{.Network}}'/>
+ <model type='e1000'/>
</interface>
<interface type='network'>
<source network='{{.PrivateNetwork}}'/>
+ <model type='e1000'/>
</interface>
</devices>
</domain>`
The lease file used to carry the IPs allocated, but it is now in the status file (in dnsmasq) instead.
No releases: meaning there will be no more tag versions? Or meaning this is in archival mode, no more commits for master? It would be nice to add to master or docs...
See https://github.com/dhiltgen/docker-machine-kvm/issues/67
Only the VirtualBox driver was officially supported by Docker Inc., and now Machine is deprecated too.
So far there has been no volunteers to take over the development and release, in the "new" organization.
As the name implies, it was originally only for drivers:
@darkn3rd : You can find a prebuilt binary here: https://github.com/afbjorklund/docker-machine-kvm
The missing kernel configuration for "rtl8139cp" was reported here: https://github.com/boot2docker/boot2docker/issues/1407
@darkn3rd : You can find a prebuilt binary here: https://github.com/afbjorklund/docker-machine-kvm
That solved this exact issue for me
I tried to use the latest released version with docker-machine, and I am getting this error. I am not deeply familiar with KVM or libvirt, so I am not sure how this works. I have libvirt working fine with vagrant and mini-kube (using their embedded kvm2 docker-machine driver) without any problems. I am not sure how I could debug further.
There's no such file
/var/lib/libvirt/dnsmasq/docker-machines.leases
.