<dd>The interface name tied to this device.</dd>
<dt><code>address</code></dt>
<dd>If present, the MAC address of the device.</dd>
+ <dt><code>link</code></dt>
+ <dd>Optional to reflect the status of the link. It has
+ two optional attributes: <code>speed</code> in Mbits per
+ second and <code>state</code> to tell the state of the
+ link. So far, the whole element is just for output,
+ not setting.
+ </dd>
<dt><code>capability</code></dt>
<dd>A network protocol exposed by the device, where the
attribute <code>type</code> can be "80203" for IEEE
<ref name='mac'/>
</element>
</optional>
+ <ref name="link-speed-state"/>
<zeroOrMore>
<ref name='subcapnet'/>
libvirt_driver_nodedev_la_CFLAGS = \
-I$(top_srcdir)/src/access \
-I$(top_srcdir)/src/conf \
- $(AM_CFLAGS)
+ $(AM_CFLAGS) $(LIBNL_CFLAGS)
libvirt_driver_nodedev_la_LDFLAGS = $(AM_LDFLAGS)
libvirt_driver_nodedev_la_LIBADD =
if (data->net.address)
virBufferEscapeString(&buf, "<address>%s</address>\n",
data->net.address);
+ virInterfaceLinkFormat(&buf, &data->net.lnk);
if (data->net.subtype != VIR_NODE_DEV_CAP_NET_LAST) {
const char *subtyp =
virNodeDevNetCapTypeToString(data->net.subtype);
xmlNodePtr node,
union _virNodeDevCapData *data)
{
- xmlNodePtr orignode;
+ xmlNodePtr orignode, lnk;
int ret = -1;
char *tmp;
data->net.subtype = val;
}
+ lnk = virXPathNode("./link", ctxt);
+ if (lnk && virInterfaceLinkParseXML(lnk, &data->net.lnk) < 0)
+ goto out;
+
ret = 0;
out:
ctxt->node = orignode;
# include "virutil.h"
# include "virthread.h"
# include "virpci.h"
+# include "device_conf.h"
# include <libxml/tree.h>
char *address;
unsigned int address_len;
char *ifname;
+ virInterfaceLink lnk;
virNodeDevNetCapType subtype; /* LAST -> no subtype */
} net;
struct {
#include "node_device_driver.h"
#include "virutil.h"
#include "viraccessapicheck.h"
+#include "virnetdev.h"
#define VIR_FROM_THIS VIR_FROM_NODEDEV
virNodeDevCapsDefPtr cap = dev->def->caps;
while (cap) {
- /* The only caps that currently need updating are FC related. */
if (cap->type == VIR_NODE_DEV_CAP_SCSI_HOST) {
detect_scsi_host_caps(&dev->def->caps->data);
}
+ if (cap->type == VIR_NODE_DEV_CAP_NET &&
+ virNetDevGetLinkInfo(cap->data.net.ifname, &cap->data.net.lnk) < 0)
+ return -1;
+
cap = cap->next;
}
goto cleanup;
update_driver_name(obj);
- update_caps(obj);
+ if (update_caps(obj) < 0)
+ goto cleanup;
ret = virNodeDeviceDefFormat(obj->def);
#include "virfile.h"
#include "virpci.h"
#include "virstring.h"
+#include "virnetdev.h"
#define VIR_FROM_THIS VIR_FROM_NODEDEV
goto out;
}
+ if (virNetDevGetLinkInfo(data->net.ifname, &data->net.lnk) < 0)
+ goto out;
+
ret = 0;
out: