[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [libvirt] PATCH: Add --tree flag to virsh nodedev-list
- From: Daniel Veillard <veillard redhat com>
- To: "Daniel P. Berrange" <berrange redhat com>
- Cc: libvir-list redhat com
- Subject: Re: [libvirt] PATCH: Add --tree flag to virsh nodedev-list
- Date: Tue, 31 Mar 2009 12:09:21 +0200
On Mon, Mar 30, 2009 at 02:44:31PM +0100, Daniel P. Berrange wrote:
>
> The virsh noddev-list command is used to display node devices. It just
> prints out their names in a flat list. When detaching devices for purposes
> of PCI passthrough though, it is important to understand what devices are
> children of the PCI device about to be detached. It is tedious to find
> this out, the user having to run virsh nodedev-dumpxml and look at the
> parent field.
[...]
> This patch adds a new '--tree' flag to the nodedev-list command, allowing
> a prettier format to be used
>
> # virsh -c qemu:///system nodedev-list --tree
> computer
> |
> +-pci_8086_2448
> | |
> | +-pci_104c_ac56
Very cool !
> +#define MAX_INDENT 100
> +
> +static void
> +cmdNodeListDevicesPrint(vshControl *ctl,
> + char **devices,
> + char **parents,
> + int num_devices,
> + int devid,
> + int lastdev,
> + unsigned int depth,
> + char *indent)
> +{
> + int i;
> + int nextlastdev = -1;
Before even modifying indent[depth] here I would check that
depth + 2 < MAX_INDENT and abort on an error here,
> + if (depth) {
> + indent[depth] = '+';
> + indent[depth+1] = '-';
> + }
otherwise looks fine, ACK :-)
thanks !
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel veillard com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]