[libvirt] [PATCH 0/9] ABI/JSON/other fixes
by Peter Krempa
I've split out these patches from my work on supporting memory hotplug in qemu
so that the resulting series is not extremely huge.
Peter Krempa (9):
conf: Improve adding of new address types
conf: shmem: Add ABI stability check
conf: Add compile time check that devices were checked for ABI
stability
qemu: hotplug: Use typecasted switch statement when plugging new
devices
util: json: Split out code to create json value objects
util: json: Improve handling and docs for adding JSON objects
qemu: monitor: Add functions for object hot-add/remove
Implement empty post parse callbacks for all drivers
conf: Move definition of virDomainParseMemory
src/bhyve/bhyve_domain.c | 10 ++
src/conf/domain_conf.c | 179 +++++++++++++++++++++++--------
src/conf/domain_conf.h | 2 +-
src/libvirt_private.syms | 2 +
src/parallels/parallels_driver.c | 21 ++++
src/phyp/phyp_driver.c | 29 ++++-
src/qemu/qemu_driver.c | 17 ++-
src/qemu/qemu_monitor.c | 48 +++++++++
src/qemu/qemu_monitor.h | 8 ++
src/qemu/qemu_monitor_json.c | 217 ++++++++++---------------------------
src/qemu/qemu_monitor_json.h | 8 ++
src/uml/uml_driver.c | 10 ++
src/util/virjson.c | 224 +++++++++++++++++++++++++++++++++++++++
src/util/virjson.h | 5 +
src/vbox/vbox_common.c | 19 ++++
src/vmware/vmware_driver.c | 24 ++++-
src/vmx/vmx.c | 18 ++++
src/xenapi/xenapi_driver.c | 10 ++
18 files changed, 645 insertions(+), 206 deletions(-)
--
2.1.0
10 years, 1 month
[libvirt] [PATCH] libvirt: Document UNDEFINE_NVRAM in UndefineFlags doc
by Cole Robinson
---
src/libvirt.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/libvirt.c b/src/libvirt.c
index caacc2e..dfca4f6 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -8760,6 +8760,10 @@ virDomainUndefine(virDomainPtr domain)
* whether this flag is present. On hypervisors where snapshots do
* not use libvirt metadata, this flag has no effect.
*
+ * If the domain has any nvram specified, then including
+ * VIR_DOMAIN_UNDEFINE_NVRAM will also remove that file, and omitting the flag
+ * will cause the undefine process to fail.
+ *
* Returns 0 in case of success, -1 in case of error
*/
int
--
2.1.0
10 years, 1 month
[libvirt] [PATCH] Cleanup maintainers list
by Jiri Denemark
These
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
AUTHORS.in | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/AUTHORS.in b/AUTHORS.in
index 0e0e613..3c783f7 100644
--- a/AUTHORS.in
+++ b/AUTHORS.in
@@ -8,32 +8,25 @@ Daniel Veillard <veillard(a)redhat.com> or <daniel(a)veillard.com>
The primary maintainers and people with commit access rights:
Alex Jia <ajia(a)redhat.com>
-Anthony Liguori <aliguori(a)us.ibm.com>
Cédric Bosdonnat <cbosdonnat(a)suse.com>
-Chris Lalancette <clalance(a)redhat.com>
Christophe Fergeau <cfergeau(a)redhat.com>
Claudio Bley <cbley(a)av-test.de>
Cole Robinson <crobinso(a)redhat.com>
Daniel Berrange <berrange(a)redhat.com>
Daniel Veillard <veillard(a)redhat.com>
-Dave Allan <dallan(a)redhat.com>
Doug Goldstein <cardoe(a)gentoo.org>
Eric Blake <eblake(a)redhat.com>
Gao Feng <gaofeng(a)cn.fujitsu.com>
-Guannan Ren <gren(a)redhat.com>
Guido Günther <agx(a)sigxcpu.org>
Ján Tomko <jtomko(a)redhat.com>
Jim Fehlig <jfehlig(a)suse.com>
-Jim Meyering <meyering(a)redhat.com>
Jiří Denemark <jdenemar(a)redhat.com>
John Ferlan <jferlan(a)redhat.com>
-John Levon <john.levon(a)sun.com>
Laine Stump <laine(a)redhat.com>
Mark McLoughlin <markmc(a)redhat.com>
Martin Kletzander <mkletzan(a)redhat.com>
Matthias Bolte <matthias.bolte(a)googlemail.com>
Michal Prívozník <mprivozn(a)redhat.com>
-Osier Yang <jyang(a)redhat.com>
Pavel Hrdina <phrdina(a)redhat.com>
Peter Krempa <pkrempa(a)redhat.com>
Richard W.M. Jones <rjones(a)redhat.com>
@@ -43,11 +36,18 @@ Wen Congyang <wency(a)cn.fujitsu.com>
Previous maintainers:
+Anthony Liguori <aliguori(a)us.ibm.com>
Atsushi SAKAI <sakaia(a)jp.fujitsu.com>
+Chris Lalancette <clalance(a)redhat.com>
Dan Smith <danms(a)us.ibm.com>
+Dave Allan <dallan(a)redhat.com>
Dave Leskovec <dlesko(a)linux.vnet.ibm.com>
+Guannan Ren <gren(a)redhat.com>
+Jim Meyering <meyering(a)redhat.com>
+John Levon <john.levon(a)sun.com>
Justin Clift <jclift(a)redhat.com>
Karel Zak <kzak(a)redhat.com>
+Osier Yang <jyang(a)redhat.com>
Patches have also been contributed by:
--
2.1.2
10 years, 1 month
[libvirt] [PATCH] conf: fix a wrong comment in virSocketAddrNumericFamily()
by Chen Fan
Signed-off-by: Chen Fan <chen.fan.fnst(a)cn.fujitsu.com>
---
src/util/virsocketaddr.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/util/virsocketaddr.c b/src/util/virsocketaddr.c
index a19e3af..8c9f05f 100644
--- a/src/util/virsocketaddr.c
+++ b/src/util/virsocketaddr.c
@@ -859,8 +859,7 @@ virSocketAddrGetIpPrefix(const virSocketAddr *address,
* virSocketAddrNumericFamily:
* @address: address to check
*
- * Check if passed address is an IP address in numeric format. and
- * return the address family, otherwise return 0.
+ * Check if passed address is an IP address in numeric format.
*
* Returns: AF_INET or AF_INET6 if @address is an numeric IP address,
* -1 otherwise.
--
1.9.3
10 years, 1 month
[libvirt] [PATCHv2 1/2] util: Functions to update host network device's multicast filter
by akrowiak@linux.vnet.ibm.com
From: Tony Krowiak <akrowiak(a)linux.vnet.ibm.com>
This patch provides the utility functions to needed to synchronize the
changes made to a guest domain network device's multicast filter
with the corresponding macvtap device's filter on the host:
* Get/add/remove multicast MAC addresses
* Get the macvtap device's RX filter list
Signed-off-by: Tony Krowiak <akrowiak(a)linux.vnet.ibm.com>
---
Changes from V1:
* Using virHexToBin function to parse HEX MAC address instead of
sscanf in virMacAddrParseHex function
* Using ENOSYS in error messages for empty functions
* Reading entire file with virFileReadAll function when
parsing /proc/net/dev_mcast file
* Using VIR_APPEND_ELEMENT macro when appending array of
/proc/net/dev_mcast file objects
* Misc. formatting changes
src/libvirt_private.syms | 4 +
src/util/virmacaddr.c | 37 +++++
src/util/virmacaddr.h | 4 +
src/util/virnetdev.c | 360 ++++++++++++++++++++++++++++++++++++++++++++++
src/util/virnetdev.h | 11 ++
5 files changed, 416 insertions(+), 0 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index d6265ac..6d06a2c 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1590,13 +1590,16 @@ virMacAddrIsBroadcastRaw;
virMacAddrIsMulticast;
virMacAddrIsUnicast;
virMacAddrParse;
+virMacAddrParseHex;
virMacAddrSet;
virMacAddrSetRaw;
# util/virnetdev.h
+virNetDevAddMulti;
virNetDevAddRoute;
virNetDevClearIPv4Address;
+virNetDevDelMulti;
virNetDevExists;
virNetDevGetIndex;
virNetDevGetIPv4Address;
@@ -1604,6 +1607,7 @@ virNetDevGetLinkInfo;
virNetDevGetMAC;
virNetDevGetMTU;
virNetDevGetPhysicalFunction;
+virNetDevGetRxFilter;
virNetDevGetVirtualFunctionIndex;
virNetDevGetVirtualFunctionInfo;
virNetDevGetVirtualFunctions;
diff --git a/src/util/virmacaddr.c b/src/util/virmacaddr.c
index ebd1182..ae5e5d2 100644
--- a/src/util/virmacaddr.c
+++ b/src/util/virmacaddr.c
@@ -198,6 +198,43 @@ virMacAddrFormat(const virMacAddr *addr,
return str;
}
+/**
+ * virMacAddrParseHex:
+ * @str: string hexadecimal representation of MAC address, e.g., "F801EFCE3aCB"
+ * @addr: 6-byte MAC address
+ *
+ * Parse the hexadecimal representation of a MAC address
+ *
+ * Return 0 upon success, or -1 in case of error.
+ */
+int
+virMacAddrParseHex(const char* str, virMacAddrPtr addr)
+{
+ if (strlen(str) != VIR_MAC_HEXLEN)
+ return -1;
+
+ size_t iaddr;
+ size_t istr;
+
+
+ for (istr = 0, iaddr = 0; iaddr < VIR_MAC_BUFLEN; istr += 2, iaddr++) {
+ unsigned int hex;
+
+ if (sscanf(&str[istr], "%02x", &hex) != 1)
+ break;
+
+ if (hex > UCHAR_MAX)
+ break;
+
+ addr->addr[iaddr] = hex;
+ }
+
+ if (istr == VIR_MAC_HEXLEN)
+ return 0;
+
+ return -1;
+}
+
void virMacAddrGenerate(const unsigned char prefix[VIR_MAC_PREFIX_BUFLEN],
virMacAddrPtr addr)
{
diff --git a/src/util/virmacaddr.h b/src/util/virmacaddr.h
index 49efc36..72a285a 100644
--- a/src/util/virmacaddr.h
+++ b/src/util/virmacaddr.h
@@ -27,6 +27,7 @@
# include "internal.h"
# define VIR_MAC_BUFLEN 6
+#define VIR_MAC_HEXLEN (VIR_MAC_BUFLEN * 2)
# define VIR_MAC_PREFIX_BUFLEN 3
# define VIR_MAC_STRING_BUFLEN (VIR_MAC_BUFLEN * 3)
@@ -50,6 +51,9 @@ void virMacAddrGenerate(const unsigned char prefix[VIR_MAC_PREFIX_BUFLEN],
virMacAddrPtr addr);
int virMacAddrParse(const char* str,
virMacAddrPtr addr) ATTRIBUTE_RETURN_CHECK;
+int virMacAddrParseHex(const char* str,
+ virMacAddrPtr addr)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
bool virMacAddrIsUnicast(const virMacAddr *addr);
bool virMacAddrIsMulticast(const virMacAddr *addr);
bool virMacAddrIsBroadcastRaw(const unsigned char s[VIR_MAC_BUFLEN]);
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index db5623a..5e53f5f 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -56,6 +56,33 @@
VIR_LOG_INIT("util.netdev");
+# define VIR_MCAST_NAME_LEN (IFNAMSIZ + 1)
+# define VIR_MCAST_INDEX_TOKEN_IDX 0
+# define VIR_MCAST_NAME_TOKEN_IDX 1
+# define VIR_MCAST_USERS_TOKEN_IDX 2
+# define VIR_MCAST_GLOBAL_TOKEN_IDX 3
+# define VIR_MCAST_ADDR_TOKEN_IDX 4
+# define VIR_MCAST_NUM_TOKENS 5
+# define VIR_MCAST_TOKEN_DELIMS " \n"
+# define VIR_MCAST_ADDR_LEN (VIR_MAC_HEXLEN + 1)
+
+typedef struct _virNetDevMcastEntry virNetDevMcastEntry;
+typedef virNetDevMcastEntry *virNetDevMcastEntryPtr;
+struct _virNetDevMcastEntry {
+ int index;
+ char name[VIR_MCAST_NAME_LEN];
+ int users;
+ bool global;
+ virMacAddr macaddr;
+};
+
+typedef struct _virNetDevMcast virNetDevMcast;
+typedef virNetDevMcast *virNetDevMcastPtr;
+struct _virNetDevMcast {
+ size_t nentries;
+ virNetDevMcastEntryPtr *entries;
+};
+
#if defined(HAVE_STRUCT_IFREQ)
static int virNetDevSetupControlFull(const char *ifname,
struct ifreq *ifr,
@@ -1934,6 +1961,266 @@ virNetDevGetLinkInfo(const char *ifname,
#endif /* defined(__linux__) */
+#if defined(SIOCADDMULTI) && defined(HAVE_STRUCT_IFREQ)
+/**
+ * virNetDevAddMulti:
+ * @ifname: interface name to which to add multicast MAC address
+ * @macaddr: MAC address
+ *
+ * This function adds the @macaddr to the multicast list for a given interface
+ * @ifname.
+ *
+ * Returns 0 in case of success or -1 on failure
+ */
+int virNetDevAddMulti(const char *ifname,
+ virMacAddrPtr macaddr)
+{
+ int fd = -1;
+ int ret = -1;
+ struct ifreq ifr;
+
+ if ((fd = virNetDevSetupControl(ifname, &ifr)) < 0)
+ return -1;
+
+ ifr.ifr_hwaddr.sa_family = AF_UNSPEC;
+ virMacAddrGetRaw(macaddr, (unsigned char *)ifr.ifr_hwaddr.sa_data);
+
+ if (ioctl(fd, SIOCADDMULTI, &ifr) < 0) {
+ char macstr[VIR_MAC_STRING_BUFLEN];
+ virReportSystemError(errno,
+ _("Cannot add multicast MAC %s on '%s' interface"),
+ virMacAddrFormat(macaddr, macstr), ifname);
+ goto cleanup;
+ }
+
+ ret = 0;
+
+ cleanup:
+ VIR_FORCE_CLOSE(fd);
+ return ret;
+}
+#else
+int virNetDevAddMulti(const char *ifname,
+ virMacAddrPtr macaddr ATTRIBUTE_UNUSED)
+{
+ char macstr[VIR_MAC_STRING_BUFLEN];
+ virReportSystemError(errno,
+ _("Cannot add multicast MAC %s on '%s' interface"),
+ virMacAddrFormat(macaddr, macstr), ifname);
+ return -1;
+}
+#endif
+
+#if defined(SIOCDELMULTI) && defined(HAVE_STRUCT_IFREQ)
+/**
+ * virNetDevDelMulti:
+ * @ifname: interface name from which to delete the multicast MAC address
+ * @macaddr: MAC address
+ *
+ * This function deletes the @macaddr from the multicast list for a given
+ * interface @ifname.
+ *
+ * Returns 0 in case of success or -1 on failure
+ */
+int virNetDevDelMulti(const char *ifname,
+ virMacAddrPtr macaddr)
+{
+ int fd = -1;
+ int ret = -1;
+ struct ifreq ifr;
+
+ if ((fd = virNetDevSetupControl(ifname, &ifr)) < 0)
+ return -1;
+
+ ifr.ifr_hwaddr.sa_family = AF_UNSPEC;
+ virMacAddrGetRaw(macaddr, (unsigned char *)ifr.ifr_hwaddr.sa_data);
+
+ if (ioctl(fd, SIOCDELMULTI, &ifr) < 0) {
+ char macstr[VIR_MAC_STRING_BUFLEN];
+ virReportSystemError(errno,
+ _("Cannot add multicast MAC %s on '%s' interface"),
+ virMacAddrFormat(macaddr, macstr), ifname);
+ goto cleanup;
+ }
+
+ ret = 0;
+
+ cleanup:
+ VIR_FORCE_CLOSE(fd);
+ return ret;
+}
+#else
+int virNetDevDelMulti(const char *ifname,
+ virMacAddrPtr macaddr ATTRIBUTE_UNUSED)
+{
+ char macstr[VIR_MAC_STRING_BUFLEN];
+ virReportSystemError(errno,
+ _("Cannot delete multicast MAC %s on '%s' interface"),
+ virMacAddrFormat(macaddr, macstr), ifname);
+ return -1;
+}
+#endif
+
+static int virNetDevParseMcast(char *buf, virNetDevMcastEntryPtr mcast)
+{
+ int ifindex;
+ int num;
+ char *next;
+ char *token;
+ char *saveptr;
+ char *endptr;
+
+ for (ifindex = 0, next = buf; ifindex < VIR_MCAST_NUM_TOKENS; ifindex++,
+ next = NULL) {
+ token = strtok_r(next, VIR_MCAST_TOKEN_DELIMS, &saveptr);
+
+ if (token == NULL) {
+ virReportSystemError(EINVAL,
+ _("failed to parse multicast address from '%s'"),
+ buf);
+ return -1;
+ }
+
+ switch (ifindex) {
+ case VIR_MCAST_INDEX_TOKEN_IDX:
+ if (virStrToLong_i(token, &endptr, 10, &num) < 0) {
+ virReportSystemError(EINVAL,
+ _("Failed to parse index from '%s'"),
+ buf);
+ return -1;
+
+ }
+
+ mcast->index = num;
+
+ break;
+ case VIR_MCAST_NAME_TOKEN_IDX:
+ if (virStrncpy(mcast->name, token, strlen(token),
+ VIR_MCAST_NAME_LEN) == NULL) {
+ virReportSystemError(EINVAL,
+ _("Failed to parse NIC name from '%s'"),
+ buf);
+ return -1;
+ }
+
+ break;
+ case VIR_MCAST_USERS_TOKEN_IDX:
+ if (virStrToLong_i(token, &endptr, 10, &num) < 0) {
+ virReportSystemError(EINVAL,
+ _("Failed to parse users from '%s'"),
+ buf);
+ return -1;
+
+ }
+
+ mcast->users = num;
+
+ break;
+ case VIR_MCAST_GLOBAL_TOKEN_IDX:
+ if (virStrToLong_i(token, &endptr, 10, &num) < 0) {
+ virReportSystemError(EINVAL,
+ _("Failed to parse users from '%s'"),
+ buf);
+ return -1;
+
+ }
+
+ mcast->global = num;
+
+ break;
+ case VIR_MCAST_ADDR_TOKEN_IDX:
+ if (virMacAddrParseHex((const char*)token,
+ &mcast->macaddr) < 0) {
+ virReportSystemError(EINVAL,
+ _("Failed to parse MAC address from '%s'"),
+ buf);
+ }
+
+ break;
+ default:
+ break;
+ }
+ }
+
+ return 0;
+}
+
+
+static int virNetDevGetMcast(const char *ifname,
+ virNetDevMcastPtr mcast)
+{
+ FILE *file;
+ const char *path = "/proc/net/dev_mcast";
+ char buf[256];
+ int ret = -1;
+ virNetDevMcastEntry entry;
+ virNetDevMcastEntryPtr *entries = NULL;
+ size_t nentries = 0;
+ size_t entries_sz = 0;
+ size_t i;
+ mcast->entries = NULL;
+ mcast->nentries = 0;
+
+ file = fopen(path, "r");
+
+ if (!file) {
+ virReportSystemError(errno,
+ _("cannot open multicast address file %s"), path);
+ return -1;
+ }
+
+ while (fgets(buf, sizeof(buf), file)) {
+ if (virNetDevParseMcast(buf, &entry) < 0) {
+ goto error;
+ }
+
+ if (entry.global && STREQ(ifname, entry.name)) {
+ if (VIR_RESIZE_N(entries, entries_sz,
+ nentries, 1) < 0) {
+ virReportSystemError(ENOMEM,
+ _("Failed to resize multicast MAC address array: "
+ "ptr=%p, alloc=%zu, count=%zu, add=1"),
+ entries, entries_sz, nentries);
+ goto error;
+ }
+
+ if (VIR_ALLOC(entries[nentries]) < 0) {
+ char addr[VIR_MAC_STRING_BUFLEN];
+ virReportSystemError(ENOMEM,
+ _("Failed to allocate storage for MAC address %s"),
+ virMacAddrFormat(&mcast->entries[nentries]->macaddr,
+ addr));
+ goto error;
+ }
+
+ memcpy(entries[nentries++], &entry,
+ sizeof(virNetDevMcastEntry));
+ }
+
+ memset(buf, 0, sizeof(buf));
+ memset(&entry, 0, sizeof(virNetDevMcastEntry));
+ }
+
+
+ mcast->nentries = nentries;
+ mcast->entries = entries;
+ ret = 0;
+
+ error:
+ VIR_FORCE_FCLOSE(file);
+
+ if ((ret < 0) && (nentries > 0)) {
+ for (i = 0; i < nentries; i++) {
+ VIR_FREE(entries[i]);
+ }
+
+ VIR_FREE(entries);
+ }
+
+ return ret;
+}
+
+
VIR_ENUM_IMPL(virNetDevRxFilterMode,
VIR_NETDEV_RX_FILTER_MODE_LAST,
"none",
@@ -1941,6 +2228,37 @@ VIR_ENUM_IMPL(virNetDevRxFilterMode,
"all");
+static int virNetDevGetMulticastTable(const char *ifname,
+ virNetDevRxFilterPtr filter)
+{
+ int i;
+ int ret = -1;
+ virNetDevMcast mcast;
+ filter->multicast.nTable = 0;
+ filter->multicast.table = NULL;
+
+ if (virNetDevGetMcast(ifname, &mcast) < 0)
+ goto error;
+
+ if (mcast.nentries > 0) {
+ if (VIR_ALLOC_N(filter->multicast.table, mcast.nentries))
+ goto error;
+
+ for (i = 0; i < mcast.nentries; i++) {
+ virMacAddrSet(&filter->multicast.table[i],
+ &mcast.entries[i]->macaddr);
+ }
+
+ filter->multicast.nTable = mcast.nentries;
+ }
+
+ ret = 0;
+
+ error:
+ return ret;
+}
+
+
virNetDevRxFilterPtr
virNetDevRxFilterNew(void)
{
@@ -1963,3 +2281,45 @@ virNetDevRxFilterFree(virNetDevRxFilterPtr filter)
VIR_FREE(filter);
}
}
+
+
+/**
+ * virNetDevGetRxFilter:
+ * This function supplies the RX filter list for a given device interface
+ *
+ * @ifname: Name of the interface
+ * @filter: The RX filter list
+ *
+ * Returns 0 or -1 on failure.
+ */
+int virNetDevGetRxFilter(const char *ifname,
+ virNetDevRxFilterPtr *filter)
+{
+ int ret = -1;
+ virNetDevRxFilterPtr fil = virNetDevRxFilterNew();
+
+ if (!fil) {
+ virReportSystemError(ENOMEM,
+ _("Failed to allocate filter for %s interface"),
+ ifname);
+
+ }
+
+ if (virNetDevGetMAC(ifname, &fil->mac))
+ goto cleanup;
+
+ if (virNetDevGetMulticastTable(ifname, fil))
+ goto cleanup;
+
+ ret = 0;
+
+ cleanup:
+ if (ret < 0) {
+ virNetDevRxFilterFree(fil);
+ fil = NULL;
+ }
+
+ *filter = fil;
+
+ return ret;
+}
diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h
index 2a6e67d..1d274b3 100644
--- a/src/util/virnetdev.h
+++ b/src/util/virnetdev.h
@@ -30,6 +30,7 @@
# include "virmacaddr.h"
# include "virpci.h"
# include "device_conf.h"
+# include "virutil.h"
# ifdef HAVE_STRUCT_IFREQ
typedef struct ifreq virIfreq;
@@ -189,5 +190,15 @@ int virNetDevGetLinkInfo(const char *ifname,
virNetDevRxFilterPtr virNetDevRxFilterNew(void)
ATTRIBUTE_RETURN_CHECK;
void virNetDevRxFilterFree(virNetDevRxFilterPtr filter);
+int virNetDevGetRxFilter(const char *ifname,
+ virNetDevRxFilterPtr *filter)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+
+int virNetDevAddMulti(const char *ifname,
+ virMacAddrPtr macaddr)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+int virNetDevDelMulti(const char *ifname,
+ virMacAddrPtr macaddr)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
#endif /* __VIR_NETDEV_H__ */
--
1.7.1
10 years, 1 month
[libvirt] [PATCH] virsh: domain: Use global constant for XML file size limit
by Peter Krempa
Few places still used hardcoded limit for maximum XML size for commands
that accept XML files. The hardcoded limits ranged from 8k to 1M. Use
VSH_MAX_XML_FILE to express this limit in a unified way. This will bump
the limit for the commands that used hardcoded string lengths to 10M.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1152427
---
tools/virsh-domain.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 12550ff..94ae3d3 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -1984,7 +1984,7 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd)
}
if (xml) {
- if (virFileReadAll(xml, 8192, &xmlstr) < 0) {
+ if (virFileReadAll(xml, VSH_MAX_XML_FILE, &xmlstr) < 0) {
vshReportError(ctl);
goto cleanup;
}
@@ -3889,7 +3889,7 @@ doSave(void *opaque)
goto out;
if (xmlfile &&
- virFileReadAll(xmlfile, 8192, &xml) < 0) {
+ virFileReadAll(xmlfile, VSH_MAX_XML_FILE, &xml) < 0) {
vshReportError(ctl);
goto out;
}
@@ -4182,7 +4182,7 @@ cmdSaveImageDefine(vshControl *ctl, const vshCmd *cmd)
if (vshCommandOptStringReq(ctl, cmd, "xml", &xmlfile) < 0)
return false;
- if (virFileReadAll(xmlfile, 8192, &xml) < 0)
+ if (virFileReadAll(xmlfile, VSH_MAX_XML_FILE, &xml) < 0)
goto cleanup;
if (virDomainSaveImageDefineXML(ctl->conn, file, xml, flags) < 0) {
@@ -4765,7 +4765,7 @@ cmdRestore(vshControl *ctl, const vshCmd *cmd)
return false;
if (xmlfile &&
- virFileReadAll(xmlfile, 8192, &xml) < 0)
+ virFileReadAll(xmlfile, VSH_MAX_XML_FILE, &xml) < 0)
goto cleanup;
if (((flags || xml)
@@ -8945,7 +8945,7 @@ cmdDomXMLFromNative(vshControl *ctl, const vshCmd *cmd)
vshCommandOptStringReq(ctl, cmd, "config", &configFile) < 0)
return false;
- if (virFileReadAll(configFile, 1024*1024, &configData) < 0)
+ if (virFileReadAll(configFile, VSH_MAX_XML_FILE, &configData) < 0)
return false;
xmlData = virConnectDomainXMLFromNative(ctl->conn, format, configData, flags);
@@ -9001,7 +9001,7 @@ cmdDomXMLToNative(vshControl *ctl, const vshCmd *cmd)
vshCommandOptStringReq(ctl, cmd, "xml", &xmlFile) < 0)
return false;
- if (virFileReadAll(xmlFile, 1024*1024, &xmlData) < 0)
+ if (virFileReadAll(xmlFile, VSH_MAX_XML_FILE, &xmlData) < 0)
return false;
configData = virConnectDomainXMLToNative(ctl->conn, format, xmlData, flags);
@@ -9318,7 +9318,7 @@ doMigrate(void *opaque)
if (opt) {
char *xml;
- if (virFileReadAll(opt, 1024 * 1024, &xml) < 0) {
+ if (virFileReadAll(opt, VSH_MAX_XML_FILE, &xml) < 0) {
vshError(ctl, _("cannot read file '%s'"), opt);
goto save_error;
}
--
2.1.0
10 years, 1 month
[libvirt] [PATCH] virsh: man: Fix description of --live/--config usage
by Peter Krempa
dommemstat and blkdeviotune's man page incorrectly stated the usage of
--live and --config.
---
Notes:
Pushed as trivial.
tools/virsh.pod | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/virsh.pod b/tools/virsh.pod
index eae9195..cc55821 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -772,7 +772,7 @@ respectfully with average value of zero.
If I<--live> is specified, affect a running guest.
If I<--config> is specified, affect the next boot of a persistent guest.
If I<--current> is specified, affect the current guest state.
-Both I<--live> and I<--current> flags may be given, but I<--current> is
+Both I<--live> and I<--config> flags may be given, but I<--current> is
exclusive. If no flag is specified, behavior is different depending
on hypervisor.
@@ -1078,7 +1078,7 @@ cannot be mixed with non-zero values for read or write.
If I<--live> is specified, affect a running guest.
If I<--config> is specified, affect the next boot of a persistent guest.
If I<--current> is specified, affect the current guest state.
-Both I<--live> and I<--current> flags may be given, but I<--current> is
+Both I<--live> and I<--config> flags may be given, but I<--current> is
exclusive. If no flag is specified, behavior is different depending
on hypervisor.
--
2.1.0
10 years, 1 month
[libvirt] [PATCH] conf: improve the comments for "xmlopt"
by Wang Rui
Signed-off-by: Wang Rui <moon.wangrui(a)huawei.com>
---
src/conf/domain_conf.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 5dc4b62..35bbd91 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2417,6 +2417,7 @@ virDomainObjPtr virDomainObjListAdd(virDomainObjListPtr doms,
* operations do not persist past shutdown.
*
* @param caps pointer to capabilities info
+ * @param xmlopt pointer to XML parser configuration object
* @param domain domain object pointer
* @param live if true, run this operation even for an inactive domain.
* this allows freely updated domain->def with runtime defaults before
@@ -2454,6 +2455,7 @@ virDomainObjSetDefTransient(virCapsPtr caps,
* return the running config.
*
* @param caps pointer to capabilities info
+ * @param xmlopt pointer to XML parser configuration object
* @param domain domain object pointer
* @return NULL on error, virDOmainDefPtr on success
*/
--
1.7.12.4
10 years, 1 month
[libvirt] libvirt internal snapshots incremental or not.
by Sijo Jose
Hi,
Is libvirt internal snapshots are incremental or not..?
Consider the example,
There are 3 snapshots, created respectively snp1 first,
after some changes snp2, again after some changes snp3.
Question,
1.Is there any dependency that is ...snp2 depended upon snp1 and snp3
depended upon snp2 OR snp1 OR both
2.So if I remove snp2, does it makes snp3 invalid, OR can I use snp3
further.
--
*Regards*
*Sijo Jose*
10 years, 1 month