
On 02/10/2010 07:23 PM, Ed Swierk wrote:
On Wed, Feb 10, 2010 at 1:02 AM, Daniel P. Berrange<berrange@redhat.com> wrote:
Mostly what Alex already said :-)
The libvirt APIs are split into several functional areas
- virDomain - guest management - virInterface - host network interface configuration - virStorage - storage manangement - virNetwork - virtual networking
The goal is that an app should be able to accomplish all its virtualization management tasks without needing any other remote access to the host via SSH or other systems. Many of the APIs for those areas I mention above require knowledge of what physical devices are present on the machine. For example, assigning a PCI or USB device to a guests requires that you know what PCI / USB devices the host has. Setting up a storage pool requires knowing what disks are available. Configuring network interfaces requires knowing what NICs are available, etc. So 'virNodeDev' APIs provide the missing link that lets you discover the information about a host that you need in order to use the other APIs.
Thanks, Daniel and Alex, that helps a lot.
I'm still not clear about the purpose of the node device XML format, and the nodedev-create virsh command. What does it mean to "create a device" on a node, if the node device info is gathered via udev or hal from the actual hardware? Is this to fill in gaps in udev's or hal's knowledge of the hardware?
(In addition to sheer curiosity, I'm thinking about whether the node device API could be used to solve a specific issue with the current macvtap implementation, namely handling the dynamic addition and removal of the underlying network device. I want to try to understand the libvirt-y way of doing things before I go and propose something completely stupid...)
The node device create and destroy operations really do create and destroy virtual "hardware", which should then be discovered through udev and become visible to libvirt like all other hardware. It's the equivalent of someone walking up to a box and hotplugging a new physical device. If the operation you're trying to implement ends with something that looks like new hardware appearing in the host OS, it's likely to be a good fit for the node device create/destroy API. I don't know a whole lot about the macvtap or macvlan stuff, but from what little I do know it looks like the kind of thing that the API was designed to handle. As Cole has pointed out the only current use for it is creating and destroying virtual HBAs using NPIV, however, it is intended to be generic enough to handle all kinds of virtual devices. Dave