[libvirt] [PATCH 0/3 v3] Cgroup fixes
by Osier Yang
Instead of only post v2 of 5/7 (v2) in the old mail thread, this
resend the left patches of v2 with a independant thread for easy
reviewing.
v2 - v3:
* 1/7 ~ 4/7 of v1 are pushed.
* goto label "cleanup" is kept with Daniel's suggestion for 5/7 (v1)
* Commit log of 6/7 (v1) are updated a bit to reflect more clear
about the cause
v1 - v2:
* Just resending
v2: https://www.redhat.com/archives/libvir-list/2013-May/msg01314.html
Osier Yang (3):
qemu: Abstract code for the cpu controller setting into a helper
qemu: Set cpuset.cpus for domain process
qemu: Prohibit getting the numa parameters if mode is not strict
src/qemu/qemu_cgroup.c | 94 ++++++++++++++++++++++++++++++++++++--------------
src/qemu/qemu_driver.c | 11 ++++--
2 files changed, 78 insertions(+), 27 deletions(-)
--
1.8.1.4
11 years, 5 months
[libvirt] [PATCH v2 0/2] BSD implementation of virNetDevTapCreate() and virNetDevTapDelete()
by Roman Bogorodskiy
Changes from the previous version:
* virNetDevSetupControl patch: remove pointless <config.h> include from
virnetdev.h
* virnetdevtap.c patch: rebase to include new tapfdSize param for
virNetDevTapCreate()
Roman Bogorodskiy (2):
Make virNetDevSetupControl() public.
BSD: implement virNetDevTapCreate() and virNetDevTapDelete()
src/libvirt_private.syms | 1 +
src/util/virnetdev.c | 15 ++++-
src/util/virnetdev.h | 11 ++++
src/util/virnetdevmacvlan.c | 2 +-
src/util/virnetdevtap.c | 116 ++++++++++++++++++++++++++++++++++++++-
src/util/virnetdevvportprofile.c | 2 +-
6 files changed, 141 insertions(+), 6 deletions(-)
--
1.8.0
11 years, 5 months
[libvirt] [PATCH 0/4] Assorted bool cleanups
by Ján Tomko
Found by: git grep '= 1'
Ján Tomko (4):
Replace two-state local integers with bool
Remove redundant two-state integers
nwfilter: change two-state int parameters to bool
qemu: change two-state int parameters to bool
src/conf/domain_conf.c | 18 +++++-----
src/conf/network_conf.c | 5 ++-
src/conf/nwfilter_conf.c | 56 +++++++++++++++----------------
src/conf/storage_conf.c | 5 ++-
src/lxc/lxc_controller.c | 4 +--
src/lxc/lxc_process.c | 4 +--
src/nwfilter/nwfilter_dhcpsnoop.c | 8 +----
src/nwfilter/nwfilter_ebiptables_driver.c | 36 ++++++++++----------
src/nwfilter/nwfilter_gentech_driver.c | 4 +--
src/qemu/qemu_agent.c | 6 ++--
src/qemu/qemu_capabilities.c | 21 ++++++------
src/qemu/qemu_capabilities.h | 2 +-
src/qemu/qemu_command.c | 39 ++++++++++-----------
src/qemu/qemu_driver.c | 6 ++--
src/qemu/qemu_hostdev.c | 6 ++--
src/qemu/qemu_migration.c | 20 +++++------
src/qemu/qemu_monitor.c | 6 ++--
src/qemu/qemu_monitor_json.c | 8 ++---
src/qemu/qemu_monitor_text.c | 16 ++++-----
src/qemu/qemu_process.c | 23 +++++--------
src/remote/remote_driver.c | 5 ++-
src/rpc/virnetserver.c | 6 ++--
src/storage/storage_backend.c | 4 +--
src/util/vircgroup.c | 4 +--
src/util/virlog.c | 15 +++++----
src/util/virnetdev.c | 19 +++++------
src/util/virpci.c | 12 +++----
src/util/viruri.c | 5 +--
src/util/virutil.c | 12 +++----
tests/qemuhelptest.c | 5 +--
tests/reconnect.c | 6 ++--
tests/ssh.c | 8 ++---
32 files changed, 192 insertions(+), 202 deletions(-)
--
1.8.1.5
11 years, 5 months
[libvirt] [PATCH] tool/virsh-domain.c: Fix the display of Affinity in function cmdVcpuinfo.
by yangdongsheng
(1).Introduce a symbol 'x' to mean the physical cpu on host is offline.
(2).And the symbol '-' means the physical cpu on host is online but the
affinity of domain for this cpu is not set.
There was no diffrence in display between the two kinds of cpu state
before this patch, both are '-'.
Signed-off-by: yangdongsheng <yangds.fnst(a)cn.fujitsu.com>
---
I have removed the vshNodeGetCPUMap patch from this patchset.
So this patch will only fix the display of virsh vcpuinfo, please
give me your comment. Thanx~
tools/virsh-domain.c | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 0402aef..6e13076 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -5271,6 +5271,7 @@ cmdVcpuinfo(vshControl *ctl, const vshCmd *cmd)
virDomainPtr dom;
virVcpuInfoPtr cpuinfo;
unsigned char *cpumaps;
+ unsigned char *hostcpumap;
int ncpus, maxcpu;
size_t cpumaplen;
bool ret = true;
@@ -5284,6 +5285,11 @@ cmdVcpuinfo(vshControl *ctl, const vshCmd *cmd)
return false;
}
+ if ((virNodeGetCPUMap(ctl->conn, &hostcpumap, NULL, 0)) < 0) {
+ virDomainFree(dom);
+ return false;
+ }
+
if (virDomainGetInfo(dom, &info) != 0) {
virDomainFree(dom);
return false;
@@ -5310,7 +5316,13 @@ cmdVcpuinfo(vshControl *ctl, const vshCmd *cmd)
}
vshPrint(ctl, "%-15s ", _("CPU Affinity:"));
for (m = 0; m < maxcpu; m++) {
- vshPrint(ctl, "%c", VIR_CPU_USABLE(cpumaps, cpumaplen, n, m) ? 'y' : '-');
+ if VIR_CPU_USED(hostcpumap, m) {
+ vshPrint(ctl, "%c", VIR_CPU_USABLE(cpumaps,
+ cpumaplen, n, m) ? 'y' : '-');
+ }
+ else {
+ vshPrint(ctl, "%c", 'x');
+ }
}
vshPrint(ctl, "\n");
if (n < (ncpus - 1)) {
@@ -5332,8 +5344,13 @@ cmdVcpuinfo(vshControl *ctl, const vshCmd *cmd)
vshPrint(ctl, "%-15s %s\n", _("CPU time"), _("N/A"));
vshPrint(ctl, "%-15s ", _("CPU Affinity:"));
for (m = 0; m < maxcpu; m++) {
- vshPrint(ctl, "%c",
- VIR_CPU_USABLE(cpumaps, cpumaplen, n, m) ? 'y' : '-');
+ if VIR_CPU_USED(hostcpumap, m) {
+ vshPrint(ctl, "%c", VIR_CPU_USABLE(cpumaps,
+ cpumaplen, n, m) ? 'y' : '-');
+ }
+ else {
+ vshPrint(ctl, "%c", 'x');
+ }
}
vshPrint(ctl, "\n");
if (n < (ncpus - 1)) {
@@ -5346,6 +5363,7 @@ cmdVcpuinfo(vshControl *ctl, const vshCmd *cmd)
}
VIR_FREE(cpumaps);
+ VIR_FREE(hostcpumap);
VIR_FREE(cpuinfo);
virDomainFree(dom);
return ret;
--
1.7.10.1
11 years, 5 months
[libvirt] [PATCH] storage: Refresh pool after creating volume
by Osier Yang
https://bugzilla.redhat.com/show_bug.cgi?id=965442
One has to refresh the pool to get the correct pool info, this
patch refreshes the pool after creating a volume in code instead.
Pool refreshing failure is fine to ignore with a warning.
---
src/storage/storage_driver.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index a2b0c21..2a55095 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -1443,6 +1443,9 @@ storageVolCreateXML(virStoragePoolPtr obj,
}
+ if (backend->refreshPool && backend->refreshPool(obj->conn, pool) < 0)
+ VIR_WARN("Failed to refresh pool after creating volume");
+
VIR_INFO("Creating volume '%s' in storage pool '%s'",
volobj->name, pool->def->name);
ret = volobj;
@@ -1606,6 +1609,9 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj,
goto cleanup;
}
+ if (backend->refreshPool && backend->refreshPool(obj->conn, pool) < 0)
+ VIR_WARN("Failed to refresh pool after creating volume");
+
VIR_INFO("Creating volume '%s' in storage pool '%s'",
volobj->name, pool->def->name);
ret = volobj;
--
1.8.1.4
11 years, 5 months
[libvirt] [PATCH] iscsi: support IPv6 targets
by Ján Tomko
Instead of resolving the host as IPv4 and only using the first result,
resolve it as IPv6 as well and use the first address we've succesfully
connected to as the portal name.
---
src/libvirt_private.syms | 1 +
src/storage/storage_backend_iscsi.c | 64 +++++----------------------
src/util/virutil.c | 87 +++++++++++++++++++++++++++++++++++++
src/util/virutil.h | 4 ++
4 files changed, 102 insertions(+), 54 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 9d5f74b..26c4553 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1931,6 +1931,7 @@ virEnumFromString;
virEnumToString;
virFindFCHostCapableVport;
virFormatIntDecimal;
+virGetConnectableIPAsString;
virGetDeviceID;
virGetDeviceUnprivSGIO;
virGetFCHostNameByWWN;
diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c
index ad38ab2..f98fbce 100644
--- a/src/storage/storage_backend_iscsi.c
+++ b/src/storage/storage_backend_iscsi.c
@@ -1,7 +1,7 @@
/*
* storage_backend_iscsi.c: storage backend for iSCSI handling
*
- * Copyright (C) 2007-2008, 2010-2012 Red Hat, Inc.
+ * Copyright (C) 2007-2008, 2010-2013 Red Hat, Inc.
* Copyright (C) 2007-2008 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -44,58 +44,16 @@
#include "vircommand.h"
#include "virrandom.h"
#include "virstring.h"
+#include "virutil.h"
#define VIR_FROM_THIS VIR_FROM_STORAGE
-static int
-virStorageBackendISCSITargetIP(const char *hostname,
- char *ipaddr,
- size_t ipaddrlen)
-{
- struct addrinfo hints;
- struct addrinfo *result = NULL;
- int ret;
-
- memset(&hints, 0, sizeof(hints));
- hints.ai_flags = AI_ADDRCONFIG;
- hints.ai_family = AF_INET;
- hints.ai_socktype = SOCK_STREAM;
- hints.ai_protocol = 0;
-
- ret = getaddrinfo(hostname, NULL, &hints, &result);
- if (ret != 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("host lookup failed %s"),
- gai_strerror(ret));
- return -1;
- }
-
- if (result == NULL) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("no IP address for target %s"),
- hostname);
- return -1;
- }
-
- if (getnameinfo(result->ai_addr, result->ai_addrlen,
- ipaddr, ipaddrlen, NULL, 0,
- NI_NUMERICHOST) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("cannot format ip addr for %s"),
- hostname);
- freeaddrinfo(result);
- return -1;
- }
-
- freeaddrinfo(result);
- return 0;
-}
-
static char *
virStorageBackendISCSIPortal(virStoragePoolSourcePtr source)
{
- char ipaddr[NI_MAXHOST];
- char *portal;
+ char *ip;
+ char *portal = NULL;
+ int port;
if (source->nhost != 1) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -103,17 +61,15 @@ virStorageBackendISCSIPortal(virStoragePoolSourcePtr source)
return NULL;
}
- if (virStorageBackendISCSITargetIP(source->hosts[0].name,
- ipaddr, sizeof(ipaddr)) < 0)
+ port = source->hosts[0].port ? source->hosts[0].port : 3260;
+
+ if (!(ip = virGetConnectableIPAsString(source->hosts[0].name, port)))
return NULL;
- if (virAsprintf(&portal, "%s:%d,1", ipaddr,
- source->hosts[0].port ?
- source->hosts[0].port : 3260) < 0) {
+ if (virAsprintf(&portal, "%s,1", ip) < 0)
virReportOOMError();
- return NULL;
- }
+ VIR_FREE(ip);
return portal;
}
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 028f1d1..d8400db 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -650,6 +650,93 @@ cleanup:
return result;
}
+/*
+ * Resolve 'host' and return the first address we've connected to
+ * as a string:
+ * address:port
+ * for IPv4 addresses and
+ * [address]:port
+ * for IPv6 addresses.
+ */
+char *
+virGetConnectableIPAsString(const char *host,
+ int port)
+{
+ struct addrinfo hints;
+ struct addrinfo *res, *rp;
+ int saved_errno = EINVAL;
+ char *ret = NULL;
+ char *buf = NULL;
+ char *portstr = NULL;
+ int rc;
+
+ if (VIR_ALLOC_N(buf, NI_MAXHOST) < 0)
+ goto no_memory;
+
+ if (virAsprintf(&portstr, "%d", port) < 0)
+ goto no_memory;
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_flags = AI_ADDRCONFIG;
+
+ if ((rc = getaddrinfo(host, portstr, &hints, &res))) {
+ virReportError(VIR_ERR_UNKNOWN_HOST,
+ _("unable to resolve '%s': %s"),
+ host, gai_strerror(rc));
+ goto cleanup;
+ }
+
+ for (rp = res; rp; rp = rp->ai_next) {
+ int sockfd;
+
+ sockfd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
+ if (sockfd == -1) {
+ saved_errno = errno;
+ continue;
+ }
+ if (connect(sockfd, rp->ai_addr, rp->ai_addrlen) != -1) {
+ VIR_FORCE_CLOSE(sockfd);
+ break;
+ }
+ saved_errno = errno;
+ VIR_FORCE_CLOSE(sockfd);
+ }
+
+ if (!rp) {
+ virReportSystemError(saved_errno,
+ _("unable to connect to '%s:%s'"),
+ host, portstr);
+ goto cleanup;
+ }
+
+ if ((rc = getnameinfo(rp->ai_addr, rp->ai_addrlen, buf, NI_MAXHOST,
+ NULL, 0, NI_NUMERICHOST)) < 0) {
+ virReportError(VIR_ERR_SYSTEM_ERROR,
+ _("Cannot convert IP address to string: %s"),
+ gai_strerror(rc));
+ goto cleanup;
+ }
+
+ if (rp->ai_family == AF_INET6) {
+ if (virAsprintf(&ret, "[%s]:%d", buf, port) < 0)
+ goto no_memory;
+ } else if (virAsprintf(&ret, "%s:%d", buf, port) < 0) {
+ goto no_memory;
+ }
+
+cleanup:
+ if (res)
+ freeaddrinfo(res);
+ VIR_FREE(buf);
+ VIR_FREE(portstr);
+ return ret;
+
+no_memory:
+ virReportOOMError();
+ goto cleanup;
+}
+
#ifdef HAVE_GETPWUID_R
enum {
VIR_USER_ENT_DIRECTORY,
diff --git a/src/util/virutil.h b/src/util/virutil.h
index 280a18d..93f4007 100644
--- a/src/util/virutil.h
+++ b/src/util/virutil.h
@@ -27,8 +27,10 @@
# include "verify.h"
# include "internal.h"
+# include <netdb.h>
# include <unistd.h>
# include <sys/select.h>
+# include <sys/socket.h>
# include <sys/types.h>
# ifndef MIN
@@ -108,6 +110,8 @@ static inline int getgid (void) { return 0; }
# endif
char *virGetHostname(void);
+char *virGetConnectableIPAsString(const char *host,
+ int port);
char *virGetUserDirectory(void);
char *virGetUserConfigDirectory(void);
--
1.8.1.5
11 years, 5 months
[libvirt] [PATCH] maint: don't use config.h in .h files
by Eric Blake
Enforce the rule that .h files don't need to (redundantly)
include <config.h>.
* cfg.mk (sc_prohibit_config_h_in_headers): New rule.
(_virsh_includes): Delete; instead, inline a smaller number of
exclusions...
(exclude_file_name_regexp--sc_require_config_h)
(exclude_file_name_regexp--sc_require_config_h_first): ...here.
* daemon/libvirtd.h (includes): Fix offenders.
* src/driver.h (includes): Likewise.
* src/gnutls_1_0_compat.h (includes): Likewise.
* src/libxl/libxl_conf.h (includes): Likewise.
* src/libxl/libxl_driver.h (includes): Likewise.
* src/lxc/lxc_conf.h (includes): Likewise.
* src/lxc/lxc_driver.h (includes): Likewise.
* src/lxc/lxc_fuse.h (includes): Likewise.
* src/network/bridge_driver.h (includes): Likewise.
* src/phyp/phyp_driver.h (includes): Likewise.
* src/qemu/qemu_conf.h (includes): Likewise.
* src/util/virnetlink.h (includes): Likewise.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Not a build-breaker, and not trivial enough to push without
review; but it should have no impact on the resulting binary
so it is safe for 1.0.6 if I get a review in time.
cfg.mk | 16 +++++++++++++---
daemon/libvirtd.h | 4 +---
src/driver.h | 2 --
src/gnutls_1_0_compat.h | 4 +---
src/libxl/libxl_conf.h | 2 --
src/libxl/libxl_driver.h | 2 --
src/lxc/lxc_conf.h | 4 +---
src/lxc/lxc_driver.h | 2 --
src/lxc/lxc_fuse.h | 1 -
src/network/bridge_driver.h | 4 +---
src/phyp/phyp_driver.h | 3 +--
src/qemu/qemu_conf.h | 2 --
src/util/virnetlink.h | 3 +--
13 files changed, 19 insertions(+), 30 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index 4ffa020..c093bf2 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -797,6 +797,15 @@ sc_prohibit_include_public_headers_brackets:
halt='Do not include libvirt/*.h in internal source' \
$(_sc_search_regexp)
+# <config.h> is only needed in .c files; .h files do not need it since
+# .c files must include config.h before any other .h.
+sc_prohibit_config_h_in_headers:
+ @prohibit='^# *include\>.*config\.h' \
+ in_vc_files='\.h$$' \
+ halt='headers should not include <config.h>' \
+ $(_sc_search_regexp)
+
+
# We don't use this feature of maint.mk.
prev_version_file = /dev/null
@@ -937,10 +946,11 @@ exclude_file_name_regexp--sc_prohibit_xmlURI = ^src/util/viruri\.c$$
exclude_file_name_regexp--sc_prohibit_return_as_function = \.py$$
-_virsh_includes=(edit|domain-monitor|domain|volume|pool|network|interface|nwfilter|secret|snapshot|host|nodedev)
-exclude_file_name_regexp--sc_require_config_h = ^(examples/|tools/virsh-$(_virsh_includes)\.c$$)
+exclude_file_name_regexp--sc_require_config_h = \
+ ^(examples/|tools/virsh-edit\.c$$)
-exclude_file_name_regexp--sc_require_config_h_first = ^(examples/|tools/virsh-$(_virsh_includes)\.c$$)
+exclude_file_name_regexp--sc_require_config_h_first = \
+ ^(examples/|tools/virsh-edit\.c$$)
exclude_file_name_regexp--sc_trailing_blank = \
(/qemuhelpdata/|/sysinfodata/.*\.data|\.(fig|gif|ico|png)$$)
diff --git a/daemon/libvirtd.h b/daemon/libvirtd.h
index c07637a..d0afdc8 100644
--- a/daemon/libvirtd.h
+++ b/daemon/libvirtd.h
@@ -1,7 +1,7 @@
/*
* libvirtd.h: daemon data structure definitions
*
- * Copyright (C) 2006-2012 Red Hat, Inc.
+ * Copyright (C) 2006-2013 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -27,8 +27,6 @@
# define VIR_ENUM_SENTINELS
-# include <config.h>
-
# include <rpc/types.h>
# include <rpc/xdr.h>
# include "remote_protocol.h"
diff --git a/src/driver.h b/src/driver.h
index e998adf..ec5fc53 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -22,8 +22,6 @@
#ifndef __VIR_DRIVER_H__
# define __VIR_DRIVER_H__
-# include "config.h"
-
# include <unistd.h>
# include "internal.h"
diff --git a/src/gnutls_1_0_compat.h b/src/gnutls_1_0_compat.h
index 217bc8c..b006e2b 100644
--- a/src/gnutls_1_0_compat.h
+++ b/src/gnutls_1_0_compat.h
@@ -1,7 +1,7 @@
/*
* gnutls_1_0_compat.h: GnuTLS 1.0 compatibility
*
- * Copyright (C) 2007 Red Hat, Inc.
+ * Copyright (C) 2007, 2013 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -23,8 +23,6 @@
#ifndef LIBVIRT_GNUTLS_1_0_COMPAT_H__
# define LIBVIRT_GNUTLS_1_0_COMPAT_H__
-# include <config.h>
-
# include <gnutls/gnutls.h>
/* enable backward compatibility macros for gnutls 1.x.y */
diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
index fed878d..44ecd41 100644
--- a/src/libxl/libxl_conf.h
+++ b/src/libxl/libxl_conf.h
@@ -25,8 +25,6 @@
#ifndef LIBXL_CONF_H
# define LIBXL_CONF_H
-# include <config.h>
-
# include <libxl.h>
# include "internal.h"
diff --git a/src/libxl/libxl_driver.h b/src/libxl/libxl_driver.h
index cb8921f..fba6c5a 100644
--- a/src/libxl/libxl_driver.h
+++ b/src/libxl/libxl_driver.h
@@ -23,8 +23,6 @@
#ifndef LIBXL_DRIVER_H
# define LIBXL_DRIVER_H
-# include <config.h>
-
int libxlRegister(void);
#endif /* LIBXL_DRIVER_H */
diff --git a/src/lxc/lxc_conf.h b/src/lxc/lxc_conf.h
index 4332fb9..5a5b9aa 100644
--- a/src/lxc/lxc_conf.h
+++ b/src/lxc/lxc_conf.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Red Hat, Inc.
+ * Copyright (C) 2010, 2013 Red Hat, Inc.
* Copyright IBM Corp. 2008
*
* lxc_conf.h: header file for linux container config functions
@@ -25,8 +25,6 @@
#ifndef LXC_CONF_H
# define LXC_CONF_H
-# include <config.h>
-
# include "internal.h"
# include "domain_conf.h"
# include "domain_event.h"
diff --git a/src/lxc/lxc_driver.h b/src/lxc/lxc_driver.h
index 113d1ce..656831c 100644
--- a/src/lxc/lxc_driver.h
+++ b/src/lxc/lxc_driver.h
@@ -24,8 +24,6 @@
#ifndef LXC_DRIVER_H
# define LXC_DRIVER_H
-# include <config.h>
-
/* Function declarations */
int lxcRegister(void);
diff --git a/src/lxc/lxc_fuse.h b/src/lxc/lxc_fuse.h
index a42c39a..b3713af 100644
--- a/src/lxc/lxc_fuse.h
+++ b/src/lxc/lxc_fuse.h
@@ -26,7 +26,6 @@
# define FUSE_USE_VERSION 26
-# include <config.h>
# if WITH_FUSE
# include <fuse.h>
# endif
diff --git a/src/network/bridge_driver.h b/src/network/bridge_driver.h
index 4bf64ea..50258b5 100644
--- a/src/network/bridge_driver.h
+++ b/src/network/bridge_driver.h
@@ -1,7 +1,7 @@
/*
* network_driver.h: core driver methods for managing networks
*
- * Copyright (C) 2006-2012 Red Hat, Inc.
+ * Copyright (C) 2006-2013 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -25,8 +25,6 @@
#ifndef __VIR_NETWORK__DRIVER_H
# define __VIR_NETWORK__DRIVER_H
-# include <config.h>
-
# include "internal.h"
# include "network_conf.h"
# include "domain_conf.h"
diff --git a/src/phyp/phyp_driver.h b/src/phyp/phyp_driver.h
index 59a4370..ad05b15 100644
--- a/src/phyp/phyp_driver.h
+++ b/src/phyp/phyp_driver.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Red Hat, Inc.
+ * Copyright (C) 2010, 2013 Red Hat, Inc.
* Copyright IBM Corp. 2009
*
* phyp_driver.c: ssh layer to access Power Hypervisors
@@ -27,7 +27,6 @@
# include "conf/capabilities.h"
# include "conf/domain_conf.h"
-# include <config.h>
# include <libssh2.h>
# define LPAR_EXEC_ERR -1
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 42566b4..19893c8 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -24,8 +24,6 @@
#ifndef __QEMUD_CONF_H
# define __QEMUD_CONF_H
-# include <config.h>
-
# include "virebtables.h"
# include "internal.h"
# include "capabilities.h"
diff --git a/src/util/virnetlink.h b/src/util/virnetlink.h
index 9a69a0b..8351000 100644
--- a/src/util/virnetlink.h
+++ b/src/util/virnetlink.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2012 Red Hat, Inc.
+ * Copyright (C) 2010-2013 Red Hat, Inc.
* Copyright (C) 2010-2012 IBM Corporation
*
* This library is free software; you can redistribute it and/or
@@ -20,7 +20,6 @@
#ifndef __VIR_NETLINK_H__
# define __VIR_NETLINK_H__
-# include "config.h"
# include "internal.h"
# include "virmacaddr.h"
--
1.8.1.4
11 years, 5 months
[libvirt] [PATCH 0/3] Support --allocate and --shrink for vol-resize
by Osier Yang
https://bugzilla.redhat.com/show_bug.cgi?id=804516
Though the bug's title is about the document, but I prefer to implement
it instead of changing document. Those two flags were added long time
ago, but never implemented, it's not good to say they are not supported
now while they were already exposed outside.
A few examples of vol-resize with the patches:
1) Create 5M a parse vol
% dd of=/var/lib/libvirt/images/sparse.raw bs=1k seek=5120 count=0
0+0 records in
0+0 records out
0 bytes (0 B) copied, 7.904e-06 s, 0.0 kB/s
% ./tools/virsh pool-refresh default
Pool default refreshed
%s ./tools/virsh vol-info /var/lib/libvirt/images/sparse.raw
Name: sparse.raw
Type: file
Capacity: 5.00 MiB
Allocation: 0.00 B
2) Resize the vol to 6M with --allocate, I.E. The capacity (5M - 6M) is
preallocated.
% ./tools/virsh vol-resize /var/lib/libvirt/images/sparse.raw 6M --allocate
Size of volume 'sparse.raw' successfully changed to 6M
% ./tools/virsh vol-info /var/lib/libvirt/images/sparse.raw
Name: sparse.raw
Type: file
Capacity: 6.00 MiB
Allocation: 1.00 MiB
3) Resize the vol to 7M without --allocate. I.E. The new 1M capacity
(6M - 7M) is sparse.
% ./tools/virsh vol-resize /var/lib/libvirt/images/sparse.raw 7M
Size of volume 'sparse.raw' successfully changed to 7M
%s ./tools/virsh vol-info /var/lib/libvirt/images/sparse.raw
Name: sparse.raw
Type: file
Capacity: 7.00 MiB
Allocation: 1.00 MiB
3) Resize the vol to 8M with --allocate, I.E. The new 1 M capacity
(7M - 8M) is preallocated
% ./tools/virsh vol-resize /var/lib/libvirt/images/sparse.raw 8M --allocate
Size of volume 'sparse.raw' successfully changed to 8M
% ./tools/virsh vol-info /var/lib/libvirt/images/sparse.raw
Name: sparse.raw
Type: file
Capacity: 8.00 MiB
Allocation: 2.00 MiB
======
Now the parse file's allocation is like:
0 5 6 7 8
-----------------------------------------------------------------
| zero | allocated | zero | allocated |
-----------------------------------------------------------------
%s ./tools/virsh vol-resize /var/lib/libvirt/images/sparse.raw 6M --shrink
Size of volume 'sparse.raw' successfully changed to 6M
%s ./tools/virsh vol-info /var/lib/libvirt/images/sparse.raw
Name: sparse.raw
Type: file
Capacity: 6.00 MiB
Allocation: 1.00 MiB
=====
The vol still get 1M preallocate space kept, expected.
Osier Yang (3):
storage: Support preallocate the new capacity for vol-resize
storage: Forbid to shrink the vol's capacity if no --shrink is
specified
storage: Allow --shrink for raw type volume of fs pool
src/storage/storage_backend_fs.c | 22 ++++++++++++++++++----
src/storage/storage_driver.c | 12 +++++++++++-
src/util/virstoragefile.c | 39 ++++++++++++++++++++++++++++++++++++---
src/util/virstoragefile.h | 6 +++++-
4 files changed, 70 insertions(+), 9 deletions(-)
--
1.8.1.4
11 years, 5 months
[libvirt] NBD drives with literal IPv6 addresses or hostnames starting with a digit
by Ján Tomko
Hello,
since qemu's commit v1.4.0-736-gf17c90b [1]:
nbd: Keep hostname and port separate
* literal IPv6 addresses no longer work in nbd URIs, because getaddrinfo is
called with the surrounding brackets:
$ qemu-system-x86_64 -drive file=nbd://[::1]:1234/quack
qemu-system-x86_64: -drive file=nbd://[::1]:1234/quack: address resolution
failed for [::1]:1234: Name or service not known
* hostnames starting with a digit now work in nbd URIs.
Before that, or with the non-URI syntax, they fail because inet_parse assumes
them to be literal IPv4 addresses:
$ qemu-system-x86_64 -drive file=nbd:123flour:1234:exportname=gashunk
qemu-system-x86_64: -drive file=nbd:123flour:1234:exportname=gashunk: error
parsing IPv4 address '123flour:1234'
In libvirt, we use the URI format on the command line only if the host
contains ':', so hostnames starting with a digit still don't work.
Migration with NBD and a literal IPv6 address doesn't work either, but that's
purely libvirt's fault, as we don't escape it with brackets. I've just posted
a patch for that. [2]
Jan
[1] http://git.qemu.org/?p=qemu.git;a=commitdiff;h=f17c90b
[2] https://www.redhat.com/archives/libvir-list/2013-May/msg02022.html
11 years, 5 months
[libvirt] need custom /dev entries in LXC
by Michael R. Hines
Hi,
We run nvidia devices inside libvirt-managed LXC containers.
It used to be that simply doing:
$ echo 'c 195:* rwm' > /sys/fs/cgroup/devices/libvirt/lxc
Then, after booting the container, we would do:
$ mknod -m 666 /dev/nvidia0 c 195 0
.... would be good enough to run our CUDA applications.
But, according to:
$ cat src/lxc/lxc_container.c
The CAP_MKNOD capability is being dropped and only a specific
set of devices is being created before booting the container.
Is there any reason why this is not per-device configurable?
Thanks,
- Michael R. Hines
11 years, 5 months