[libvirt] about ceph+qcow2+qemu(snapshot) support issue ?
by haiquan517@sina.com
Hi ,
Could you pls help me ask one question , now we are testing a fuction , about Ceph+ qcow2+(qemu(snapshot) tec, now we are running this command print this error : virsh snapshot-create-as --domain win08q2 --name snapwin08q2 --description "test ucsm+qcow2"error: operation failed: Error -5 while writing VM
so we want
10 years, 3 months
[libvirt] [PATCH] conf: RNG: Always fill in default random source path for default backend
by Peter Krempa
Libvirt documents that the default entropy source for the 'random'
backend of a RNG device is /dev/random. Instead of storing and
propagating NULL across our code and checking it in multiple places fill
the default in the post parse callback and use that in the other places.
---
Sending the fix as promised in the multiple-rng series.
src/conf/domain_audit.c | 10 ++--------
src/conf/domain_conf.c | 14 +++++++++-----
src/qemu/qemu_cgroup.c | 12 ++++--------
src/qemu/qemu_command.c | 5 ++---
.../qemuxml2argvdata/qemuxml2argv-virtio-rng-default.args | 2 +-
.../qemuxml2argvdata/qemuxml2argv-virtio-rng-multiple.args | 3 ++-
6 files changed, 20 insertions(+), 26 deletions(-)
diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c
index 2d1b1fb..93625fc 100644
--- a/src/conf/domain_audit.c
+++ b/src/conf/domain_audit.c
@@ -253,10 +253,7 @@ virDomainAuditRNG(virDomainObjPtr vm,
if (newDef) {
switch ((virDomainRNGBackend) newDef->backend) {
case VIR_DOMAIN_RNG_BACKEND_RANDOM:
- if (newDef->source.file)
- newsrcpath = newDef->source.file;
- else
- newsrcpath = "/dev/random";
+ newsrcpath = newDef->source.file;
break;
case VIR_DOMAIN_RNG_BACKEND_EGD:
@@ -271,10 +268,7 @@ virDomainAuditRNG(virDomainObjPtr vm,
if (oldDef) {
switch ((virDomainRNGBackend) oldDef->backend) {
case VIR_DOMAIN_RNG_BACKEND_RANDOM:
- if (oldDef->source.file)
- oldsrcpath = oldDef->source.file;
- else
- oldsrcpath = "/dev/random";
+ oldsrcpath = oldDef->source.file;
break;
case VIR_DOMAIN_RNG_BACKEND_EGD:
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9c3cd8a..910f6e2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3057,6 +3057,14 @@ virDomainDeviceDefPostParseInternal(virDomainDeviceDefPtr dev,
}
}
+ /* set default path for virtio-rng "random" backend to /dev/random */
+ if (dev->type == VIR_DOMAIN_DEVICE_RNG &&
+ dev->data.rng->backend == VIR_DOMAIN_RNG_BACKEND_RANDOM &&
+ !dev->data.rng->source.file) {
+ if (VIR_STRDUP(dev->data.rng->source.file, "/dev/random") < 0)
+ return -1;
+ }
+
return 0;
}
@@ -16546,11 +16554,7 @@ virDomainRNGDefFormat(virBufferPtr buf,
switch ((virDomainRNGBackend) def->backend) {
case VIR_DOMAIN_RNG_BACKEND_RANDOM:
- if (def->source.file)
- virBufferEscapeString(buf, ">%s</backend>\n", def->source.file);
- else
- virBufferAddLit(buf, "/>\n");
-
+ virBufferEscapeString(buf, ">%s</backend>\n", def->source.file);
break;
case VIR_DOMAIN_RNG_BACKEND_EGD:
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 419be9a..43d14d4 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -587,16 +587,12 @@ qemuSetupDevicesCgroup(virQEMUDriverPtr driver,
for (i = 0; i < vm->def->nrngs; i++) {
if (vm->def->rngs[i]->backend == VIR_DOMAIN_RNG_BACKEND_RANDOM) {
VIR_DEBUG("Setting Cgroup ACL for RNG device");
- const char *rngpath = vm->def->rngs[i]->source.file;
-
- /* fix path when using the default */
- if (!rngpath)
- rngpath = "/dev/random";
-
- rv = virCgroupAllowDevicePath(priv->cgroup, rngpath,
+ rv = virCgroupAllowDevicePath(priv->cgroup,
+ vm->def->rngs[i]->source.file,
VIR_CGROUP_DEVICE_RW);
virDomainAuditCgroupPath(vm, priv->cgroup, "allow",
- rngpath, "rw", rv == 0);
+ vm->def->rngs[i]->source.file,
+ "rw", rv == 0);
if (rv < 0 &&
!virLastErrorIsSystemErrno(ENOENT))
goto cleanup;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 7f9357c..cdf7740 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5626,9 +5626,8 @@ qemuBuildRNGBackendArgs(virCommandPtr cmd,
goto cleanup;
}
- virBufferAsprintf(&buf, "rng-random,id=%s", dev->info.alias);
- if (dev->source.file)
- virBufferAsprintf(&buf, ",filename=%s", dev->source.file);
+ virBufferAsprintf(&buf, "rng-random,id=%s,filename=%s",
+ dev->info.alias, dev->source.file);
virCommandAddArg(cmd, "-object");
virCommandAddArgBuffer(cmd, &buf);
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-default.args b/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-default.args
index 4ae6257..58cc473 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-default.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-default.args
@@ -3,5 +3,5 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
-S -M pc -m 214 -smp 1 -nographic -nodefaults \
-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
--object rng-random,id=rng0 \
+-object rng-random,id=rng0,filename=/dev/random \
-device virtio-rng-pci,rng=rng0,bus=pci.0,addr=0x7
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-multiple.args b/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-multiple.args
index 1082ede..d1faf09 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-multiple.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-multiple.args
@@ -3,7 +3,8 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
-M pc -m 214 -smp 1 -nographic -nodefaults \
-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
--object rng-random,id=rng0 -device virtio-rng-pci,rng=rng0,bus=pci.0,addr=0x7 \
+-object rng-random,id=rng0,filename=/dev/random \
+-device virtio-rng-pci,rng=rng0,bus=pci.0,addr=0x7 \
-chardev socket,id=charrng1,host=1.2.3.4,port=1234 \
-object rng-egd,chardev=charrng1,id=rng1 \
-device virtio-rng-pci,rng=rng1,bus=pci.0,addr=0x4
--
2.0.0
10 years, 3 months
[libvirt] default virtual network race with NetworkManager in a VM
by Cole Robinson
Hi all,
There's a long standing issue with running libvirt inside a VM:
https://bugzilla.redhat.com/show_bug.cgi?id=811967
Summary: Run a VM using the default virtual network with IP address
192.168.122.XXX. Install libvirtd inside the VM, reboot. On startup, libvirtd
in the VM can bring up its copy of the default virtual network, before
NetworkManager has a chance to run. The nested network grabs the route for
192.168.122.0 before NetworkManager can claim it for the VM's normal
networking. Result is the VM doesn't have any network connectivity to the
outside world.
If NetworkManager starts first, a libvirt check at virtual network startup
time will refuse to override the existing route and avoid the problem. This is
from https://bugzilla.redhat.com/show_bug.cgi?id=235961
The past few Fedora releases haven't generated that many complaints about
this, but we've had reports that it's happening quite frequently with
rawhide/f21, see the last comments of that first bug report.
There's some suggestions in the bug about possible fixes, like listening to
NetworkManager API events and stopping the virtual network if needed. But they
are just ideas that no one has really researched.
Anyone have a novel solution and/or some cycles to poke at this?
(FWIW no one has tried to determine what has changed that's tickling this
issue more often, but regardless the root issue should be dealt with)
Thanks,
Cole
10 years, 4 months
Re: [libvirt] [Qemu-devel] [PATCH] [RFC] Add machine type pc-1.0-qemu-kvm for live migrate compatibility with qemu-kvm
by Andreas Färber
Hi Alex,
+ quintela, mst, libvirt
Am 22.07.2014 20:43, schrieb Alex Bligh:
> Add a machine type pc-1.0-qemu-kvm for live migrate compatibility
> with qemu-kvm version 1.0.
>
> Signed-off-by: Alex Bligh <alex(a)alex.org.uk>
> ---
> hw/acpi/piix4.c | 49 ++++++++++++++++++++++++++++++++++++++++++++--
> hw/i386/pc_piix.c | 31 +++++++++++++++++++++++++++++
> hw/timer/i8254_common.c | 41 ++++++++++++++++++++++++++++++++++++++
> include/hw/acpi/piix4.h | 1 +
> include/hw/timer/i8254.h | 2 ++
> 5 files changed, 122 insertions(+), 2 deletions(-)
>
> This RFC patch adds inbound migrate capability from qemu-kvm version
> 1.0. The main ideas are those set out in Cole Robinson's patch here:
> http://pkgs.fedoraproject.org/cgit/qemu.git/tree/0001-Fix-migration-from-...
> however, rather than patching statically (and breaking inbound
> migration on existing machine types), I have added a new machine
> type (pc-1.0-qemu-kvm) without affecting any other machine types.
This sounds like a really cool feature that SUSE would probably be
interested in extending back to 0.14 and 0.15, but I see a fundamental
flaw: libvirt on those old source systems does not know it should use a
different machine name on the destination side and would still use
pc-1.0, wouldn't it? After all, it needs to be able to migrate to other
old qemu-kvm machines, so it can't just be updated to use the new name.
Minor bikeshedding: I would ask to keep the package name in front of the
machine version, e.g. qemu-kvm-pc-1.0. Or just kvm-pc-1.0 since this is
a QEMU parameter anyway.
Haven't reviewed the code in detail yet.
Regards,
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
10 years, 4 months
[libvirt] [PATCH 1/2] spec: Use power64 macro
by Cole Robinson
From: Peter Robinson <pbrobinson(a)fedoraproject.org>
Covers the whole ppc64 family. Example bug for binutils:
https://bugzilla.redhat.com/show_bug.cgi?id=834651
---
libvirt.spec.in | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 76e57aa..cac7d99 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -60,15 +60,16 @@
%if 0%{?fedora}
%if 0%{?fedora} < 16
# Fedora doesn't have any QEMU on ppc64 until FC16 - only ppc
+ # I think F17 is the first release with the power64 macro
%ifarch ppc64
%define with_qemu_tcg 0
%endif
%endif
%if 0%{?fedora} >= 18
- %define qemu_kvm_arches %{ix86} x86_64 ppc64 s390x
+ %define qemu_kvm_arches %{ix86} x86_64 %{power64} s390x
%endif
%if 0%{?fedora} >= 20
- %define qemu_kvm_arches %{ix86} x86_64 ppc64 s390x %{arm}
+ %define qemu_kvm_arches %{ix86} x86_64 %{power64} s390x %{arm}
%endif
%endif
--
1.9.3
10 years, 4 months
[libvirt] [PATCH v2 0/6] Hugepages wrt NUMA
by Michal Privoznik
Another attempt. I've dropped the 1/7 from v1, and changed a few bits raised
during review. Although, I'm still using:
<memoryBacking>
<hugepages>
<page size='2048' unit='KiB'/>
</hugepages>
</memoryBacking>
as I don't feel there's any disagreement. But if there is I can rework the
patches.
Michal Privoznik (6):
Introduce virFileFindHugeTLBFS
qemu: Utilize virFileFindHugeTLBFS
virbitmap: Introduce virBitmapOverlaps
domain: Introduce ./hugepages/page/[@size,@unit,@nodeset]
qemu: Implement ./hugepages/page/[@size,@unit,@nodeset]
tests: Some testing of hugepages mapping
docs/formatdomain.html.in | 18 +-
docs/schemas/domaincommon.rng | 19 +-
src/Makefile.am | 12 +-
src/conf/domain_conf.c | 197 +++++++++++++++++++--
src/conf/domain_conf.h | 13 +-
src/libvirt_private.syms | 3 +
src/parallels/parallels_driver.c | 2 +-
src/qemu/qemu.conf | 9 +-
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 111 ++++++++++--
src/qemu/qemu_conf.c | 124 +++++++++++--
src/qemu/qemu_conf.h | 9 +-
src/qemu/qemu_driver.c | 39 ++--
src/qemu/qemu_process.c | 21 ++-
src/util/virbitmap.c | 20 +++
src/util/virbitmap.h | 3 +
src/util/virfile.c | 151 +++++++++++++++-
src/util/virfile.h | 12 ++
.../qemuxml2argv-hugepages-pages.args | 16 ++
.../qemuxml2argv-hugepages-pages.xml | 45 +++++
.../qemuxml2argv-hugepages-pages2.args | 10 ++
.../qemuxml2argv-hugepages-pages2.xml | 38 ++++
.../qemuxml2argv-hugepages-pages3.args | 9 +
.../qemuxml2argv-hugepages-pages3.xml | 38 ++++
tests/qemuxml2argvdata/qemuxml2argv-hugepages.args | 2 +-
tests/qemuxml2argvtest.c | 18 +-
tests/qemuxml2xmltest.c | 3 +
tests/virbitmaptest.c | 26 +++
29 files changed, 878 insertions(+), 93 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages2.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages2.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages3.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages3.xml
--
1.8.5.5
10 years, 4 months
[libvirt] [libvirt-glib] [PATCH v5 1/3] libvirt-gobject-domain: Add _fetch_snapshots
by Timm Bäder
This function can be used to fetch the snapshots of a domain (according
to the given GVirDomainSnapshotListFlags) and save them in a
domain-internal GHashTable. A function to access them from outside will
be added in a later patch.
---
libvirt-gobject/libvirt-gobject-domain.c | 86 ++++++++++++++++++++++++++++++++
libvirt-gobject/libvirt-gobject-domain.h | 37 ++++++++++++++
libvirt-gobject/libvirt-gobject.sym | 2 +
3 files changed, 125 insertions(+)
diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c
index c6e30e5..adb5179 100644
--- a/libvirt-gobject/libvirt-gobject-domain.c
+++ b/libvirt-gobject/libvirt-gobject-domain.c
@@ -38,6 +38,8 @@ struct _GVirDomainPrivate
{
virDomainPtr handle;
gchar uuid[VIR_UUID_STRING_BUFLEN];
+ GHashTable *snapshots;
+ GMutex *lock;
};
G_DEFINE_TYPE(GVirDomain, gvir_domain, G_TYPE_OBJECT);
@@ -121,6 +123,11 @@ static void gvir_domain_finalize(GObject *object)
g_debug("Finalize GVirDomain=%p", domain);
+ if (priv->snapshots) {
+ g_hash_table_unref(priv->snapshots);
+ }
+ g_mutex_free(priv->lock);
+
virDomainFree(priv->handle);
G_OBJECT_CLASS(gvir_domain_parent_class)->finalize(object);
@@ -237,6 +244,7 @@ static void gvir_domain_init(GVirDomain *domain)
g_debug("Init GVirDomain=%p", domain);
domain->priv = GVIR_DOMAIN_GET_PRIVATE(domain);
+ domain->priv->lock = g_mutex_new();
}
typedef struct virDomain GVirDomainHandle;
@@ -1514,3 +1522,81 @@ gvir_domain_create_snapshot(GVirDomain *dom,
g_free(custom_xml);
return dom_snapshot;
}
+
+
+
+/**
+ * gvir_domain_fetch_snapshots:
+ * @dom: The domain
+ * @list_flags: bitwise-OR of #GVirDomainSnapshotListFlags
+ * @cancellable: (allow-none)(transfer-none): cancellation object
+ * @error: (allow-none): Place-holder for error or NULL
+ *
+ * Returns: TRUE on success, FALSE otherwise.
+ */
+gboolean gvir_domain_fetch_snapshots(GVirDomain *dom,
+ guint list_flags,
+ GCancellable *cancellable,
+ GError **error)
+{
+ GVirDomainPrivate *priv;
+ virDomainSnapshotPtr *snapshots = NULL;
+ GVirDomainSnapshot *snap;
+ GHashTable *snap_table;
+ int n_snaps = 0;
+ int i;
+ gboolean ret = TRUE;
+
+ g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE);
+ g_return_val_if_fail((error == NULL) || (*error == NULL), FALSE);
+
+ priv = dom->priv;
+
+ snap_table = g_hash_table_new_full(g_str_hash,
+ g_str_equal,
+ NULL,
+ g_object_unref);
+
+
+ n_snaps = virDomainListAllSnapshots(priv->handle, &snapshots, list_flags);
+
+ if (g_cancellable_set_error_if_cancelled(cancellable, error)) {
+ ret = FALSE;
+ goto cleanup;
+ }
+
+ if (n_snaps < 0) {
+ gvir_set_error(error, GVIR_DOMAIN_ERROR, 0,
+ "Unable to fetch snapshots of %s",
+ gvir_domain_get_name(dom));
+ ret = FALSE;
+ goto cleanup;
+ }
+
+ for (i = 0; i < n_snaps; i ++) {
+ if (g_cancellable_set_error_if_cancelled(cancellable, error)) {
+ ret = FALSE;
+ goto cleanup;
+ }
+ snap = GVIR_DOMAIN_SNAPSHOT(g_object_new(GVIR_TYPE_DOMAIN_SNAPSHOT,
+ "handle", snapshots[i],
+ NULL));
+ g_hash_table_insert(snap_table,
+ (gpointer)gvir_domain_snapshot_get_name(snap),
+ snap);
+ }
+
+
+ g_mutex_lock(priv->lock);
+ if (priv->snapshots != NULL)
+ g_hash_table_unref(priv->snapshots);
+ priv->snapshots = snap_table;
+ snap_table = NULL;
+ g_mutex_unlock(priv->lock);
+
+cleanup:
+ free(snapshots);
+ if (snap_table != NULL)
+ g_hash_table_unref (snap_table);
+ return ret;
+}
diff --git a/libvirt-gobject/libvirt-gobject-domain.h b/libvirt-gobject/libvirt-gobject-domain.h
index 38d3458..8c1a8e5 100644
--- a/libvirt-gobject/libvirt-gobject-domain.h
+++ b/libvirt-gobject/libvirt-gobject-domain.h
@@ -183,6 +183,39 @@ typedef enum {
GVIR_DOMAIN_REBOOT_GUEST_AGENT = VIR_DOMAIN_REBOOT_GUEST_AGENT,
} GVirDomainRebootFlags;
+/**
+ * GVirDomainSnapshotListFlags:
+ * @GVIR_DOMAIN_SNAPSHOT_LIST_ALL: List all snapshots
+ * @GVIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS: List all descendants, not just
+ * children, when listing a snapshot.
+ * For historical reasons, groups do not use contiguous bits.
+ * @GVIR_DOMAIN_SNAPSHOT_LIST_ROOTS: Filter by snapshots with no parents, when listing a domain
+ * @GVIR_DOMAIN_SNAPSHOT_LIST_METADATA: Filter by snapshots which have metadata
+ * @GVIR_DOMAIN_SNAPSHOT_LIST_LEAVES: Filter by snapshots with no children
+ * @GVIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES: Filter by snapshots that have children
+ * @GVIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA: Filter by snapshots with no metadata
+ * @GVIR_DOMAIN_SNAPSHOT_LIST_INACTIVE: Filter by snapshots taken while guest was shut off
+ * @GVIR_DOMAIN_SNAPSHOT_LIST_ACTIVE: Filter by snapshots taken while guest was active, and with memory state
+ * @GVIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY: Filter by snapshots taken while guest was active, but without memory state
+ * @GVIR_DOMAIN_SNAPSHOT_LIST_INTERNAL: Filter by snapshots stored internal to disk images
+ * @GVIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL: Filter by snapshots that use files external to disk images
+ */
+typedef enum {
+ GVIR_DOMAIN_SNAPSHOT_LIST_ALL = 0,
+ GVIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS = VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS,
+ GVIR_DOMAIN_SNAPSHOT_LIST_ROOTS = VIR_DOMAIN_SNAPSHOT_LIST_ROOTS,
+ GVIR_DOMAIN_SNAPSHOT_LIST_METADATA = VIR_DOMAIN_SNAPSHOT_LIST_METADATA,
+ GVIR_DOMAIN_SNAPSHOT_LIST_LEAVES = VIR_DOMAIN_SNAPSHOT_LIST_LEAVES,
+ GVIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES = VIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES,
+ GVIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA = VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA,
+ GVIR_DOMAIN_SNAPSHOT_LIST_INACTIVE = VIR_DOMAIN_SNAPSHOT_LIST_INACTIVE,
+ GVIR_DOMAIN_SNAPSHOT_LIST_ACTIVE = VIR_DOMAIN_SNAPSHOT_LIST_ACTIVE,
+ GVIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY = VIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY,
+ GVIR_DOMAIN_SNAPSHOT_LIST_INTERNAL = VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL,
+ GVIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL = VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL
+} GVirDomainSnapshotListFlags;
+
+
typedef struct _GVirDomainInfo GVirDomainInfo;
struct _GVirDomainInfo
{
@@ -330,6 +363,10 @@ gvir_domain_create_snapshot(GVirDomain *dom,
guint flags,
GError **err);
+gboolean gvir_domain_fetch_snapshots(GVirDomain *dom,
+ guint list_flags,
+ GCancellable *cancellable,
+ GError **error);
G_END_DECLS
#endif /* __LIBVIRT_GOBJECT_DOMAIN_H__ */
diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
index b781cc6..781310f 100644
--- a/libvirt-gobject/libvirt-gobject.sym
+++ b/libvirt-gobject/libvirt-gobject.sym
@@ -236,7 +236,9 @@ LIBVIRT_GOBJECT_0.1.5 {
LIBVIRT_GOBJECT_0.1.9 {
global:
+ gvir_domain_fetch_snapshots;
gvir_domain_snapshot_delete;
+ gvir_domain_snapshot_list_flags_get_type;
} LIBVIRT_GOBJECT_0.1.5;
# .... define new API here using predicted next version number ....
--
2.0.1
10 years, 4 months
[libvirt] [PATCH] qemu: Fix starting of VMs with empty CDROM drives
by Peter Krempa
Since 24e5cafba6dbc2722e05f92dc0ae31b0f938f9f0 (thankfully unreleased)
when a VM with an empty disk drive would be started the code would call
stat() on NULL path as a check was missing from the callback rendering
machines unstartable.
Report success when the path is empty (denoting an empty drive).
---
src/qemu/qemu_driver.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ca0d77f..704ba39 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -343,6 +343,9 @@ qemuSecurityChownCallback(virStorageSourcePtr src,
if (virStorageSourceIsLocalStorage(src)) {
/* use direct chmod for local files so that the file doesn't
* need to be initialized */
+ if (!src->path)
+ return 0;
+
if (stat(src->path, &sb) >= 0) {
if (sb.st_uid == uid &&
sb.st_gid == gid) {
--
2.0.0
10 years, 4 months
[libvirt] [PATCH] libvirt: Fix 'quest' typo in comment
by Li Yang
Signed-off-by: Li Yang <liyang.fnst(a)cn.fujitsu.com>
---
src/libvirt.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index 79bcdf1..143d319 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -2950,7 +2950,7 @@ virDomainSaveImageDefineXML(virConnectPtr conn, const char *file,
* a crashed state after the dump completes. If @flags includes
* VIR_DUMP_LIVE, then make the core dump while continuing to allow
* the guest to run; otherwise, the guest is suspended during the dump.
- * VIR_DUMP_RESET flag forces reset of the quest after dump.
+ * VIR_DUMP_RESET flag forces reset of the guest after dump.
* The above three flags are mutually exclusive.
*
* Additionally, if @flags includes VIR_DUMP_BYPASS_CACHE, then libvirt
@@ -3042,7 +3042,7 @@ virDomainCoreDump(virDomainPtr domain, const char *to, unsigned int flags)
* a crashed state after the dump completes. If @flags includes
* VIR_DUMP_LIVE, then make the core dump while continuing to allow
* the guest to run; otherwise, the guest is suspended during the dump.
- * VIR_DUMP_RESET flag forces reset of the quest after dump.
+ * VIR_DUMP_RESET flag forces reset of the guest after dump.
* The above three flags are mutually exclusive.
*
* Additionally, if @flags includes VIR_DUMP_BYPASS_CACHE, then libvirt
--
1.7.1
10 years, 4 months
[libvirt] [PATCH] util: virTimeFieldsThenRaw never return negative
by James
virTimeFieldsThenRaw will never return negative result, so I clean up
the related meaningless judgements to make it better.
Signed-off-by: James <james.wangyufei(a)huawei.com>
---
src/util/virtime.c | 23 ++++++++---------------
src/util/virtime.h | 8 ++++----
tests/virtimetest.c | 3 +--
3 files changed, 13 insertions(+), 21 deletions(-)
diff --git a/src/util/virtime.c b/src/util/virtime.c
index 2a91ea5..a49e287 100644
--- a/src/util/virtime.c
+++ b/src/util/virtime.c
@@ -94,7 +94,8 @@ int virTimeFieldsNowRaw(struct tm *fields)
if (virTimeMillisNowRaw(&now) < 0)
return -1;
- return virTimeFieldsThenRaw(now, fields);
+ virTimeFieldsThenRaw(now, fields);
+ return 0;
}
@@ -121,9 +122,8 @@ const unsigned short int __mon_yday[2][13] = {
* Converts the timestamp @when into broken-down field format.
* Time time is always in UTC
*
- * Returns 0 on success, -1 on error with errno set
*/
-int virTimeFieldsThenRaw(unsigned long long when, struct tm *fields)
+void virTimeFieldsThenRaw(unsigned long long when, struct tm *fields)
{
/* This code is taken from GLibC under terms of LGPLv2+ */
long int days, rem, y;
@@ -171,7 +171,6 @@ int virTimeFieldsThenRaw(unsigned long long when, struct tm *fields)
days -= ip[y];
fields->tm_mon = y;
fields->tm_mday = days + 1;
- return 0;
}
@@ -209,8 +208,7 @@ int virTimeStringThenRaw(unsigned long long when, char *buf)
{
struct tm fields;
- if (virTimeFieldsThenRaw(when, &fields) < 0)
- return -1;
+ virTimeFieldsThenRaw(when, &fields);
fields.tm_year += 1900;
fields.tm_mon += 1;
@@ -264,7 +262,8 @@ int virTimeFieldsNow(struct tm *fields)
if (virTimeMillisNow(&now) < 0)
return -1;
- return virTimeFieldsThen(now, fields);
+ virTimeFieldsThen(now, fields);
+ return 0;
}
@@ -276,16 +275,10 @@ int virTimeFieldsNow(struct tm *fields)
* Converts the timestamp @when into broken-down field format.
* Time time is always in UTC
*
- * Returns 0 on success, -1 on error with error reported
*/
-int virTimeFieldsThen(unsigned long long when, struct tm *fields)
+void virTimeFieldsThen(unsigned long long when, struct tm *fields)
{
- if (virTimeFieldsThenRaw(when, fields) < 0) {
- virReportSystemError(errno, "%s",
- _("Unable to break out time format"));
- return -1;
- }
- return 0;
+ virTimeFieldsThenRaw(when, fields);
}
diff --git a/src/util/virtime.h b/src/util/virtime.h
index 25332db..f9432da 100644
--- a/src/util/virtime.h
+++ b/src/util/virtime.h
@@ -43,8 +43,8 @@ int virTimeMillisNowRaw(unsigned long long *now)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
int virTimeFieldsNowRaw(struct tm *fields)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
-int virTimeFieldsThenRaw(unsigned long long when, struct tm *fields)
- ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+void virTimeFieldsThenRaw(unsigned long long when, struct tm *fields)
+ ATTRIBUTE_NONNULL(2);
int virTimeStringNowRaw(char *buf)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
int virTimeStringThenRaw(unsigned long long when, char *buf)
@@ -57,8 +57,8 @@ int virTimeMillisNow(unsigned long long *now)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
int virTimeFieldsNow(struct tm *fields)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
-int virTimeFieldsThen(unsigned long long when, struct tm *fields)
- ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+void virTimeFieldsThen(unsigned long long when, struct tm *fields)
+ ATTRIBUTE_NONNULL(2);
char *virTimeStringNow(void);
char *virTimeStringThen(unsigned long long when);
diff --git a/tests/virtimetest.c b/tests/virtimetest.c
index 859bd13..64bf19b 100644
--- a/tests/virtimetest.c
+++ b/tests/virtimetest.c
@@ -44,8 +44,7 @@ static int testTimeFields(const void *args)
const struct testTimeFieldsData *data = args;
struct tm actual;
- if (virTimeFieldsThen(data->when, &actual) < 0)
- return -1;
+ virTimeFieldsThen(data->when, &actual);
#define COMPARE(field) \
do { \
--
1.7.12.4
10 years, 4 months