[libvirt] [libvirt-glib] Add gvir_config_domain_set_lifecycle
by Christophe Fergeau
This is used to control what happens (restart, stop, ...) to the VM
when it crashes, shuts down, ...
---
libvirt-gconfig/libvirt-gconfig-domain.c | 20 ++++++++++++++++++++
libvirt-gconfig/libvirt-gconfig-domain.h | 18 ++++++++++++++++++
libvirt-gconfig/libvirt-gconfig.sym | 3 +++
libvirt-gconfig/tests/test-domain-create.c | 4 ++++
4 files changed, 45 insertions(+), 0 deletions(-)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c b/libvirt-gconfig/libvirt-gconfig-domain.c
index 2f34c1b..9a723cb 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain.c
@@ -300,6 +300,26 @@ void gvir_config_domain_set_seclabel(GVirConfigDomain *domain,
GVIR_CONFIG_OBJECT(seclabel));
}
+void gvir_config_domain_set_lifecycle(GVirConfigDomain *domain,
+ GVirConfigDomainLifecycleEvent event,
+ GVirConfigDomainLifecycleAction action)
+{
+ const char *event_str;
+ const char *action_str;
+
+ g_return_if_fail((event == GVIR_CONFIG_DOMAIN_LIFECYCLE_ON_CRASH) ||
+ ((action != GVIR_CONFIG_DOMAIN_LIFECYCLE_COREDUMP_DESTROY) &&
+ (action != GVIR_CONFIG_DOMAIN_LIFECYCLE_COREDUMP_RESTART)));
+
+ event_str = gvir_config_genum_get_nick(GVIR_TYPE_CONFIG_DOMAIN_LIFECYCLE_EVENT, event);
+ g_return_if_fail(event_str != NULL);
+ action_str = gvir_config_genum_get_nick(GVIR_TYPE_CONFIG_DOMAIN_LIFECYCLE_ACTION, action);
+ g_return_if_fail(action_str != NULL);
+
+ gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(domain),
+ event_str, action_str);
+}
+
/**
* gvir_config_domain_set_devices:
* @devices: (in) (element-type LibvirtGConfig.DomainDevice):
diff --git a/libvirt-gconfig/libvirt-gconfig-domain.h b/libvirt-gconfig/libvirt-gconfig-domain.h
index 7b40f99..b96aae0 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain.h
@@ -69,6 +69,21 @@ typedef enum {
GVIR_CONFIG_DOMAIN_VIRT_LXC,
} GVirConfigDomainVirtType;
+typedef enum {
+ GVIR_CONFIG_DOMAIN_LIFECYCLE_ON_POWEROFF, /*< nick=on_poweroff >*/
+ GVIR_CONFIG_DOMAIN_LIFECYCLE_ON_REBOOT, /*< nick=on_reboot >*/
+ GVIR_CONFIG_DOMAIN_LIFECYCLE_ON_CRASH /*< nick=on_crash >*/
+} GVirConfigDomainLifecycleEvent;
+
+typedef enum {
+ GVIR_CONFIG_DOMAIN_LIFECYCLE_DESTROY,
+ GVIR_CONFIG_DOMAIN_LIFECYCLE_RESTART,
+ GVIR_CONFIG_DOMAIN_LIFECYCLE_PRESERVE,
+ GVIR_CONFIG_DOMAIN_LIFECYCLE_RENAME_RESTART,
+ GVIR_CONFIG_DOMAIN_LIFECYCLE_COREDUMP_DESTROY,
+ GVIR_CONFIG_DOMAIN_LIFECYCLE_COREDUMP_RESTART
+} GVirConfigDomainLifecycleAction;
+
GType gvir_config_domain_get_type(void);
GVirConfigDomain *gvir_config_domain_new_from_xml(const gchar *xml, GError **error);
@@ -95,6 +110,9 @@ void gvir_config_domain_set_devices(GVirConfigDomain *domain,
GList *devices);
void gvir_config_domain_add_device(GVirConfigDomain *domain,
GVirConfigDomainDevice *device);
+void gvir_config_domain_set_lifecycle(GVirConfigDomain *domain,
+ GVirConfigDomainLifecycleEvent event,
+ GVirConfigDomainLifecycleAction action);
G_END_DECLS
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 9b6d420..c5726b9 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -9,12 +9,15 @@ LIBVIRT_GCONFIG_0.0.1 {
gvir_config_domain_add_device;
gvir_config_domain_get_type;
+ gvir_config_domain_lifecycle_action_get_type;
+ gvir_config_domain_lifecycle_event_get_type;
gvir_config_domain_new;
gvir_config_domain_new_from_xml;
gvir_config_domain_set_clock;
gvir_config_domain_set_devices;
gvir_config_domain_get_features;
gvir_config_domain_set_features;
+ gvir_config_domain_set_lifecycle;
gvir_config_domain_get_memory;
gvir_config_domain_set_memory;
gvir_config_domain_get_name;
diff --git a/libvirt-gconfig/tests/test-domain-create.c b/libvirt-gconfig/tests/test-domain-create.c
index 0e52e9e..59aa5b0 100644
--- a/libvirt-gconfig/tests/test-domain-create.c
+++ b/libvirt-gconfig/tests/test-domain-create.c
@@ -60,6 +60,10 @@ int main(void)
}
g_strfreev(feat);
+ gvir_config_domain_set_lifecycle(domain,
+ GVIR_CONFIG_DOMAIN_LIFECYCLE_ON_POWEROFF,
+ GVIR_CONFIG_DOMAIN_LIFECYCLE_RESTART);
+
/* clock node */
GVirConfigDomainClock *klock;
--
1.7.7.3
12 years, 11 months
[libvirt] [libvirt-glib] Add wrapper for volume deletion API
by Zeeshan Ali (Khattak)
From: "Zeeshan Ali (Khattak)" <zeeshanak(a)gnome.org>
---
libvirt-gobject/libvirt-gobject-storage-vol.c | 25 +++++++++++++++++++++++++
libvirt-gobject/libvirt-gobject-storage-vol.h | 4 ++++
libvirt-gobject/libvirt-gobject.sym | 1 +
3 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/libvirt-gobject/libvirt-gobject-storage-vol.c b/libvirt-gobject/libvirt-gobject-storage-vol.c
index 15ae404..e7a7581 100644
--- a/libvirt-gobject/libvirt-gobject-storage-vol.c
+++ b/libvirt-gobject/libvirt-gobject-storage-vol.c
@@ -252,3 +252,28 @@ GVirStorageVolInfo *gvir_storage_vol_get_info(GVirStorageVol *vol,
return ret;
}
+
+/**
+ * gvir_storage_vol_delete:
+ * @vol: the storage volume to delete
+ * @flags: the flags
+ * @err: Return location for errors, or NULL
+ *
+ * Deletes the storage volume @vol.
+ *
+ * Returns: %TRUE on success, %FALSE otherwise
+ */
+gboolean gvir_storage_vol_delete(GVirStorageVol *vol,
+ guint flags,
+ GError **err)
+{
+ if (virStorageVolDelete(vol->priv->handle, flags) < 0) {
+ g_set_error (err,
+ GVIR_STORAGE_VOL_ERROR,
+ 0,
+ "Unable to delete storage volume");
+ return FALSE;
+ }
+
+ return TRUE;
+}
diff --git a/libvirt-gobject/libvirt-gobject-storage-vol.h b/libvirt-gobject/libvirt-gobject-storage-vol.h
index 717ef4a..db63865 100644
--- a/libvirt-gobject/libvirt-gobject-storage-vol.h
+++ b/libvirt-gobject/libvirt-gobject-storage-vol.h
@@ -80,6 +80,10 @@ GType gvir_storage_vol_handle_get_type(void);
const gchar *gvir_storage_vol_get_name(GVirStorageVol *vol);
const gchar *gvir_storage_vol_get_path(GVirStorageVol *vol);
+gboolean gvir_storage_vol_delete(GVirStorageVol *vol,
+ guint flags,
+ GError **err);
+
GVirConfigStorageVol *gvir_storage_vol_get_config(GVirStorageVol *vol,
guint flags,
GError **err);
diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
index c0d2e19..3727fb7 100644
--- a/libvirt-gobject/libvirt-gobject.sym
+++ b/libvirt-gobject/libvirt-gobject.sym
@@ -117,6 +117,7 @@ LIBVIRT_GOBJECT_0.0.1 {
gvir_storage_vol_get_path;
gvir_storage_vol_get_config;
gvir_storage_vol_get_info;
+ gvir_storage_vol_delete;
gvir_connection_handle_get_type;
--
1.7.7.3
12 years, 11 months
[libvirt] domjobabort return the same error in distinct cases
by Shahar Havivi
Hi,
I am using the python api:
domain.abortjob(),
if there is no job I get exception with error code: VIR_ERR_OPERATION_INVALID with the
error message: 'Requested operation is not valid: no job is active on the
domain'
when there is a job I get the same exception code with the same error
message,
in addition I get another exception:
libvirtError ('virDomainMigrateToURI2() failed', dom=self)
libvirtError: operation failed: migration job: canceled by client
the migration thread is throwing as well:
libvirtError ('virDomainMigrateToURI2() failed', dom=self)
libvirtError: operation failed: migration job: canceled by client
Should the same error should be for this two cases?
12 years, 11 months
[libvirt] implementing locking with libvirt on ubuntu
by Upendra Moturi
Hi
I am trying to implement locking i,e two vms are not started with same
disk on ubuntu.
Using libvirt 0.9.7 (Installed it from source)
qemu-kvm 0.14.1
kernel 3.0.0-13-server
Steps followed while installing from source
cd libvirt-0.9.7
./configure
make
make install
I found that sanlock or virtlockd (fcntl) daemons can do that,but not
able implement it.
I dont find virtlockd daemon running.
>From below link
http://www.redhat.com/archives/libvir-list/2011-July/msg00337.html
it is said to create lockd directory under /var/lib/libvirt
I dont find this directory after installation from source
Am i missing something ?
Please guide me in implementing locking on ubuntu.
--
Thanks and Regards,
Upendra.M
12 years, 11 months
[libvirt] [PATCH] maint: fix improper use of 'an'
by Eric Blake
https://bugzilla.redhat.com/show_bug.cgi?id=648855 mentioned a
misuse of 'an' where 'a' is proper; that has since been fixed,
but a search found other problems (some were a spelling error for
'and', while most were fixed by 'a').
* daemon/stream.c: Fix grammar.
* src/conf/domain_conf.c: Likewise.
* src/conf/domain_event.c: Likewise.
* src/esx/esx_driver.c: Likewise.
* src/esx/esx_vi.c: Likewise.
* src/rpc/virnetclient.c: Likewise.
* src/rpc/virnetserverprogram.c: Likewise.
* src/storage/storage_backend_fs.c: Likewise.
* src/util/conf.c: Likewise.
* src/util/dnsmasq.c: Likewise.
* src/util/iptables.c: Likewise.
* src/xen/xen_hypervisor.c: Likewise.
* src/xen/xend_internal.c: Likewise.
* src/xen/xs_internal.c: Likewise.
* tools/virsh.c: Likewise.
---
Pushing under the trivial rule.
daemon/stream.c | 4 ++--
src/conf/domain_conf.c | 2 +-
src/conf/domain_event.c | 2 +-
src/esx/esx_driver.c | 2 +-
src/esx/esx_vi.c | 2 +-
src/rpc/virnetclient.c | 2 +-
src/rpc/virnetserverprogram.c | 2 +-
src/storage/storage_backend_fs.c | 2 +-
src/util/conf.c | 6 +++---
src/util/dnsmasq.c | 4 ++--
src/util/iptables.c | 4 ++--
src/xen/xen_hypervisor.c | 32 ++++++++++++++++----------------
src/xen/xend_internal.c | 2 +-
src/xen/xs_internal.c | 2 +-
tools/virsh.c | 2 +-
15 files changed, 35 insertions(+), 35 deletions(-)
diff --git a/daemon/stream.c b/daemon/stream.c
index 50f8fd4..bb66f75 100644
--- a/daemon/stream.c
+++ b/daemon/stream.c
@@ -1,7 +1,7 @@
/*
* stream.c: APIs for managing client streams
*
- * Copyright (C) 2009 Red Hat, Inc.
+ * Copyright (C) 2009, 2011 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
@@ -556,7 +556,7 @@ daemonStreamHandleWriteData(virNetServerClientPtr client,
/*
- * Process an finish handshake from the client.
+ * Process a finish handshake from the client.
*
* Returns a VIR_NET_OK confirmation if successful, or a VIR_NET_ERROR
* if there was a stream error
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 75f21dc..75e51a0 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4555,7 +4555,7 @@ error:
}
-/* Parse the XML definition for an hub device */
+/* Parse the XML definition for a hub device */
static virDomainHubDefPtr
virDomainHubDefParseXML(xmlNodePtr node, unsigned int flags)
{
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index a04b9d0..614ab97 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -1070,7 +1070,7 @@ virDomainEventQueuePop(virDomainEventQueuePtr evtQueue)
* @evtQueue: the dom event queue
* @event: the event to add
*
- * Internal function to push onto the back of an virDomainEventQueue
+ * Internal function to push onto the back of a virDomainEventQueue
*
* Returns: 0 on success, -1 on failure
*/
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index f8b3c7a..1e424eb 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -267,7 +267,7 @@ esxParseVMXFileName(const char *fileName, void *opaque)
/*
- * This function does the inverse of esxParseVMXFileName. It takes an file name
+ * This function does the inverse of esxParseVMXFileName. It takes a file name
* in datastore path format or in absolute format and converts it to a file
* name that can be used in a .vmx file.
*
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 80f337b..99f25f8 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -1800,7 +1800,7 @@ esxVI_EnsureSession(esxVI_Context *ctx)
if (ctx->hasSessionIsActive) {
/*
* Use SessionIsActive to check if there is an active session for this
- * connection an re-login in there isn't.
+ * connection and re-login in there isn't.
*/
if (esxVI_SessionIsActive(ctx, ctx->session->key,
ctx->session->userName, &active) < 0) {
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index ec06f45..7f9a332 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -1701,7 +1701,7 @@ static int virNetClientSendInternal(virNetClientPtr client,
if (expectReply && nonBlock) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Attempt to send an non-blocking message with a synchronous reply"));
+ _("Attempt to send a non-blocking message with a synchronous reply"));
return -1;
}
diff --git a/src/rpc/virnetserverprogram.c b/src/rpc/virnetserverprogram.c
index bbd2d65..d2ede6b 100644
--- a/src/rpc/virnetserverprogram.c
+++ b/src/rpc/virnetserverprogram.c
@@ -340,7 +340,7 @@ cleanup:
* @client: the unlocked client object
* @msg: the complete incoming method call, with header already decoded
*
- * This method is used to dispatch an message representing an
+ * This method is used to dispatch a message representing an
* incoming method call from a client. It decodes the payload
* to obtain method call arguments, invokves the method and
* then sends a reply packet with the return values
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index b5acd20..d8dc29c 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -880,7 +880,7 @@ virStorageBackendFileSystemRefresh(virConnectPtr conn ATTRIBUTE_UNUSED,
VIR_STORAGE_VOL_OPEN_DEFAULT) < 0) {
/* The backing file is currently unavailable, the capacity,
* allocation, owner, group and mode are unknown. Just log the
- * error an continue.
+ * error and continue.
* Unfortunately virStorageBackendProbeTarget() might already
* have logged a similar message for the same problem, but only
* if AUTO format detection was used. */
diff --git a/src/util/conf.c b/src/util/conf.c
index c8dcc7f..502dafb 100644
--- a/src/util/conf.c
+++ b/src/util/conf.c
@@ -698,7 +698,7 @@ virConfParseStatement(virConfParserCtxtPtr ctxt)
* Parse the subset of the Python language needed to handle simple
* Xen configuration files.
*
- * Returns an handle to lookup settings or NULL if it failed to
+ * Returns a handle to lookup settings or NULL if it failed to
* read or parse the file, use virConfFree() to free the data.
*/
static virConfPtr
@@ -745,7 +745,7 @@ error:
*
* Reads a configuration file.
*
- * Returns an handle to lookup settings or NULL if it failed to
+ * Returns a handle to lookup settings or NULL if it failed to
* read or parse the file, use virConfFree() to free the data.
*/
virConfPtr
@@ -780,7 +780,7 @@ virConfReadFile(const char *filename, unsigned int flags)
* Reads a configuration file loaded in memory. The string can be
* zero terminated in which case @len can be 0
*
- * Returns an handle to lookup settings or NULL if it failed to
+ * Returns a handle to lookup settings or NULL if it failed to
* parse the content, use virConfFree() to free the data.
*/
virConfPtr
diff --git a/src/util/dnsmasq.c b/src/util/dnsmasq.c
index b5f90a6..dcb7195 100644
--- a/src/util/dnsmasq.c
+++ b/src/util/dnsmasq.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2010 Red Hat, Inc.
+ * Copyright (C) 2007-2011 Red Hat, Inc.
* Copyright (C) 2010 Satoru SATOH <satoru.satoh(a)gmail.com>
*
* This library is free software; you can redistribute it and/or
@@ -461,7 +461,7 @@ dnsmasqContextNew(const char *network_name,
* dnsmasqContextFree:
* @ctx: pointer to the dnsmasq context
*
- * Free the resources associated with an dnsmasq context
+ * Free the resources associated with a dnsmasq context
*/
void
dnsmasqContextFree(dnsmasqContext *ctx)
diff --git a/src/util/iptables.c b/src/util/iptables.c
index 452d717..3023900 100644
--- a/src/util/iptables.c
+++ b/src/util/iptables.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2010 Red Hat, Inc.
+ * Copyright (C) 2007-2011 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
@@ -891,7 +891,7 @@ iptablesOutputFixUdpChecksum(iptablesContext *ctx,
* @iface: the interface name
* @port: the UDP port to match
*
- * Add an rule to the mangle table's POSTROUTING chain that fixes up the
+ * Add a rule to the mangle table's POSTROUTING chain that fixes up the
* checksum of packets with the given destination @port.
* the given @iface interface for TCP packets.
*
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 6c71b65..941686f 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -556,7 +556,7 @@ typedef struct xen_v0_domainop xen_v0_domainop;
#define XEN_V2_OP_UNPAUSEDOMAIN 4
/*
- * The information for an setmaxmem system hypercall
+ * The information for a setmaxmem system hypercall
*/
#define XEN_V0_OP_SETMAXMEM 28
#define XEN_V1_OP_SETMAXMEM 28
@@ -580,7 +580,7 @@ struct xen_v2d5_setmaxmem {
typedef struct xen_v2d5_setmaxmem xen_v2d5_setmaxmem;
/*
- * The information for an setmaxvcpu system hypercall
+ * The information for a setmaxvcpu system hypercall
*/
#define XEN_V0_OP_SETMAXVCPU 41
#define XEN_V1_OP_SETMAXVCPU 41
@@ -599,7 +599,7 @@ struct xen_v2_setmaxvcpu {
typedef struct xen_v2_setmaxvcpu xen_v2_setmaxvcpu;
/*
- * The information for an setvcpumap system hypercall
+ * The information for a setvcpumap system hypercall
* Note that between 1 and 2 the limitation to 64 physical CPU was lifted
* hence the difference in structures
*/
@@ -647,7 +647,7 @@ struct xen_v2d5_setvcpumap {
typedef struct xen_v2d5_setvcpumap xen_v2d5_setvcpumap;
/*
- * The information for an vcpuinfo system hypercall
+ * The information for a vcpuinfo system hypercall
*/
#define XEN_V0_OP_GETVCPUINFO 43
#define XEN_V1_OP_GETVCPUINFO 43
@@ -866,8 +866,8 @@ virXenErrorFunc(virErrorNumber error, const char *func, const char *info,
* @handle: the handle to the Xen hypervisor
* @op: pointer to the hypervisor operation structure
*
- * Do an hypervisor operation though the old interface,
- * this leads to an hypervisor call through ioctl.
+ * Do a hypervisor operation though the old interface,
+ * this leads to a hypervisor call through ioctl.
*
* Returns 0 in case of success and -1 in case of error.
*/
@@ -908,7 +908,7 @@ xenHypervisorDoV0Op(int handle, xen_op_v0 * op)
* @handle: the handle to the Xen hypervisor
* @op: pointer to the hypervisor operation structure
*
- * Do an hypervisor v1 operation, this leads to an hypervisor call through
+ * Do a hypervisor v1 operation, this leads to a hypervisor call through
* ioctl.
*
* Returns 0 in case of success and -1 in case of error.
@@ -951,7 +951,7 @@ xenHypervisorDoV1Op(int handle, xen_op_v1* op)
* @handle: the handle to the Xen hypervisor
* @op: pointer to the hypervisor operation structure
*
- * Do an hypervisor v2 system operation, this leads to an hypervisor
+ * Do a hypervisor v2 system operation, this leads to a hypervisor
* call through ioctl.
*
* Returns 0 in case of success and -1 in case of error.
@@ -994,7 +994,7 @@ xenHypervisorDoV2Sys(int handle, xen_op_v2_sys* op)
* @handle: the handle to the Xen hypervisor
* @op: pointer to the hypervisor domain operation structure
*
- * Do an hypervisor v2 domain operation, this leads to an hypervisor
+ * Do a hypervisor v2 domain operation, this leads to a hypervisor
* call through ioctl.
*
* Returns 0 in case of success and -1 in case of error.
@@ -3155,7 +3155,7 @@ xenHypervisorGetMaxMemory(virDomainPtr domain)
* @id: the domain ID
* @info: the place where information should be stored
*
- * Do an hypervisor call to get the related set of domain information.
+ * Do a hypervisor call to get the related set of domain information.
*
* Returns 0 in case of success, -1 in case of error.
*/
@@ -3238,7 +3238,7 @@ xenHypervisorGetDomInfo(virConnectPtr conn, int id, virDomainInfoPtr info)
* @domain: pointer to the domain block
* @info: the place where information should be stored
*
- * Do an hypervisor call to get the related set of domain information.
+ * Do a hypervisor call to get the related set of domain information.
*
* Returns 0 in case of success, -1 in case of error.
*/
@@ -3382,7 +3382,7 @@ xenHypervisorNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *free
* xenHypervisorPauseDomain:
* @domain: pointer to the domain block
*
- * Do an hypervisor call to pause the given domain
+ * Do a hypervisor call to pause the given domain
*
* Returns 0 in case of success, -1 in case of error.
*/
@@ -3409,7 +3409,7 @@ xenHypervisorPauseDomain(virDomainPtr domain)
* xenHypervisorResumeDomain:
* @domain: pointer to the domain block
*
- * Do an hypervisor call to resume the given domain
+ * Do a hypervisor call to resume the given domain
*
* Returns 0 in case of success, -1 in case of error.
*/
@@ -3437,7 +3437,7 @@ xenHypervisorResumeDomain(virDomainPtr domain)
* @domain: pointer to the domain block
* @flags: an OR'ed set of virDomainDestroyFlagsValues
*
- * Do an hypervisor call to destroy the given domain
+ * Do a hypervisor call to destroy the given domain
*
* Calling this function with no @flags set (equal to zero)
* is equivalent to calling xenHypervisorDestroyDomain.
@@ -3471,7 +3471,7 @@ xenHypervisorDestroyDomainFlags(virDomainPtr domain,
* @domain: pointer to the domain block
* @memory: the max memory size in kilobytes.
*
- * Do an hypervisor call to change the maximum amount of memory used
+ * Do a hypervisor call to change the maximum amount of memory used
*
* Returns 0 in case of success, -1 in case of error.
*/
@@ -3563,7 +3563,7 @@ xenHypervisorPinVcpu(virDomainPtr domain, unsigned int vcpu,
* @domain: pointer to domain object, or NULL for Domain0
* @info: pointer to an array of virVcpuInfo structures (OUT)
* @maxinfo: number of structures in info array
- * @cpumaps: pointer to an bit map of real CPUs for all vcpus of this domain (in 8-bit bytes) (OUT)
+ * @cpumaps: pointer to a bit map of real CPUs for all vcpus of this domain (in 8-bit bytes) (OUT)
* If cpumaps is NULL, then no cpumap information is returned by the API.
* It's assumed there is <maxinfo> cpumap in cpumaps array.
* The memory allocated to cpumaps must be (maxinfo * maplen) bytes
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index 16165fe..0c0b6cb 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -2369,7 +2369,7 @@ xenDaemonDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
* @domain: pointer to domain object, or NULL for Domain0
* @info: pointer to an array of virVcpuInfo structures (OUT)
* @maxinfo: number of structures in info array
- * @cpumaps: pointer to an bit map of real CPUs for all vcpus of this domain (in 8-bit bytes) (OUT)
+ * @cpumaps: pointer to a bit map of real CPUs for all vcpus of this domain (in 8-bit bytes) (OUT)
* If cpumaps is NULL, then no cpumap information is returned by the API.
* It's assumed there is <maxinfo> cpumap in cpumaps array.
* The memory allocated to cpumaps must be (maxinfo * maplen) bytes
diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c
index 21018fd..a28e6cc 100644
--- a/src/xen/xs_internal.c
+++ b/src/xen/xs_internal.c
@@ -355,7 +355,7 @@ xenStoreClose(virConnectPtr conn)
* @domain: pointer to the domain block
* @info: the place where information should be stored
*
- * Do an hypervisor call to get the related set of domain information.
+ * Do a hypervisor call to get the related set of domain information.
*
* Returns 0 in case of success, -1 in case of error.
*/
diff --git a/tools/virsh.c b/tools/virsh.c
index be4df58..d02be5c 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -13233,7 +13233,7 @@ cmdCPUBaseline(vshControl *ctl, const vshCmd *cmd)
if (virFileReadAll(from, VIRSH_MAX_XML_FILE, &buffer) < 0)
return false;
- /* add an separate container around the xml */
+ /* add a separate container around the xml */
virBufferStrcat(&buf, "<container>", buffer, "</container>", NULL);
if (virBufferError(&buf))
goto no_memory;
--
1.7.7.3
12 years, 11 months
[libvirt] [PATCH 0/2] patch pings
by Eric Blake
These are random patches in my tree that I've previously posted
with no review, but which I think are useful for inclusion in 0.9.8.
Eric Blake (2):
command: handle empty buffer argument correctly
build: require more tools from maintainers
bootstrap.conf | 15 +++++++++++++++
src/util/command.c | 13 ++++++++++++-
tests/commanddata/test9.log | 4 +++-
tests/commandtest.c | 13 ++++++++++++-
4 files changed, 42 insertions(+), 3 deletions(-)
--
1.7.7.3
12 years, 11 months
[libvirt] [PATCH] build: fix build at -O2 on rawhide
by Eric Blake
I had previously tested commit 059d746 with -O intentionally omitted
from my CFLAGS; but that means that I missed out on this warning
from gcc 4.6.2 when optimizations are enabled:
util/buf.c: In function 'virBufferGetIndent':
util/buf.c:86:1: error: function might be candidate for attribute 'pure' [-Werror=suggest-attribute=pure]
While it is probably a good idea to add the attributes and silence
this warning, it's also invasive; 'make -k' found more than 75 such
complaints. And it doesn't help that gcc 4.6.2 is still buggy
(coreutils reported a case where gcc 4.6.2 incorrectly suggested
marking a function pure that incremented a global variable; fixed
in gcc 4.7). So the best fix for now is to disable the warning.
It also doesn't help that I stumbled across another problem - gcc
documents that -Wsuggest-attribute=pure only warns if you use -O,
or if you use -fipa-pure-const. But in practice, when I omitted -O
but added -fipa-pure-const, the warnings are fickle - I got warnings
for simple compilation that disappeared when I also added -fPIC.
And the way libtool compiles things is with -fPIC first, then without
-fPIC but with errors sent to /dev/null - which meant that without
disabling -Wsuggest-attribute=pure, I got a compile error with no
message. :( See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10197
* m4/virt-compile-warnings.m4 (LIBVIRT_COMPILE_WARNINGS): Silence
-Wsuggest-attribute warnings for now.
---
Pushing under the build-breaker rule.
m4/virt-compile-warnings.m4 | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
index 213b3db..34a89c9 100644
--- a/m4/virt-compile-warnings.m4
+++ b/m4/virt-compile-warnings.m4
@@ -116,2 +116,2 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
gl_WARN_ADD([-fdiagnostics-show-option])
gl_WARN_ADD([-funit-at-a-time])
+ # Need -fipa-pure-const in order to make -Wsuggest-attribute=pure
+ # fire even without -O.
+ gl_WARN_ADD([-fipa-pure-const])
+ # We should eventually enable this, but right now there are at
+ # least 75 functions triggering warnings.
+ gl_WARN_ADD([-Wno-suggest-attribute=pure])
+ gl_WARN_ADD([-Wno-suggest-attribute=const])
+
if test "$enable_compile_warnings" = "error"
then
gl_WARN_ADD([-Werror])
--
1.7.7.3
12 years, 11 months
[libvirt] [PATCH 1/1] apparmor: allow tunnelled migrations.
by Serge Hallyn
The pathname for the pipe for tunnelled migration is unresolvable. The
libvirt apparmor driver therefore refuses access, causing migration to
fail. If we can't resolve the path, the worst that can happen is that
we should have given permission to the file but didn't. Otherwise
(especially since this is a /proc/$$/fd/N file) the file is already open
and libvirt won't be refused access by apparmor anyway.
Also adjust virt-aa-helper to allow access to the
*.tunnelmigrate.dest.name files.
Changelog: Dec 2: per jdstrand comment, also change the Error to a VIR_WARN.
For more information, see https://launchpad.net/bugs/869553.
Signed-off-by: Serge Hallyn <serge.hallyn(a)canonical.com>
---
src/security/security_apparmor.c | 6 +++---
src/security/virt-aa-helper.c | 4 ++++
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index 299dcc6..5e68da8 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -791,9 +791,9 @@ AppArmorSetImageFDLabel(virSecurityManagerPtr mgr,
}
if (virFileResolveLink(proc, &fd_path) < 0) {
- virSecurityReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("could not find path for descriptor"));
- return rc;
+ /* it's a deleted file, presumably. Ignore? */
+ VIR_WARN("could not find path for descriptor %s, skipping", proc);
+ return 0;
}
return reload_profile(mgr, vm, fd_path, true);
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 14399cc..4561bb9 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -1220,6 +1220,10 @@ main(int argc, char **argv)
LOCALSTATEDIR, ctl->def->name);
virBufferAsprintf(&buf, " \"/run/libvirt/**/%s.pid\" rwk,\n",
ctl->def->name);
+ virBufferAsprintf(&buf, " \"%s/run/libvirt/**/*.tunnelmigrate.dest.%s\" rw,\n",
+ LOCALSTATEDIR, ctl->def->name);
+ virBufferAsprintf(&buf, " \"/run/libvirt/**/*.tunnelmigrate.dest.%s\" rw,\n",
+ ctl->def->name);
if (ctl->files)
virBufferAdd(&buf, ctl->files, -1);
}
--
1.7.5.4
12 years, 11 months
[libvirt] [PATCH] [TCK] nwfilter:Follow changes to clean-traffic filter
by Stefan Berger
Follow the changes to the clean-traffic filter to pass the nwfilter tests.
---
scripts/nwfilter/nwfilterxml2fwallout/testvm.fwall.dat | 33 +++++++----------
1 file changed, 15 insertions(+), 18 deletions(-)
Index: libvirt-tck/scripts/nwfilter/nwfilterxml2fwallout/testvm.fwall.dat
===================================================================
--- libvirt-tck.orig/scripts/nwfilter/nwfilterxml2fwallout/testvm.fwall.dat
+++ libvirt-tck/scripts/nwfilter/nwfilterxml2fwallout/testvm.fwall.dat
@@ -3,34 +3,31 @@
#ebtables -t nat -L POSTROUTING | grep vnet0 | grep -v "^Bridge" | grep -v "^$"
-o vnet0 -j libvirt-O-vnet0
#ebtables -t nat -L libvirt-I-vnet0 | grep -v "^Bridge" | grep -v "^$"
--p IPv4 -j I-vnet0-ipv4
--p ARP -j I-vnet0-arp
+-j I-vnet0-mac
+-p IPv4 -j I-vnet0-ipv4-ip
+-p IPv4 -j ACCEPT
+-p ARP -j I-vnet0-arp-mac
+-p ARP -j I-vnet0-arp-ip
+-p ARP -j ACCEPT
-p 0x8035 -j I-vnet0-rarp
-p 0x835 -j ACCEPT
-j DROP
#ebtables -t nat -L libvirt-O-vnet0 | grep -v "^Bridge" | grep -v "^$"
-p IPv4 -j O-vnet0-ipv4
--p ARP -j O-vnet0-arp
+-p ARP -j ACCEPT
-p 0x8035 -j O-vnet0-rarp
-j DROP
-#ebtables -t nat -L I-vnet0-ipv4 | grep -v "^Bridge" | grep -v "^$"
--s ! 52:54:0:9f:33:da -j DROP
--p IPv4 --ip-src ! 10.1.1.1 -j DROP
+#ebtables -t nat -L I-vnet0-ipv4-ip | grep -v "^Bridge" | grep -v "^$"
+-p IPv4 --ip-src 0.0.0.0 --ip-proto udp --ip-sport 68 -j ACCEPT
+-p IPv4 --ip-src 10.1.1.1 -j RETURN
+-j DROP
#ebtables -t nat -L O-vnet0-ipv4 | grep -v "^Bridge" | grep -v "^$"
-j ACCEPT
-#ebtables -t nat -L I-vnet0-arp | grep -v "^Bridge" | grep -v "^$"
--s ! 52:54:0:9f:33:da -j DROP
--p ARP --arp-mac-src ! 52:54:0:9f:33:da -j DROP
--p ARP --arp-ip-src ! 10.1.1.1 -j DROP
--p ARP --arp-op Request -j ACCEPT
--p ARP --arp-op Reply -j ACCEPT
+#ebtables -t nat -L I-vnet0-arp-mac | grep -v "^Bridge" | grep -v "^$"
+-p ARP --arp-mac-src 52:54:0:9f:33:da -j RETURN
-j DROP
-#ebtables -t nat -L O-vnet0-arp | grep -v "^Bridge" | grep -v "^$"
--p ARP --arp-gratuitous -j ACCEPT
--p ARP --arp-op Reply --arp-mac-dst ! 52:54:0:9f:33:da -j DROP
--p ARP --arp-ip-dst ! 10.1.1.1 -j DROP
--p ARP --arp-op Request -j ACCEPT
--p ARP --arp-op Reply -j ACCEPT
+#ebtables -t nat -L I-vnet0-arp-ip | grep -v "^Bridge" | grep -v "^$"
+-p ARP --arp-ip-src 10.1.1.1 -j RETURN
-j DROP
#ip6tables -L FI-vnet0 -n
Chain FI-vnet0 (1 references)
12 years, 11 months