[libvirt] [PATCH] build: fix build with older gcc
by Eric Blake
gcc 4.1.2 (hello, RHEL 5!) fails to build on 32-bit platforms with:
conf/domain_conf.c: In function 'virDomainDefParseXML':
conf/domain_conf.c:10581: warning: integer constant is too large for 'long' type
* src/conf/domain_conf.c (virDomainDefParseXML): Mark large constants.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/conf/domain_conf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a9656af..2b4e160 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10578,7 +10578,7 @@ virDomainDefParseXML(xmlDocPtr xml,
if (def->cputune.quota > 0 &&
(def->cputune.quota < 1000 ||
- def->cputune.quota > 18446744073709551)) {
+ def->cputune.quota > 18446744073709551LL)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Value of cputune quota must be in range "
"[1000, 18446744073709551]"));
@@ -10610,7 +10610,7 @@ virDomainDefParseXML(xmlDocPtr xml,
if (def->cputune.emulator_quota > 0 &&
(def->cputune.emulator_quota < 1000 ||
- def->cputune.emulator_quota > 18446744073709551)) {
+ def->cputune.emulator_quota > 18446744073709551LL)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Value of cputune emulator_quota must be in range "
"[1000, 18446744073709551]"));
--
1.8.1.4
11 years, 6 months
[libvirt] [PATCH] build: drop unused variable
by Eric Blake
Compilation for mingw failed:
../../src/util/virutil.c: In function 'virGetWin32DirectoryRoot':
../../src/util/virutil.c:1094:9: error: unused variable 'ret' [-Werror=unused-variable]
* src/util/virutil.c (virGetWin32DirectoryRoot): Silence compiler
warning.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Compilation still fails in the tests directory, due to the use of
fprintf(stderr, "%zu", size_t); I'm still debating whether I can
get it fixed in gnulib and take the risk of a gnulib backport before
rc2, or whether we'll have to come up with some other less-invasive
workaround.
src/util/virutil.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 028f1d1..a29da14 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -1091,7 +1091,6 @@ static int
virGetWin32DirectoryRoot(char **path)
{
char windowsdir[MAX_PATH];
- int ret = 0;
*path = NULL;
--
1.8.1.4
11 years, 6 months
[libvirt] [PATCH 0/2]write separate module for hostdev passthrough
by Chunyan Liu
This patch sets include two patches:
1/2 is the implementation of the hostdev passthrough common library.
To meet two purposes:
a. move qemu hostdev APIs to common library so that it could be used by all
hypervisor drivers.
b. maintain a global hostdev in-use state.
2/2 is the implementation of pci passthrough to libxl driver.
There should be more patches to change qemu driver and lxc driver codes to
switch to common library APIs, but I think it's better to have you review the
common library first. After common library APIs confirmed, then modify qemu/lxc
driver codes in a time. The implementation to libxl driver (2/2) is an example
of using common library.
Please review, thanks!
Chunyan Liu (2):
add pci passthrough common library
add pci passthrough impl to libxl
po/POTFILES.in | 1 +
src/Makefile.am | 1 +
src/libvirt.c | 5 +
src/libvirt_private.syms | 15 +
src/libxl/libxl_conf.c | 44 ++
src/libxl/libxl_driver.c | 21 +-
src/util/virhostdevmanager.c | 1218 ++++++++++++++++++++++++++++++++++++++++++
src/util/virhostdevmanager.h | 91 ++++
src/util/virpci.c | 17 +-
src/util/virpci.h | 7 +-
src/util/virusb.c | 19 +-
src/util/virusb.h | 4 +-
12 files changed, 1426 insertions(+), 17 deletions(-)
create mode 100644 src/util/virhostdevmanager.c
create mode 100644 src/util/virhostdevmanager.h
11 years, 6 months
[libvirt] [PATCH] syntax: fix broken error message in previous patch
by Eric Blake
Osier Yang pointed out that I introduced a syntax error in my
syntax check (I really shouldn't make last-minute changes without
testing them....).
/bin/sh: -c: line 2: syntax error near unexpected token `;'
/bin/sh: -c: line 2: ` { echo 'maint.mk: incorrect whitespace, see HACKING for rules' 2>&; \'
make: *** [bracket-spacing-check] Error 1
* cfg.mk (bracket-spacing-check): Fix copy-and-paste error.
(sc_prohibit_duplicate_header): Use consistent spelling.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Pushing under the build-breaker rule.
cfg.mk | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index a01df56..4ffa020 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -779,7 +779,7 @@ sc_prohibit_duplicate_header:
}' $$i || fail=1; \
done; \
if test $$fail -eq 1; then \
- { echo "$(ME)": avoid duplicate headers >&2; exit 1; } \
+ { echo '$(ME): avoid duplicate headers' 1>&2; exit 1; } \
fi;
# Don't include "libvirt/*.h" in "" form.
@@ -845,7 +845,7 @@ syntax-check: $(top_srcdir)/HACKING bracket-spacing-check
bracket-spacing-check:
$(AM_V_GEN)files=`$(VC_LIST) | grep '\.c$$'`; \
$(PERL) $(top_srcdir)/build-aux/bracket-spacing.pl $$files || \
- { echo "$(ME): incorrect whitespace, see HACKING for rules" 2>&; \
+ { echo '$(ME): incorrect whitespace, see HACKING for rules' 1>&2; \
exit 1; }
# sc_po_check can fail if generated files are not built first
--
1.8.1.4
11 years, 6 months
[libvirt] [PATCH 0/2] More semicolon cleanups
by Eric Blake
In response to:
https://www.redhat.com/archives/libvir-list/2013-May/msg01791.html
Eric Blake (2):
syntax: prefer space after semicolon in for loop
syntax-check: mandate space after mid-line semicolon
HACKING | 23 +++++++++++++++++++++++
build-aux/bracket-spacing.pl | 12 ++++++++++++
cfg.mk | 2 +-
docs/hacking.html.in | 29 +++++++++++++++++++++++++++++
examples/domsuspend/suspend.c | 2 +-
python/libvirt-override.c | 38 +++++++++++++++++++-------------------
src/conf/interface_conf.c | 14 +++++++-------
src/security/virt-aa-helper.c | 2 +-
src/util/virconf.c | 4 ++--
src/util/virhook.c | 2 +-
src/util/virlog.c | 10 +++++-----
src/util/virsocketaddr.c | 12 ++++++------
src/util/virsysinfo.c | 4 ++--
src/util/viruuid.c | 4 ++--
src/vbox/vbox_tmpl.c | 11 ++++++++---
src/xen/xen_hypervisor.c | 3 ++-
tools/virsh-domain-monitor.c | 6 +++---
tools/virsh-domain.c | 6 +++---
18 files changed, 127 insertions(+), 57 deletions(-)
--
1.8.1.4
11 years, 6 months
[libvirt] [PATCH] qemu: Don't report error on successful media eject
by Cole Robinson
If we are just ejecting media, ret == -1 even after the retry loop
determines that the tray is open, as requested. This means media
disconnect always report's error.
Fix it, and fix some other mini issues:
- Don't overwrite the 'eject' error message if the retry loop fails
- Move the retries decrement inside the loop, otherwise the final loop
might succeed, yet retries == 0 and we will raise error
- Setting ret = -1 in the disk->src check is unneeded
- Fix comment typos
cc: mprivozn(a)redhat.com
---
src/qemu/qemu_hotplug.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 1ed61db..3b277ef 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -98,10 +98,11 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
virObjectRef(vm);
/* we don't want to report errors from media tray_open polling */
- while (retries--) {
+ while (retries) {
if (origdisk->tray_status == VIR_DOMAIN_DISK_TRAY_OPEN)
break;
+ retries--;
virObjectUnlock(vm);
VIR_DEBUG("Waiting 500ms for tray to open. Retries left %d", retries);
usleep(500 * 1000); /* sleep 500ms */
@@ -109,19 +110,20 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
}
virObjectUnref(vm);
- if (disk->src) {
- /* deliberately don't depend on 'ret' as 'eject' may have failed for the
- * fist time and we are gonna check the drive state anyway */
- const char *format = NULL;
-
- /* We haven't succeeded yet */
- ret = -1;
-
- if (retries <= 0) {
+ if (retries <= 0) {
+ if (ret == 0) {
+ /* If ret == -1, EjectMedia already set an error message */
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
- _("Unable to eject media before changing it"));
- goto audit;
+ _("Unable to eject media"));
}
+ goto audit;
+ }
+ ret = 0;
+
+ if (disk->src) {
+ /* deliberately don't depend on 'ret' as 'eject' may have failed the
+ * first time and we are gonna check the drive state anyway */
+ const char *format = NULL;
if (disk->type != VIR_DOMAIN_DISK_TYPE_DIR) {
if (disk->format > 0)
--
1.8.2.1
11 years, 6 months
[libvirt] [libvirt-tck PATCH] 121-block-info.t: omit network
by Guido Günther
qemu:///session doesn't have a default network so we fail with:
./scripts/domain/121-block-info.t .. 1/29 # Defining transient storage pool
# Generic guest with pervious created vol
./scripts/domain/121-block-info.t .. 12/29
# Failed test 'Create domain'
# at /var/lib/jenkins/jobs/libvirt-tck-build/workspace/lib//Sys/Virt/TCK.pm line 803.
# expected Sys::Virt::Domain object
# found 'libvirt error code: 43, message: Network not found: no network with matching name 'default'
# '
The network isn't needed so simply leave it out.
---
scripts/domain/121-block-info.t | 1 -
1 file changed, 1 deletion(-)
diff --git a/scripts/domain/121-block-info.t b/scripts/domain/121-block-info.t
index a25d075..dad00c6 100644
--- a/scripts/domain/121-block-info.t
+++ b/scripts/domain/121-block-info.t
@@ -91,7 +91,6 @@ $guest->rmdisk();
$guest->disk(format => { name => "qemu", type => $disktype }, type => "file", src => $path, dst => $dst);
$guest->disk(format => { name => "qemu", type => $disktype }, type => "file", src=> $path2, dst => $dst2);
$guest->disk(format => { name => "qemu", type => "qcow2" }, type => "file", src=> $path3, dst => $dst3);
-$guest->interface(type => "network", source => "default", model => "virtio", mac => "52:54:00:22:22:22");
$xml = $guest->as_xml;
my $dom;
--
1.7.10.4
11 years, 6 months
[libvirt] snapshot-create-as Permission denied
by yue
May 25 20:50:59 ovirtdev NetworkManager[2370]: <warn> /sys/devices/virtual/net/vnet0: couldn't determine device driver; ignoring...
root@ovirtdev images]# virsh snapshot-create-as linux snapshot1 "snapshot1" --disk-only --atomic
error: internal error unable to execute QEMU command 'transaction': /var/lib/libvirt/images/test.snapshot1: error while creating qcow2: Permission denied
11 years, 6 months
[libvirt] [libvirt-tck PATCH] 121-block-info.t: allow for greater capacity/allocation
by Guido Günther
Don't be too picky about the actual size and allocation. The size needs
to be correct but it's o.k. for allocation and size to be bigger. Debian
Wheezy's qemu adds 4096 bytes.
---
scripts/domain/121-block-info.t | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/scripts/domain/121-block-info.t b/scripts/domain/121-block-info.t
index dad00c6..4c3fafc 100644
--- a/scripts/domain/121-block-info.t
+++ b/scripts/domain/121-block-info.t
@@ -103,8 +103,8 @@ is($dom->get_block_info($dst2,0)->{physical}, 1024*1024, "Get disk physical info
is($dom->get_block_info($dst,0)->{capacity}, 1024*1024*50, "Get disk capacity info");
-is($dom->get_block_info($dst,0)->{allocation}, 1024*1024*50, "Get disk allocation info");
-is($dom->get_block_info($dst,0)->{physical}, 1024*1024*50, "Get disk physical info");
+ok($dom->get_block_info($dst,0)->{allocation} >= 1024*1024*50, "Get disk allocation info");
+ok($dom->get_block_info($dst,0)->{physical} >= 1024*1024*50, "Get disk physical info");
diag "Test block_resize";
lives_ok(sub {$dom->block_resize($dst, 512*50)}, "resize to 512*50 KB");
@@ -112,8 +112,8 @@ $st = stat($path);
is($st->size, 512*1024*50, "size is 25M");
is($dom->get_block_info($dst,0)->{capacity}, 1024*512*50, "Get disk capacity info");
-is($dom->get_block_info($dst,0)->{allocation}, 1024*512*50, "Get disk allocation info");
-is($dom->get_block_info($dst,0)->{physical}, 1024*512*50, "Get disk physical info");
+ok($dom->get_block_info($dst,0)->{allocation} >= 1024*512*50, "Get disk allocation info");
+ok($dom->get_block_info($dst,0)->{physical} >= 1024*512*50, "Get disk physical info");
lives_ok(sub {$dom->block_resize($dst, 1024*50)}, "resize to 1024*50 KB");
$st = stat($path);
--
1.7.10.4
11 years, 6 months
[libvirt] [PATCH] util/vshstring: fix the vir_strdup when src is NULL.
by yangdongsheng
When src is NULL, vir_strdup will return 0 directly.
This patch will set dest to NULL before vir_strdup return.
Signed-off-by: yangdongsheng <yangds.fnst(a)cn.fujitsu.com>
---
src/util/virstring.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/util/virstring.c b/src/util/virstring.c
index b244e6c..25b5d81 100644
--- a/src/util/virstring.c
+++ b/src/util/virstring.c
@@ -540,8 +540,10 @@ virStrdup(char **dest,
const char *funcname,
size_t linenr)
{
- if (!src)
+ if (!src) {
+ *dest = NULL;
return 0;
+ }
if (!(*dest = strdup(src))) {
if (report)
virReportOOMErrorFull(domcode, filename, funcname, linenr);
--
1.7.10.1
11 years, 6 months