4

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?

Amir Keibi
  • 141
  • 1
  • 4

1 Answers1

2

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

cstarcher
  • 129
  • 4