On Tue, Nov 23, 2010 at 5:07 PM, Adam Stokes <ajs(a)redhat.com> wrote:
On Tue, 23 Nov 2010 14:47:12 +0100
Andrew Beekhof <andrew(a)beekhof.net> wrote:
> On Mon, Nov 22, 2010 at 3:48 PM, Adam Stokes <ajs(a)redhat.com> wrote:
> > On Mon, 22 Nov 2010 08:39:14 -0500
> > Perry Myers <pmyers(a)redhat.com> wrote:
> >
> >> On 11/21/2010 12:46 PM, Andrew Beekhof wrote:
> >> > On 11/18/2010 08:47 PM, Adam Stokes wrote:
> >> >> Some testing output from sigar.
> >> >>
> >> >> java -jar sigar-bin/lib/sigar.jar
> >> >> Loaded rc file: ./.sigar_shellrc
> >> >
> >> > I actually meant how usable is the C interface (since thats what
> >> > we'd be using). Any comments on that?
> >
> > interface is easy to use and so far provides what we want
>
> Excellent, lets get the network agent using it asap.
> We'll figure out the build issues in the next week or two.
just a quick code snippet showing how sigar is being used to iterate network devices
case _qmf::Network::METHOD_LIST:
{
_qmf::ArgsNetworkList& ioArgs = (_qmf::ArgsNetworkList&)
arguments;
sigar_t* sigar;
sigar_net_interface_list_t iflist;
sigar_net_interface_config_t ifconfig;
uint32_t lpc = 0;
int status;
sigar_open(&sigar);
Possibly we could cache this like we did for netcf.
But generally the it looks pretty reasonable to use. Agree?
status = sigar_net_interface_list_get(sigar,
&iflist);
if(status == SIGAR_OK) {
for(lpc = 0; lpc < iflist.number; lpc++) {
status = sigar_net_interface_config_get(sigar, iflist.data[lpc],
&ifconfig);
if(status == SIGAR_OK)
ioArgs.o_iface_map.push_back(ifconfig.name);
}
}
sigar_net_interface_list_destroy(sigar, &iflist);
}
return Manageable::STATUS_OK;
---
question: How are we going to handle the describe method? Still with XML or just respond
with a hash of any data we can pull from the interface?
I only added describe because there was a netcf API entry point for it.
The schema will need a rethink now that we're no longer using it -
specifically we'll definitely need to add a method for getting an
interface's IP.