[libvirt] [PATCHv5 4/4] net-dhcp-leases: Add virsh support

Daniel P. Berrange berrange at redhat.com
Mon Dec 16 13:41:14 UTC 2013


On Mon, Dec 16, 2013 at 07:00:25PM +0530, Nehal J Wani wrote:
> On 12/12/13, Daniel P. Berrange <berrange at redhat.com> wrote:
> > On Tue, Nov 26, 2013 at 02:36:01AM +0530, Nehal J Wani wrote:
> >> Use virNetworkGetDHCPLeases and virNetworkGetDHCPLeasesForMAC in virsh.
> >>
> >> The new feature supports the follwing methods:
> >>
> >> 1. Retrieve leases info for a given virtual network
> >>
> >> 2. Retrieve leases info for given network interface
> >>
> >> tools/virsh-domain-monitor.c
> >>    * Introduce new command : net-dhcp-leases
> >>      Example Usage: net-dhcp-leases <network> [mac]
> >>
> >>      virsh # net-dhcp-leases --network default6
> >>      Expiry Time          MAC address       Protocol   IP address
> >>       Hostname        Client ID or DUID
> >>
> >> -------------------------------------------------------------------------------------------------------------------
> >>      2013-11-24 03:59:40  52:54:00:2f:ba:76 ipv4       192.168.150.153/24
> >>       (null)          (null)
> >>      2013-11-24 03:59:41  52:54:00:2f:ba:76 ipv6
> >> 2001:db8:ca2:2:1::6c/24   (null)
> >> 00:04:76:00:cf:ae:b3:0b:fc:cd:0e:22:2e:97:76:65:74:ec
> >>      2013-11-24 04:04:01  52:54:00:3b:16:e0 ipv4       192.168.150.207/24
> >>       (null)          (null)
> >>      2013-11-24 04:02:44  52:54:00:44:7c:d7 ipv4       192.168.150.219/24
> >>       iiit-ad885e4aa1 01:52:54:00:44:7c:d7
> >>      2013-11-24 04:02:44  52:54:00:44:7c:d7 ipv4       192.168.150.219/24
> >>       (null)          01:52:54:00:44:7c:d7
> >>      2013-11-24 04:03:36  52:54:00:5d:99:92 ipv4       192.168.150.212/24
> >>       iiit-ad885e4aa1 01:52:54:00:5d:99:92
> >>      2013-11-24 04:04:41  52:54:00:db:dd:98 ipv4       192.168.150.234/24
> >>       (null)          (null)
> >>      2013-11-24 04:04:48  52:54:00:db:dd:98 ipv6
> >> 2001:db8:ca2:2:1::6d/24   (null)
> >> 00:04:76:00:cf:ae:b3:0b:fc:cd:0e:22:2e:97:76:65:74:ec
> >
> > I wonder if we should use  '-' instead of '(null)' here - I think it is
> > probably a bit more user friendly.
> >
> 
> dnsmasq uses '*' in case of null strings. Its a matter of choice.
> Since this user-friendly option should be available for all APIs,
> should I add:
> /*
>  * Use this instead of NULLSTR to make it more user-friendly.
>  */
> # define EMPTYSTR(s) ((s) ? (s) : "*")
> in src/internal.h ?

No, what dnsmasq uses is irrelevant here. I'm looking at virsh where other
commands will use '-' for data that isn't present. eg the ID field

$ virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     demo                           shut off
 -     ppcdemo                        shut off
 -     serial                         shut off



Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list