3

Using:

$ virsh version
 Compiled against library: libvirt 1.3.1
 Using library: libvirt 1.3.1
 Using API: QEMU 1.3.1
 Running hypervisor: QEMU 2.5.0
$
$
$ lsb_release -a
 No LSB modules are available.
 Distributor ID:    Ubuntu
 Description:   Ubuntu 16.04.2 LTS
 Release:   16.04
 Codename:  xenial

I'd like to remove a libvirt's dhcp lease entry using virsh.

$ virsh net-list
Name                 State      Autostart     Persistent
----------------------------------------------------------
default              active     yes           yes
docker-machines      active     yes           yes

$ virsh net-dhcp-leases docker-machines
Expiry Time          MAC address        Protocol  IP address               Hostname        Client ID or DUID
-------------------------------------------------------------------------------------------------------------------
2017-05-10 16:15:38  52:54:00:8e:15:f5  ipv4      192.168.42.22/24         minikubecluster ff:c2:72:f6:09:00:02:00:00:ab:11:af:a8:d1:af:21:23:5c:49
2017-05-10 16:09:57  52:54:00:c6:51:45  ipv4      192.168.42.23/24         registry        01:52:54:00:c6:51:45

I've tried different option using virsh net-update delete, but I keep getting this errors:

couldn't locate a matching dhcp host entry in network 'docker-machines'

Is this because libvirt's lease files are changed (they are named after the network interface and the format is JSON)? If so, how can I then do this then?

1

The delete sub-command works the same way as the add sub-command.

virsh net-update docker-machines delete ip-dhcp-host \
"<host mac='52:54:00:8e:15:f5' \
name='minikubecluster' ip='192.168.42.22' />" \
--live --config

Libvirt - Networking - virsh net-update

  • I'm getting the same error. – Amir Keibi Jun 29 '17 at 22:20
  • Is it listed in the XML configuration file? sudo virsh net-edit docker-machines – cstarcher Jul 1 '17 at 0:26
  • No, it isn't listed. – Amir Keibi Jul 5 '17 at 20:41
  • That's why you're getting that message then. There is no entry in your configuration file. There's no reason to remove it. – cstarcher Jul 6 '17 at 22:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.