On Thu, Nov 05, 2009 at 09:40:54AM -0500, Hugh O. Brock wrote:
On Thu, Nov 05, 2009 at 09:25:41AM -0500, Cole Robinson wrote:
> On 11/04/2009 07:35 PM, David Lutterkort wrote:
> >> At the end of the day, I'm looking for the best way to avoid future
> >> virt-manager bug reports like:
> >>
> >> - Help! I bridged eth1 in virt-manager, restarted the app, then deleted
> >> the bridge and eth1 is no longer in my list of interfaces!
> >
> > I think it all boils down to who should do device discovery. As I
> > understand it, what you want is for virt-manager to have a way to list
> > all physical interfaces on a machine, figure out which ones are not used
> > by any bridge/bond etc. and offer those for addition into a new bridge.
> >
> > For the first bit, libvirt provides the virNodeDevice* calls;
>
> Yeah, I didn't think of that. It should be sufficient.
>
> for
> > figuring out which devices are free, we'd need to add something to
> > netcf, e.g. new error codes to indicate 'interface has no
configuration'
> > and 'interface is slave of another interface' when calling
> > ncf_lookup_by_name.
>
> Not sure if I follow. If an interface has no configuration it won't show
> up in ncf_list_interfaces, and an enslaved interface will be referenced
> in some bridge/bond/foo xml, so all that information is already
> available. I think using the nodedev APIs to enumerate physical
> interfaces should be sufficient for virt-manager.
I still think netcf should refuse to repurpose a device to already
exist. In Cole's case, if someone tries to enslave wlan0 to a bridge
and it already exists with an IP address and so on, surely we should
say "You have to undefine wlan0 first" and exit? It seems to me
anything else violates the principle of least surprise...
And it better protects people against accidental mistakes if you give an
explicit error if the device is already configured.
Daniel
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://ovirt.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|