[libvirt] [PATCH 1/1] python: add python binding for Perf API
by Qiaowei Ren
This patch adds the python binding for virDomainSetPerfEvents and
virDomainSetPerfEvents API.
Signed-off-by: Qiaowei Ren <qiaowei.ren(a)intel.com>
---
generator.py | 2 ++
libvirt-override-api.xml | 11 ++++++
libvirt-override.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 106 insertions(+)
diff --git a/generator.py b/generator.py
index d9ae17e..fb6a493 100755
--- a/generator.py
+++ b/generator.py
@@ -433,6 +433,8 @@ skip_impl = (
'virDomainGetMemoryParameters',
'virDomainSetNumaParameters',
'virDomainGetNumaParameters',
+ 'virDomainSetPerfEvents',
+ 'virDomainGetPerfEvents',
'virDomainGetVcpus',
'virDomainPinVcpu',
'virDomainPinVcpuFlags',
diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml
index 1a0e314..54b45f7 100644
--- a/libvirt-override-api.xml
+++ b/libvirt-override-api.xml
@@ -344,6 +344,17 @@
<arg name='domain' type='virDomainPtr' info='pointer to domain object'/>
<arg name='flags' type='int' info='an OR'ed set of virDomainModificationImpact'/>
</function>
+ <function name='virDomainSetPerfEvents' file='python'>
+ <info>Enable or disable the particular list of perf events</info>
+ <return type='int' info='-1 in case of error, 0 in case of success.'/>
+ <arg name='domain' type='virDomainPtr' info='pointer to domain object'/>
+ <arg name='params' type='virTypedParameterPtr' info='pointer to perf events parameter object'/>
+ </function>
+ <function name='virDomainGetPerfEvents' file='python'>
+ <info>Get all perf events setting.</info>
+ <return type='char *' info='returns a dictionary of params in case of success, None in case of error'/>
+ <arg name='domain' type='virDomainPtr' info='pointer to domain object'/>
+ </function>
<function name='virDomainSetInterfaceParameters' file='python'>
<info>Change the bandwidth tunables for a interface device</info>
<arg name='dom' type='virDomainPtr' info='pointer to the domain'/>
diff --git a/libvirt-override.c b/libvirt-override.c
index ce36280..11ef15e 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -1059,6 +1059,97 @@ libvirt_virDomainGetNumaParameters(PyObject *self ATTRIBUTE_UNUSED,
}
static PyObject *
+libvirt_virDomainSetPerfEvents(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ virDomainPtr domain;
+ PyObject *pyobj_domain, *info;
+ PyObject *ret = NULL;
+ int i_retval;
+ int nparams = 0;
+ Py_ssize_t size = 0;
+ virTypedParameterPtr params = NULL, new_params = NULL;
+
+ if (!PyArg_ParseTuple(args,
+ (char *)"OO:virDomainSetNumaParameters",
+ &pyobj_domain, &info))
+ return NULL;
+ domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
+
+ if ((size = PyDict_Size(info)) < 0)
+ return NULL;
+
+ if (size == 0) {
+ PyErr_Format(PyExc_LookupError,
+ "Need non-empty dictionary to set attributes");
+ return NULL;
+ }
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ i_retval = virDomainGetPerfEvents(domain, ¶ms, &nparams);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (i_retval < 0)
+ return VIR_PY_INT_FAIL;
+
+ if (nparams == 0) {
+ PyErr_Format(PyExc_LookupError,
+ "Domain has no settable attributes");
+ return NULL;
+ }
+
+ new_params = setPyVirTypedParameter(info, params, nparams);
+ if (!new_params)
+ goto cleanup;
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ i_retval = virDomainSetPerfEvents(domain, new_params, size);
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (i_retval < 0) {
+ ret = VIR_PY_INT_FAIL;
+ goto cleanup;
+ }
+
+ ret = VIR_PY_INT_SUCCESS;
+
+ cleanup:
+ virTypedParamsFree(params, nparams);
+ virTypedParamsFree(new_params, size);
+ return ret;
+}
+
+static PyObject *
+libvirt_virDomainGetPerfEvents(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ PyObject *pyobj_domain;
+ virDomainPtr domain;
+ virTypedParameterPtr params = NULL;
+ int nparams = 0;
+ PyObject *dict = NULL;
+ int rc;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:virDomainGetPerfEvents",
+ &pyobj_domain))
+ return NULL;
+ domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+ rc = virDomainGetPerfEvents(domain, ¶ms, &nparams);
+ LIBVIRT_END_ALLOW_THREADS;
+ if (rc < 0)
+ return VIR_PY_NONE;
+
+ if (!(dict = getPyVirTypedParameter(params, nparams)))
+ goto cleanup;
+
+ cleanup:
+ virTypedParamsFree(params, nparams);
+ return dict;
+}
+
+static PyObject *
libvirt_virDomainSetInterfaceParameters(PyObject *self ATTRIBUTE_UNUSED,
PyObject *args)
{
@@ -8686,6 +8777,8 @@ static PyMethodDef libvirtMethods[] = {
{(char *) "virDomainGetMemoryParameters", libvirt_virDomainGetMemoryParameters, METH_VARARGS, NULL},
{(char *) "virDomainSetNumaParameters", libvirt_virDomainSetNumaParameters, METH_VARARGS, NULL},
{(char *) "virDomainGetNumaParameters", libvirt_virDomainGetNumaParameters, METH_VARARGS, NULL},
+ {(char *) "virDomainSetPerfEvents", libvirt_virDomainSetPerfEvents, METH_VARARGS, NULL},
+ {(char *) "virDomainGetPerfEvents", libvirt_virDomainGetPerfEvents, METH_VARARGS, NULL},
{(char *) "virDomainSetInterfaceParameters", libvirt_virDomainSetInterfaceParameters, METH_VARARGS, NULL},
{(char *) "virDomainGetInterfaceParameters", libvirt_virDomainGetInterfaceParameters, METH_VARARGS, NULL},
{(char *) "virDomainGetVcpus", libvirt_virDomainGetVcpus, METH_VARARGS, NULL},
--
1.9.1
8 years, 8 months
[libvirt] [PATCH] allow ip and route elements for netdev ethernet
by Vasiliy Tolstov
This is next part of network type ethernet patches, that adds ability to assign
ip address and routes to tap devices for qemu driver like done before for lxc.
Vasiliy Tolstov (1):
allow ip and route elements for netdev ethernet
docs/formatdomain.html.in | 12 ++++++++-
docs/schemas/network.rng | 3 +++
include/libvirt/libvirt-domain.h | 1 +
src/conf/domain_conf.c | 14 ++++++++++-
src/conf/domain_conf.h | 1 +
src/conf/network_conf.c | 26 ++++++++++++++++++-
src/conf/network_conf.h | 1 +
src/lxc/lxc_container.c | 2 +-
src/network/bridge_driver.c | 2 +-
src/qemu/qemu_interface.c | 39 +++++++++++++++++++++++++++++
src/util/virnetdev.c | 54 ++++++++++++++++++++++++++++------------
src/util/virnetdev.h | 1 +
12 files changed, 135 insertions(+), 21 deletions(-)
--
2.7.3
8 years, 8 months
[libvirt] netdev ethernet allow to specify ip address and routes
by Vasiliy Tolstov
Allow to use ip address and routes elements inside netowrk
type='ethernet'.
Also add ability to create point to point device addresses.
Signed-off-by: Vasiliy Tolstov <v.tolstov(a)selfip.ru>
---
docs/schemas/interface.rng | 6 +++++
include/libvirt/libvirt-domain.h | 1 +
src/conf/domain_conf.c | 14 ++++++++++-
src/conf/domain_conf.h | 1 +
src/conf/network_conf.c | 26 ++++++++++++++++++-
src/conf/network_conf.h | 1 +
src/lxc/lxc_container.c | 2 +-
src/network/bridge_driver.c | 2 +-
src/qemu/qemu_interface.c | 39 +++++++++++++++++++++++++++++
src/util/virnetdev.c | 54 ++++++++++++++++++++++++++++------------
src/util/virnetdev.h | 1 +
11 files changed, 127 insertions(+), 20 deletions(-)
diff --git a/docs/schemas/interface.rng b/docs/schemas/interface.rng
index 052703ce84aa..b81c38b9d07c 100644
--- a/docs/schemas/interface.rng
+++ b/docs/schemas/interface.rng
@@ -332,6 +332,9 @@
<optional>
<attribute name="prefix"><ref name="ipv4Prefix"/></attribute>
</optional>
+ <optional>
+ <attribute name="peer"><ref name="ipv4Addr"/></attribute>
+ </optional>
</element>
</zeroOrMore>
<optional>
@@ -361,6 +364,9 @@
<optional>
<attribute name="prefix"><ref name="ipv6Prefix"/></attribute>
</optional>
+ <optional>
+ <attribute name="peer"><ref name="ipv6Addr"/></attribute>
+ </optional>
</element>
</zeroOrMore>
<optional>
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 7e06796c3c73..437e87fac01c 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -3937,6 +3937,7 @@ typedef virDomainIPAddress *virDomainIPAddressPtr;
struct _virDomainInterfaceIPAddress {
int type; /* virIPAddrType */
char *addr; /* IP address */
+ char *peer; /* IP peer */
unsigned int prefix; /* IP address prefix */
};
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d5d9ff702f42..34855233ad15 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5725,7 +5725,7 @@ virDomainNetIpParseXML(xmlNodePtr node)
unsigned int prefixValue = 0;
char *familyStr = NULL;
int family = AF_UNSPEC;
- char *address = NULL;
+ char *address = NULL, *peer = NULL;
if (!(prefixStr = virXMLPropString(node, "prefix")) ||
(virStrToLong_ui(prefixStr, NULL, 10, &prefixValue) < 0)) {
@@ -5739,6 +5739,9 @@ virDomainNetIpParseXML(xmlNodePtr node)
goto cleanup;
}
+ if ((peer = virXMLPropString(node, "peer")) == NULL)
+ VIR_DEBUG("Peer is empty");
+
familyStr = virXMLPropString(node, "family");
if (familyStr && STREQ(familyStr, "ipv4"))
family = AF_INET;
@@ -5756,6 +5759,14 @@ virDomainNetIpParseXML(xmlNodePtr node)
address);
goto cleanup;
}
+
+ if ((peer != NULL) && (virSocketAddrParse(&ip->peer, peer, family) < 0)) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("Failed to parse IP address: '%s'"),
+ peer);
+ goto cleanup;
+ }
+
ip->prefix = prefixValue;
ret = ip;
@@ -5765,6 +5776,7 @@ virDomainNetIpParseXML(xmlNodePtr node)
VIR_FREE(prefixStr);
VIR_FREE(familyStr);
VIR_FREE(address);
+ VIR_FREE(peer);
VIR_FREE(ip);
return ret;
}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 83bdd67dec45..040882ec8460 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -513,6 +513,7 @@ typedef struct _virDomainNetIpDef virDomainNetIpDef;
typedef virDomainNetIpDef *virDomainNetIpDefPtr;
struct _virDomainNetIpDef {
virSocketAddr address; /* ipv4 or ipv6 address */
+ virSocketAddr peer; /* ipv4 or ipv6 address of peer */
unsigned int prefix; /* number of 1 bits in the net mask */
};
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 4fb2e2a75b9d..1a0cf7fdcdd2 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -1456,7 +1456,7 @@ virNetworkIPDefParseXML(const char *networkName,
*/
xmlNodePtr cur, save;
- char *address = NULL, *netmask = NULL;
+ char *address = NULL, *netmask = NULL, *peer = NULL;
unsigned long prefix = 0;
int prefixRc;
int result = -1;
@@ -1502,6 +1502,14 @@ virNetworkIPDefParseXML(const char *networkName,
else
def->prefix = prefix;
+ peer = virXPathString("string(./@peer)", ctxt);
+ if (peer && (virSocketAddrParse(&def->peer, peer, AF_UNSPEC) < 0)) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Invalid peer '%s' in network '%s'"),
+ peer, networkName);
+ goto cleanup;
+ }
+
/* validate address, etc. for each family */
if ((def->family == NULL) || (STREQ(def->family, "ipv4"))) {
if (!(VIR_SOCKET_ADDR_IS_FAMILY(&def->address, AF_INET) ||
@@ -1531,6 +1539,14 @@ virNetworkIPDefParseXML(const char *networkName,
prefix, networkName);
goto cleanup;
}
+ if (peer) {
+ if (!VIR_SOCKET_ADDR_IS_FAMILY(&def->peer, AF_INET)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Family 'ipv4' specified for non-IPv4 address '%s' in network '%s'"),
+ peer, networkName);
+ goto cleanup;
+ }
+ }
} else if (STREQ(def->family, "ipv6")) {
if (!VIR_SOCKET_ADDR_IS_FAMILY(&def->address, AF_INET6)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -1550,6 +1566,14 @@ virNetworkIPDefParseXML(const char *networkName,
prefix, networkName);
goto cleanup;
}
+ if (peer) {
+ if (!VIR_SOCKET_ADDR_IS_FAMILY(&def->peer, AF_INET6)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Family 'ipv6' specified for non-IPv6 address '%s' in network '%s'"),
+ peer, networkName);
+ goto cleanup;
+ }
+ }
} else {
virReportError(VIR_ERR_XML_ERROR,
_("Unrecognized family '%s' in network '%s'"),
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index b72257b970a8..9b8e807fda3c 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -152,6 +152,7 @@ struct _virNetworkIpDef {
*/
unsigned int prefix; /* ipv6 - only prefix allowed */
virSocketAddr netmask; /* ipv4 - either netmask or prefix specified */
+ virSocketAddr peer; /* ipv4 or ipv6 peer address */
size_t nranges; /* Zero or more dhcp ranges */
virSocketAddrRangePtr ranges;
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 348bbfbc01fc..a1deb0c00d4c 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -520,7 +520,7 @@ static int lxcContainerRenameAndEnableInterfaces(virDomainDefPtr vmDef,
VIR_DEBUG("Adding IP address '%s/%u' to '%s'",
ipStr, ip->prefix, newname);
- if (virNetDevSetIPAddress(newname, &ip->address, prefix) < 0) {
+ if (virNetDevSetIPAddress(newname, &ip->address, &ip->peer, prefix) < 0) {
virReportError(VIR_ERR_SYSTEM_ERROR,
_("Failed to set IP address '%s' on %s"),
ipStr, newname);
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index a09a7e474fc5..f3ff88ff55a6 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -1970,7 +1970,7 @@ networkAddAddrToBridge(virNetworkObjPtr network,
}
if (virNetDevSetIPAddress(network->def->bridge,
- &ipdef->address, prefix) < 0)
+ &ipdef->address, &ipdef->peer, prefix) < 0)
return -1;
return 0;
diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c
index 13a513152876..5729325fadb9 100644
--- a/src/qemu/qemu_interface.c
+++ b/src/qemu/qemu_interface.c
@@ -474,6 +474,45 @@ qemuInterfaceEthernetConnect(virDomainDefPtr def,
if (virNetDevSetMAC(net->ifname, &tapmac) < 0)
goto cleanup;
+ for (j = 0; j < net->nips; j++) {
+ virDomainNetIpDefPtr ip = net->ips[j];
+ unsigned int prefix = (ip->prefix > 0) ? ip->prefix :
+ VIR_SOCKET_ADDR_DEFAULT_PREFIX;
+ char *ipStr = virSocketAddrFormat(&ip->address);
+
+ VIR_DEBUG("Adding IP address '%s/%u' to '%s'",
+ ipStr, ip->prefix, net->ifname);
+
+ if (virNetDevSetIPAddress(net->ifname, &ip->address, &ip->peer, prefix) < 0) {
+ virReportError(VIR_ERR_SYSTEM_ERROR,
+ _("Failed to set IP address '%s' on %s"),
+ ipStr, net->ifname);
+ VIR_FREE(ipStr);
+ goto cleanup;
+ }
+ VIR_FREE(ipStr);
+ }
+
+ if (net->linkstate == VIR_DOMAIN_NET_INTERFACE_LINK_STATE_UP ||
+ net->linkstate == VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT) {
+ if (virNetDevSetOnline(net->ifname, true) < 0)
+ goto cleanup;
+
+ /* Set the routes */
+ for (j = 0; j < net->nroutes; j++) {
+ virNetworkRouteDefPtr route = net->routes[j];
+
+ if (virNetDevAddRoute(net->ifname,
+ virNetworkRouteDefGetAddress(route),
+ virNetworkRouteDefGetPrefix(route),
+ virNetworkRouteDefGetGateway(route),
+ virNetworkRouteDefGetMetric(route)) < 0) {
+ goto cleanup;
+ }
+ }
+ }
+
+
if (net->script &&
qemuExecuteEthernetScript(net->ifname, net->script) < 0)
goto cleanup;
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index aed50f546263..6e32ebbf6cee 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -1039,21 +1039,28 @@ virNetDevCreateNetlinkAddressMessage(int messageType,
const char *ifname,
virSocketAddr *addr,
unsigned int prefix,
- virSocketAddr *broadcast)
+ virSocketAddr *broadcast,
+ virSocketAddr *peer)
{
struct nl_msg *nlmsg = NULL;
struct ifaddrmsg ifa;
unsigned int ifindex;
void *addrData = NULL;
+ void *peerData = NULL;
void *broadcastData = NULL;
size_t addrDataLen;
if (virNetDevGetIPAddressBinary(addr, &addrData, &addrDataLen) < 0)
return NULL;
- if (broadcast && virNetDevGetIPAddressBinary(broadcast, &broadcastData,
- &addrDataLen) < 0)
- return NULL;
+ if (peer && VIR_SOCKET_ADDR_VALID(peer)) {
+ if (virNetDevGetIPAddressBinary(peer, &peerData, &addrDataLen) < 0)
+ return NULL;
+ } else if (broadcast) {
+ if (virNetDevGetIPAddressBinary(broadcast, &broadcastData,
+ &addrDataLen) < 0)
+ return NULL;
+ }
/* Get the interface index */
if ((ifindex = if_nametoindex(ifname)) == 0)
@@ -1078,12 +1085,15 @@ virNetDevCreateNetlinkAddressMessage(int messageType,
if (nla_put(nlmsg, IFA_LOCAL, addrDataLen, addrData) < 0)
goto buffer_too_small;
- if (nla_put(nlmsg, IFA_ADDRESS, addrDataLen, addrData) < 0)
- goto buffer_too_small;
+ if (peerData) {
+ if (nla_put(nlmsg, IFA_ADDRESS, addrDataLen, peerData) < 0)
+ goto buffer_too_small;
+ }
- if (broadcastData &&
- nla_put(nlmsg, IFA_BROADCAST, addrDataLen, broadcastData) < 0)
- goto buffer_too_small;
+ if (broadcastData) {
+ if (nla_put(nlmsg, IFA_BROADCAST, addrDataLen, broadcastData) < 0)
+ goto buffer_too_small;
+ }
return nlmsg;
@@ -1098,6 +1108,7 @@ virNetDevCreateNetlinkAddressMessage(int messageType,
* virNetDevSetIPAddress:
* @ifname: the interface name
* @addr: the IP address (IPv4 or IPv6)
+ * @peer: The IP address of peer (IPv4 or IPv6)
* @prefix: number of 1 bits in the netmask
*
* Add an IP address to an interface. This function *does not* remove
@@ -1108,6 +1119,7 @@ virNetDevCreateNetlinkAddressMessage(int messageType,
*/
int virNetDevSetIPAddress(const char *ifname,
virSocketAddr *addr,
+ virSocketAddr *peer,
unsigned int prefix)
{
virSocketAddr *broadcast = NULL;
@@ -1116,9 +1128,8 @@ int virNetDevSetIPAddress(const char *ifname,
struct nlmsghdr *resp = NULL;
unsigned int recvbuflen;
-
/* The caller needs to provide a correct address */
- if (VIR_SOCKET_ADDR_FAMILY(addr) == AF_INET) {
+ if (VIR_SOCKET_ADDR_FAMILY(addr) == AF_INET && !VIR_SOCKET_ADDR_VALID(peer)) {
/* compute a broadcast address if this is IPv4 */
if (VIR_ALLOC(broadcast) < 0)
return -1;
@@ -1129,7 +1140,7 @@ int virNetDevSetIPAddress(const char *ifname,
if (!(nlmsg = virNetDevCreateNetlinkAddressMessage(RTM_NEWADDR, ifname,
addr, prefix,
- broadcast)))
+ broadcast, peer)))
goto cleanup;
if (virNetlinkCommand(nlmsg, &resp, &recvbuflen, 0, 0,
@@ -1288,7 +1299,7 @@ int virNetDevClearIPAddress(const char *ifname,
if (!(nlmsg = virNetDevCreateNetlinkAddressMessage(RTM_DELADDR, ifname,
addr, prefix,
- NULL)))
+ NULL, NULL)))
goto cleanup;
if (virNetlinkCommand(nlmsg, &resp, &recvbuflen, 0, 0,
@@ -1423,21 +1434,27 @@ virNetDevWaitDadFinish(virSocketAddrPtr *addrs, size_t count)
int virNetDevSetIPAddress(const char *ifname,
virSocketAddr *addr,
+ virSocketAddr *peer,
unsigned int prefix)
{
virCommandPtr cmd = NULL;
- char *addrstr = NULL, *bcaststr = NULL;
+ char *addrstr = NULL, *bcaststr = NULL, *peerstr = NULL;
virSocketAddr broadcast;
int ret = -1;
if (!(addrstr = virSocketAddrFormat(addr)))
goto cleanup;
+
+ if (VIR_SOCKET_ADDR_VALID(peer) && !(peerstr = virSocketAddrFormat(&peer)))
+ goto cleanup;
+
/* format up a broadcast address if this is IPv4 */
- if ((VIR_SOCKET_ADDR_IS_FAMILY(addr, AF_INET)) &&
+ if (!peerstr && ((VIR_SOCKET_ADDR_IS_FAMILY(addr, AF_INET)) &&
((virSocketAddrBroadcastByPrefix(addr, prefix, &broadcast) < 0) ||
- !(bcaststr = virSocketAddrFormat(&broadcast)))) {
+ !(bcaststr = virSocketAddrFormat(&broadcast))))) {
goto cleanup;
}
+
# ifdef IFCONFIG_PATH
cmd = virCommandNew(IFCONFIG_PATH);
virCommandAddArg(cmd, ifname);
@@ -1446,6 +1463,8 @@ int virNetDevSetIPAddress(const char *ifname,
else
virCommandAddArg(cmd, "inet");
virCommandAddArgFormat(cmd, "%s/%u", addrstr, prefix);
+ if (peerstr)
+ virCommandAddArgList(cmd, "pointopoint", peerstr, NULL);
if (bcaststr)
virCommandAddArgList(cmd, "broadcast", bcaststr, NULL);
virCommandAddArg(cmd, "alias");
@@ -1453,6 +1472,8 @@ int virNetDevSetIPAddress(const char *ifname,
cmd = virCommandNew(IP_PATH);
virCommandAddArgList(cmd, "addr", "add", NULL);
virCommandAddArgFormat(cmd, "%s/%u", addrstr, prefix);
+ if (peerstr)
+ virCommandAddArgList(cmd, "peer", peerstr, NULL);
if (bcaststr)
virCommandAddArgList(cmd, "broadcast", bcaststr, NULL);
virCommandAddArgList(cmd, "dev", ifname, NULL);
@@ -1465,6 +1486,7 @@ int virNetDevSetIPAddress(const char *ifname,
cleanup:
VIR_FREE(addrstr);
VIR_FREE(bcaststr);
+ VIR_FREE(peerstr);
virCommandFree(cmd);
return ret;
}
diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h
index e7719d58a410..240fff774d30 100644
--- a/src/util/virnetdev.h
+++ b/src/util/virnetdev.h
@@ -90,6 +90,7 @@ int virNetDevGetOnline(const char *ifname,
int virNetDevSetIPAddress(const char *ifname,
virSocketAddr *addr,
+ virSocketAddr *peer,
unsigned int prefix)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
int virNetDevAddRoute(const char *ifname,
--
2.7.3
8 years, 8 months
[libvirt] Hello and a question about QEMU log
by zhukaijie
Hello,Each running VM has it's command line logged in /var/log/libvirt/qemu/${vmname}.And now I'd like to disable this log function, that is to say, not to recordthe QEMU command line of VM. Could you please tell me will can I configure it? Are there any configure info such as "log level" to coordinate this log function? In fact, once the qemu command line contains some sensitive info which I try to prevent others from see it, I can make the qemu command not to be logged.
8 years, 8 months
[libvirt] [For 1.3.3 0/2] small fixes for recent libxl commits
by Jim Fehlig
For 1.3.3: small fixes for recent libxl commits
Chunyan noted some problems in commits e6336442 and b5534e53
https://www.redhat.com/archives/libvir-list/2016-March/msg01431.html
These two patches fix those issues, essentially making e6336442 and
b5534e53 resemble the correct patches originally submitted by Chunyan.
See the individual patches for details.
With these fixes, Chunyan's patch to "support creating domain with VF
assignment from a pool" [0] works fine, save a bug or two in xen-unstable
libxl. The patch has been through several revisions and on the list for
quite some time. Would it be okay to commit it, along with these patches,
for 1.3.3?
[0] https://www.redhat.com/archives/libvir-list/2016-March/msg00930.html
Jim Fehlig (2):
libxl: fix attaching net device of type hostdev
libxl: fix net device detach
src/libxl/libxl_driver.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
--
2.6.1
8 years, 8 months
[libvirt] [PATCH 0/2] Couple of Coverity fixes
by Michal Privoznik
*** SOME BLURB HERE ***
Michal Privoznik (2):
virPerfReadEvent: Prefer saferead over read
qemuProcessVerifyGuestCPU: Avoid coverity false positive
src/qemu/qemu_process.c | 2 ++
src/util/virperf.c | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
--
2.7.3
8 years, 8 months
[libvirt] build: workaround broken SASL header (again)
by Fabiano Fidêncio
Compilation for xdg-app failed due to a buggy SASL headers present on
the used runtime (org.gnome.Sdk 3.18).
In file included from rpc/virnetsaslcontext.h:24:0,
from rpc/virnetsaslcontext.c:25:
/usr/include/sasl/sasl.h:230:38: error: unknown type name 'size_t'
typedef void *sasl_realloc_t(void *, size_t);
^
/usr/include/sasl/sasl.h:235:5: error: unknown type name 'sasl_realloc_t'
sasl_realloc_t *,
---
src/rpc/virnetsaslcontext.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/rpc/virnetsaslcontext.h b/src/rpc/virnetsaslcontext.h
index 54634d5..edc082f 100644
--- a/src/rpc/virnetsaslcontext.h
+++ b/src/rpc/virnetsaslcontext.h
@@ -21,9 +21,9 @@
#ifndef __VIR_NET_CLIENT_SASL_CONTEXT_H__
# define __VIR_NET_CLIENT_SASL_CONTEXT_H__
+# include "internal.h"
# include <sasl/sasl.h>
-# include "internal.h"
# include "virobject.h"
typedef struct _virNetSASLContext virNetSASLContext;
--
2.7.3
8 years, 8 months
[libvirt] [PATCH] spec: fix trigger already defined issue on systems without systemd
by Jean-Marc LIGER
There is a trigger already defined issue when you try to rebuild libvirt
>= 1.3.0 for el6 with copr and most probably koji.
Regards,
Jean-Marc
diff -uri a/libvirt.spec.in b/libvirt.spec.in
--- a/libvirt.spec.in 2016-03-01 04:21:48.000000000 +0100
+++ b/libvirt.spec.in 2016-03-11 14:57:43.347652313 +0100
@@ -1767,16 +1767,6 @@
fi
%endif
- %if %{with_systemd}
- %else
-%triggerpostun daemon -- libvirt-daemon < 1.2.1
-if [ "$1" -ge "1" ]; then
- /sbin/service virtlockd reload > /dev/null 2>&1 || :
- /sbin/service virtlogd reload > /dev/null 2>&1 || :
- /sbin/service libvirtd condrestart > /dev/null 2>&1
-fi
- %endif
-
# In upgrade scenario we must explicitly enable virtlockd/virtlogd
# sockets, if libvirtd is already enabled and start them if
# libvirtd is running, otherwise you'll get failures to start
@@ -1789,6 +1779,12 @@
/bin/systemctl is-active libvirtd.service 1>/dev/null 2>&1 &&
/bin/systemctl start virtlogd.socket || :
%else
+ %triggerpostun daemon -- libvirt-daemon < 1.2.1
+ if [ "$1" -ge "1" ]; then
+ /sbin/service virtlockd reload > /dev/null 2>&1 || :
+ /sbin/service virtlogd reload > /dev/null 2>&1 || :
+ /sbin/service libvirtd condrestart > /dev/null 2>&1
+ fi
/sbin/chkconfig libvirtd 1>/dev/null 2>&1 &&
/sbin/chkconfig virtlogd on || :
/sbin/service libvirtd status 1>/dev/null 2>&1 &&
8 years, 8 months
[libvirt] [PATCH 0/7] docs: Some website tweaks
by Andrea Bolognani
Basically, the navigation menu is *way* too big, and takes
the focus away from the actual content. Plus it's very easy
for longish words to overflow it (see "Authentication" in
the screenshots below).
The headers are probably bigger than needed as well, so
I've scaled them down. Using Wikipedia for comparison,
you can see the new size is more comparable to what they
use.
Some other minor cleanups have been included as well.
Before[1] and after[2] screenshots for your convenience.
Cheers.
[1] http://i.imgur.com/MZchAWD.png
[2] http://i.imgur.com/BXepLTh.png
Andrea Bolognani (7):
docs: Adjust vertical whitespace in CSS
docs: Remove empty CSS rule
docs: Don't use <strong> in headers
docs: Make menu entries smaller
docs: Don't use bold text for menu entries
docs: Use bold text for all headers
docs: Make most headers a bit smaller
docs/apps.html.in | 2 +-
docs/generic.css | 15 +++++++++------
docs/libvirt.css | 30 ++++++------------------------
3 files changed, 16 insertions(+), 31 deletions(-)
--
2.5.5
8 years, 8 months
[libvirt] [PATCH] remote: Add flags to remote_protocol-structs
by Martin Kletzander
Caused by 3b6c8185328f.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
Pushed under the 'build-breaker' rule.
src/remote_protocol-structs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index 1257aac51dfb..6dddd52ab116 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -310,9 +310,11 @@ struct remote_domain_set_perf_events_args {
u_int params_len;
remote_typed_param * params_val;
} params;
+ u_int flags;
};
struct remote_domain_get_perf_events_args {
remote_nonnull_domain dom;
+ u_int flags;
};
struct remote_domain_get_perf_events_ret {
struct {
--
2.8.0
8 years, 8 months