Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dhcp_leases.rb:8:in `dhcp_leases': Call to virNetworkGetDHCPLeases failed: internal error: no lease with matching MAC address: 52:54:00:32:36:b7 (Libvirt::Error) #28

Closed
infernix opened this issue Oct 12, 2016 · 5 comments

Comments

@infernix
Copy link

When calling dhcp_leases with a mac that does not exist, libvirt throws an error.

/root/.vagrant.d/gems/gems/fog-libvirt-0.3.0/lib/fog/libvirt/requests/compute/dhcp_leases.rb:8:in `dhcp_leases': Call to virNetworkGetDHCPLeases failed: internal error: no lease with matching MAC address: 52:54:00:32:36:b7 (Libvirt::Error)
    from /root/.vagrant.d/gems/gems/fog-libvirt-0.3.0/lib/fog/libvirt/requests/compute/dhcp_leases.rb:8:in `dhcp_leases'
    from /root/.vagrant.d/gems/gems/fog-libvirt-0.3.0/lib/fog/libvirt/models/compute/network.rb:20:in `dhcp_leases'
    from /root/.vagrant.d/gems/gems/fog-libvirt-0.3.0/lib/fog/libvirt/models/compute/server.rb:272:in `block in addresses'
    from /root/.vagrant.d/gems/gems/fog-core-1.43.0/lib/fog/core/collection.rb:19:in `each'
    from /root/.vagrant.d/gems/gems/fog-core-1.43.0/lib/fog/core/collection.rb:19:in `each'
    from /root/.vagrant.d/gems/gems/fog-libvirt-0.3.0/lib/fog/libvirt/models/compute/server.rb:270:in `addresses'
    from /root/.vagrant.d/gems/gems/vagrant-libvirt-0.0.36/lib/vagrant-libvirt/action/wait_till_up.rb:44:in `block (3 levels) in call'
...

vagrant-libvirt calls def addresses in a while loop, waiting for a VM to boot and retrying until an IP is returned (with an eventual timeout). Since PR #11 this fails due to a functional change.

I believe this case should be handled correctly and return nil for def addresses(service_arg=service, options={}) as it was before so that this doesn't break existing functionality. Or is the failure here intentional?

@plribeiro3000
Copy link
Member

I believe this was not intentional. Perhaps we can fix this together with #27?

@mrvovanness
Copy link

mrvovanness commented Oct 29, 2016

I encountered the same issue, using debian 8.6 host with libvirt 1.2.9, vagrant 1.8.6 and vagrant-libvirt-0.0.36 . As a temporal workaround I edited the source code, but I don't sure if this appropriate:

        def dhcp_leases(uuid, mac, flags = 0)
          client.lookup_network_by_uuid(uuid).dhcp_leases(mac, flags)
        rescue => e
          if e.message =~ /no lease with matching MAC address/
            return []
          end
          raise e.class, e.message
        end

@alexggolovin
Copy link

Same issue on Debian 8.8 with vagrant-libvirt (0.0.40) installed from vagrant-libvirt repository due to this workaround vagrant-libvirt/vagrant-libvirt#770 has been fixed with workaround provided by mrvovanness

@alexggolovin
Copy link

Supposed to be fixed in new Debian versions due to this reports:
https://www.redhat.com/archives/libvir-list/2015-January/msg00055.html
And this commit:
libvirt/libvirt@18ec863

TjWallas added a commit to TjWallas/fog-libvirt that referenced this issue Jul 25, 2017
@github-actions
Copy link

github-actions bot commented Jun 4, 2021

This issue has been marked inactive and will be closed if no further activity occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants