[libvirt] [PATCH] build: fix build without posix_fallocate
by Eric Blake
Such as on FreeBSD. Broken in commit aa2a4cff7
* src/util/virstoragefile.c (virStorageFileResize): Add missing ';'.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Pushing under the build-breaker rule.
src/util/virstoragefile.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index bf668c8..b861fd8 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -1074,7 +1074,7 @@ virStorageFileResize(const char *path,
}
#else
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
- _("preallocate is not supported on this platform"))
+ _("preallocate is not supported on this platform"));
goto cleanup;
#endif
} else {
--
1.8.1.4
11 years, 5 months
[libvirt] [PATCH v4 0/5] libvirt supports Guest Panicked
by Chen Fan
Changes:
v3-v4: 1. Supports the dumpcore options of the oncrash element in the XML.
2. Move the previous code to processWatchdogEvent().
v2-v3: 1. split into 3 patches
v1-v2: 1. fix the incorrect domain state: paused -> crashed, when crash
the guest while libvirt isn't running, then restart libvirtd.
Chen Fan (5):
libvirt: Define domain crash event types
qemu: Supports guest panicked
virsh: supports guest panicked
libvirt: Define crash dumpcore events in watchdogAction.
qemu: Implement the oncrash events in processWatchdogEvent.
examples/domain-events/events-c/event-test.c | 10 ++
include/libvirt/libvirt.h.in | 16 +++
src/conf/domain_conf.c | 16 ++-
src/conf/domain_conf.h | 4 +
src/qemu/qemu_driver.c | 197 +++++++++++++++++++++------
src/qemu/qemu_monitor.c | 14 +-
src/qemu/qemu_monitor.h | 5 +
src/qemu/qemu_monitor_json.c | 7 +
src/qemu/qemu_process.c | 127 ++++++++++++++---
src/qemu/qemu_process.h | 2 +
tools/virsh-domain-monitor.c | 8 ++
11 files changed, 338 insertions(+), 68 deletions(-)
--
1.8.1.4
11 years, 5 months
[libvirt] Serial port creation issue
by arvind viswanathan
Hi,
I have a serial port defined in vm config file. However after I create the
vm using virsh, I notice that the serial ports I have specified translate
to -chardev when kvm-quemu is called. I am having trouble accessing the vm
if it is configured as a chardev with isserial option. If i can directly
call the qemu with -serial, I can access the vm,
thanks
arvind
11 years, 5 months
[libvirt] [PATCH] qemu: Reformat listen address prior checking
by Michal Privoznik
Currently, a listen address for a SPICE server can be specified. Later,
when the domain is migrated, we need to relocate the graphics which
involves telling new destination to the SPICE server. However, we can't
just assume the listen address is the new location, because the listen
address can be ANYCAST (0.0.0.0 for IPv4, :: for IPv6). In which case,
we want to pass the remote hostname. But there are some troubles with
ANYCAST. In both IPv4 and IPv6 it has many ways for specifying such
address. For instance, in IPv4: 0, 0.0, 0.0.0, 0.0.0.0. The number of
variations gets bigger in IPv6 world. Hence, in order to check for
ANYCAST address sanely, we should take the provided listen address,
parse it and format back in it's full form. Which is exactly what this
patch does.
---
src/qemu/qemu_migration.c | 18 +++++++++++++++++-
tests/sockettest.c | 24 ++++++++++++++++++++++++
2 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 7aa0476..3ca3f32 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1735,42 +1735,58 @@ static int
qemuDomainMigrateGraphicsRelocate(virQEMUDriverPtr driver,
virDomainObjPtr vm,
qemuMigrationCookiePtr cookie)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
int ret;
char *listenAddress;
+ virSocketAddr addr;
+ bool reformatted = false;
if (!cookie)
return 0;
if (!cookie->graphics)
return 0;
/* QEMU doesn't support VNC relocation yet, so
* skip it to avoid generating an error
*/
if (cookie->graphics->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE)
return 0;
listenAddress = cookie->graphics->listen;
+
+ /* Okay, here's the magic: some mgmt applications set bare '0' as listen
+ * address. On the other hand, it's a valid IPv4 address. This means, we
+ * need to reformat the address so the if statement below can check just
+ * for two ANYCAST addresses and not all their variants. */
+ if (listenAddress &&
+ virSocketAddrParse(&addr, listenAddress, AF_UNSPEC) > 0) {
+ listenAddress = virSocketAddrFormat(&addr);
+ reformatted = true;
+ }
+
if (!listenAddress ||
STREQ(listenAddress, "0.0.0.0") ||
- STREQ(listenAddress, "::"))
+ STREQ(listenAddress, "::")) {
+ if (reformatted)
+ VIR_FREE(listenAddress);
listenAddress = cookie->remoteHostname;
+ }
ret = qemuDomainObjEnterMonitorAsync(driver, vm,
QEMU_ASYNC_JOB_MIGRATION_OUT);
if (ret == 0) {
ret = qemuMonitorGraphicsRelocate(priv->mon,
cookie->graphics->type,
listenAddress,
cookie->graphics->port,
cookie->graphics->tlsPort,
cookie->graphics->tlsSubject);
qemuDomainObjExitMonitor(driver, vm);
}
return ret;
}
diff --git a/tests/sockettest.c b/tests/sockettest.c
index 156ef45..5b36a6c 100644
--- a/tests/sockettest.c
+++ b/tests/sockettest.c
@@ -162,96 +162,120 @@ static int
mymain(void)
{
int ret = 0;
/* Some of our tests deliberately test failure cases, so
* register a handler to stop error messages cluttering
* up display
*/
if (!virTestGetDebug())
virSetErrorFunc(NULL, testQuietError);
#define DO_TEST_PARSE(addrstr, family, pass) \
do { \
virSocketAddr addr; \
struct testParseData data = { &addr, addrstr, family, pass }; \
memset(&addr, 0, sizeof(addr)); \
if (virtTestRun("Test parse " addrstr, \
1, testParseHelper, &data) < 0) \
ret = -1; \
} while (0)
#define DO_TEST_PARSE_AND_FORMAT(addrstr, family, pass) \
do { \
virSocketAddr addr; \
struct testParseData data = { &addr, addrstr, family, pass }; \
memset(&addr, 0, sizeof(addr)); \
if (virtTestRun("Test parse " addrstr " family " #family, \
1, testParseHelper, &data) < 0) \
ret = -1; \
struct testFormatData data2 = { &addr, addrstr, pass }; \
if (virtTestRun("Test format " addrstr " family " #family, \
1, testFormatHelper, &data2) < 0) \
ret = -1; \
} while (0)
+#define DO_TEST_PARSE_AND_CHECK_FORMAT(addrstr, addrformated, family, pass) \
+ do { \
+ virSocketAddr addr; \
+ struct testParseData data = { &addr, addrstr, family, true}; \
+ memset(&addr, 0, sizeof(addr)); \
+ if (virtTestRun("Test parse " addrstr " family " #family, \
+ 1, testParseHelper, &data) < 0) \
+ ret = -1; \
+ struct testFormatData data2 = { &addr, addrformated, pass }; \
+ if (virtTestRun("Test format " addrstr " family " #family, \
+ 1, testFormatHelper, &data2) < 0) \
+ ret = -1; \
+ } while (0)
+
#define DO_TEST_RANGE(saddr, eaddr, size, pass) \
do { \
struct testRangeData data = { saddr, eaddr, size, pass }; \
if (virtTestRun("Test range " saddr " -> " eaddr " size " #size, \
1, testRangeHelper, &data) < 0) \
ret = -1; \
} while (0)
#define DO_TEST_NETMASK(addr1, addr2, netmask, pass) \
do { \
struct testNetmaskData data = { addr1, addr2, netmask, pass }; \
if (virtTestRun("Test netmask " addr1 " + " addr2 " in " netmask, \
1, testNetmaskHelper, &data) < 0) \
ret = -1; \
} while (0)
DO_TEST_PARSE_AND_FORMAT("127.0.0.1", AF_UNSPEC, true);
DO_TEST_PARSE_AND_FORMAT("127.0.0.1", AF_INET, true);
DO_TEST_PARSE_AND_FORMAT("127.0.0.1", AF_INET6, false);
DO_TEST_PARSE_AND_FORMAT("127.0.0.1", AF_UNIX, false);
DO_TEST_PARSE_AND_FORMAT("127.0.0.256", AF_UNSPEC, false);
+ DO_TEST_PARSE_AND_CHECK_FORMAT("127.0.0.2", "127.0.0.2", AF_INET, true);
+ DO_TEST_PARSE_AND_CHECK_FORMAT("127.0.0.2", "127.0.0.3", AF_INET, false);
+ DO_TEST_PARSE_AND_CHECK_FORMAT("0", "0.0.0.0", AF_INET, true);
+ DO_TEST_PARSE_AND_CHECK_FORMAT("127", "0.0.0.127", AF_INET, true);
+ DO_TEST_PARSE_AND_CHECK_FORMAT("127", "127.0.0.0", AF_INET, false);
+ DO_TEST_PARSE_AND_CHECK_FORMAT("127.2", "127.0.0.2", AF_INET, true);
+ DO_TEST_PARSE_AND_CHECK_FORMAT("127.2", "127.2.0.0", AF_INET, false);
+ DO_TEST_PARSE_AND_CHECK_FORMAT("1.2.3", "1.2.0.3", AF_INET, true);
+ DO_TEST_PARSE_AND_CHECK_FORMAT("1.2.3", "1.2.3.0", AF_INET, false);
+
DO_TEST_PARSE_AND_FORMAT("::1", AF_UNSPEC, true);
DO_TEST_PARSE_AND_FORMAT("::1", AF_INET, false);
DO_TEST_PARSE_AND_FORMAT("::1", AF_INET6, true);
DO_TEST_PARSE_AND_FORMAT("::1", AF_UNIX, false);
DO_TEST_PARSE_AND_FORMAT("::ffff", AF_UNSPEC, true);
DO_TEST_RANGE("192.168.122.1", "192.168.122.1", 1, true);
DO_TEST_RANGE("192.168.122.1", "192.168.122.20", 20, true);
DO_TEST_RANGE("192.168.122.0", "192.168.122.255", 256, true);
DO_TEST_RANGE("192.168.122.20", "192.168.122.1", -1, false);
DO_TEST_RANGE("10.0.0.1", "192.168.122.20", -1, false);
DO_TEST_RANGE("192.168.122.20", "10.0.0.1", -1, false);
DO_TEST_RANGE("2000::1", "2000::1", 1, true);
DO_TEST_RANGE("2000::1", "2000::2", 2, true);
DO_TEST_RANGE("2000::2", "2000::1", -1, false);
DO_TEST_RANGE("2000::1", "9001::1", -1, false);
DO_TEST_NETMASK("192.168.122.1", "192.168.122.2",
"255.255.255.0", true);
DO_TEST_NETMASK("192.168.122.1", "192.168.122.4",
"255.255.255.248", true);
DO_TEST_NETMASK("192.168.122.1", "192.168.123.2",
"255.255.255.0", false);
DO_TEST_NETMASK("192.168.122.1", "192.168.123.2",
"255.255.0.0", true);
DO_TEST_NETMASK("2000::1:1", "2000::1:1",
"ffff:ffff:ffff:ffff:ffff:ffff:ffff:0", true);
DO_TEST_NETMASK("2000::1:1", "2000::2:1",
"ffff:ffff:ffff:ffff:ffff:ffff:ffff:0", false);
DO_TEST_NETMASK("2000::1:1", "2000::2:1",
"ffff:ffff:ffff:ffff:ffff:ffff:fff8:0", true);
DO_TEST_NETMASK("2000::1:1", "9000::1:1",
"ffff:ffff:ffff:ffff:ffff:ffff:ffff:0", false);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
--
1.8.2.1
11 years, 5 months
[libvirt] [PATCH] Fix a invalid usage of virDomainNetDef in OpenVZ driver
by Alvaro Polo
OpenVZ was accessing ethernet data to obtain the guest iface name
regardless the domain is configured to use ethernet or bridged
networking. This prevented the guest network interface to be rightly
named for bridged networking.
---
src/openvz/openvz_driver.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index c8081ce..db738a4 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -815,6 +815,7 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *vpsid,
char host_macaddr[VIR_MAC_STRING_BUFLEN];
struct openvz_driver *driver = conn->privateData;
virCommandPtr cmd = NULL;
+ char *guest_ifname = NULL;
if (net == NULL)
return 0;
@@ -840,11 +841,15 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *vpsid,
virBuffer buf = VIR_BUFFER_INITIALIZER;
int veid = openvzGetVEID(vpsid);
- /* if user doesn't specify guest interface name,
- * then we need to generate it */
- if (net->data.ethernet.dev == NULL) {
- net->data.ethernet.dev = openvzGenerateContainerVethName(veid);
- if (net->data.ethernet.dev == NULL) {
+ /* if net is ethernet and the user has specified guest interface name,
+ * let's use it; otherwise generate a new one */
+ if (net->type == VIR_DOMAIN_NET_TYPE_ETHERNET &&
+ net->data.ethernet.dev != NULL) {
+ if (VIR_STRDUP(guest_ifname, net->data.ethernet.dev) == -1)
+ goto cleanup;
+ } else {
+ guest_ifname = openvzGenerateContainerVethName(veid);
+ if (guest_ifname == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Could not generate eth name for container"));
goto cleanup;
@@ -862,7 +867,7 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *vpsid,
}
}
- virBufferAdd(&buf, net->data.ethernet.dev, -1); /* Guest dev */
+ virBufferAdd(&buf, guest_ifname, -1); /* Guest dev */
virBufferAsprintf(&buf, ",%s", macaddr); /* Guest dev mac */
virBufferAsprintf(&buf, ",%s", net->ifname); /* Host dev */
virBufferAsprintf(&buf, ",%s", host_macaddr); /* Host dev mac */
@@ -871,7 +876,7 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *vpsid,
if (driver->version >= VZCTL_BRIDGE_MIN_VERSION) {
virBufferAsprintf(&buf, ",%s", net->data.bridge.brname); /* Host bridge */
} else {
- virBufferAsprintf(configBuf, "ifname=%s", net->data.ethernet.dev);
+ virBufferAsprintf(configBuf, "ifname=%s", guest_ifname);
virBufferAsprintf(configBuf, ",mac=%s", macaddr); /* Guest dev mac */
virBufferAsprintf(configBuf, ",host_ifname=%s", net->ifname); /* Host dev */
virBufferAsprintf(configBuf, ",host_mac=%s", host_macaddr); /* Host dev mac */
@@ -895,6 +900,7 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *vpsid,
cleanup:
virCommandFree(cmd);
+ VIR_FREE(guest_ifname);
return rc;
}
--
1.7.12.4 (Apple Git-37)
11 years, 5 months
[libvirt] [PATCH] qemu.conf: update vnc_password docs
by Ján Tomko
QEMU does accept empty VNC passwords now and allows anyone
to connect with an empty password.
https://bugzilla.redhat.com/show_bug.cgi?id=969542
---
src/qemu/qemu.conf | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index cdf1ec4..49ef75f 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -62,9 +62,9 @@
# VNC passwords. This parameter is only used if the per-domain
# XML config does not already provide a password. To allow
# access without passwords, leave this commented out. An empty
-# string will still enable passwords, but be rejected by QEMU,
-# effectively preventing any use of VNC. Obviously change this
-# example here before you set this.
+# string might either prevent any use of VNC or allow access
+# with an empty password depending on QEMU version. Obviously
+# change this example here before you set this.
#
#vnc_password = "XYZ12345"
--
1.8.1.5
11 years, 5 months
[libvirt] [PATCH 0/4] Cleanup storage volume creation and tests and provide better error messages
by Peter Krempa
This series cleans up a few aspects when creating storage volumes and
adds error messages if the metadata preallocation flag is not supported.
Peter Krempa (4):
storagevolxml2argvtest: Report better error messages on test failure
storage: Clean up function header and reflow error message
storage: Avoid unnecessary ternary operators and refactor the code
storage: Provide better error message if metadata pre-alloc is
unsupported
src/storage/storage_backend.c | 132 +++++++++++++++++++++++------------------
tests/storagevolxml2argvtest.c | 7 ++-
2 files changed, 77 insertions(+), 62 deletions(-)
--
1.8.2.1
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