[libvirt] [PATCH] util: fix "make rpm" when viratomic.h is used
by Laine Stump
Although src/util/viratomic.h has been added to the repo, up until now
it hasn't been used. Stefan Berger is using it in his proposed dhcp
snooping patches, and an rpm build with those patches failed due to
viratomic.h not being packed up with the rest of the sources.
Pushed under build-breaker + trivial rules (although it only breaks
the build if you add a use of viratomic.h, it is rather trivial :-)
---
src/Makefile.am | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/Makefile.am b/src/Makefile.am
index d727889..5693fb4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -79,6 +79,7 @@ UTIL_SOURCES = \
util/threadpool.c util/threadpool.h \
util/uuid.c util/uuid.h \
util/util.c util/util.h \
+ util/viratomic.h \
util/viraudit.c util/viraudit.h \
util/virauth.c util/virauth.h \
util/virauthconfig.c util/virauthconfig.h \
--
1.7.10.2
12 years, 6 months
[libvirt] [PATCH] fix make syntax-check failed
by Wen Congyang
---
tools/virsh.c | 170 ++++++++++++++++++++++++++++----------------------------
1 files changed, 85 insertions(+), 85 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index a934c13..0e41d00 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -3502,16 +3502,16 @@ cmdSaveImageEdit(vshControl *ctl, const vshCmd *cmd)
if (vshCommandOptString(cmd, "file", &file) <= 0)
return false;
- #define EDIT_GET_XML \
- virDomainSaveImageGetXMLDesc(ctl->conn, file, getxml_flags)
- #define EDIT_NOT_CHANGED \
- vshPrint(ctl, _("Saved image %s XML configuration " \
- "not changed.\n"), file); \
- ret = true; goto edit_cleanup;
- #define EDIT_DEFINE \
- virDomainSaveImageDefineXML(ctl->conn, file, doc_edited, define_flags)
- #define EDIT_FREE /* */
- #include "virsh-edit.c"
+#define EDIT_GET_XML \
+ virDomainSaveImageGetXMLDesc(ctl->conn, file, getxml_flags)
+#define EDIT_NOT_CHANGED \
+ vshPrint(ctl, _("Saved image %s XML configuration " \
+ "not changed.\n"), file); \
+ ret = true; goto edit_cleanup;
+#define EDIT_DEFINE \
+ virDomainSaveImageDefineXML(ctl->conn, file, doc_edited, define_flags)
+#define EDIT_FREE /* */
+#include "virsh-edit.c"
vshPrint(ctl, _("State file %s edited.\n"), file);
ret = true;
@@ -8584,17 +8584,17 @@ cmdInterfaceEdit(vshControl *ctl, const vshCmd *cmd)
if (iface == NULL)
goto cleanup;
- #define EDIT_GET_XML virInterfaceGetXMLDesc(iface, flags)
- #define EDIT_NOT_CHANGED \
- vshPrint(ctl, _("Interface %s XML configuration not changed.\n"), \
- virInterfaceGetName(iface)); \
- ret = true; goto edit_cleanup;
- #define EDIT_DEFINE \
- (iface_edited = virInterfaceDefineXML(ctl->conn, doc_edited, 0))
- #define EDIT_FREE \
- if (iface_edited) \
- virInterfaceFree(iface_edited);
- #include "virsh-edit.c"
+#define EDIT_GET_XML virInterfaceGetXMLDesc(iface, flags)
+#define EDIT_NOT_CHANGED \
+ vshPrint(ctl, _("Interface %s XML configuration not changed.\n"), \
+ virInterfaceGetName(iface)); \
+ ret = true; goto edit_cleanup;
+#define EDIT_DEFINE \
+ (iface_edited = virInterfaceDefineXML(ctl->conn, doc_edited, 0))
+#define EDIT_FREE \
+ if (iface_edited) \
+ virInterfaceFree(iface_edited);
+#include "virsh-edit.c"
vshPrint(ctl, _("Interface %s XML configuration edited.\n"),
virInterfaceGetName(iface));
@@ -9978,18 +9978,18 @@ cmdNWFilterEdit(vshControl *ctl, const vshCmd *cmd)
if (nwfilter == NULL)
goto cleanup;
- #define EDIT_GET_XML virNWFilterGetXMLDesc(nwfilter, 0)
- #define EDIT_NOT_CHANGED \
- vshPrint(ctl, _("Network filter %s XML " \
- "configuration not changed.\n"), \
- virNWFilterGetName(nwfilter)); \
- ret = true; goto edit_cleanup;
- #define EDIT_DEFINE \
- (nwfilter_edited = virNWFilterDefineXML(ctl->conn, doc_edited))
- #define EDIT_FREE \
- if (nwfilter_edited) \
- virNWFilterFree(nwfilter);
- #include "virsh-edit.c"
+#define EDIT_GET_XML virNWFilterGetXMLDesc(nwfilter, 0)
+#define EDIT_NOT_CHANGED \
+ vshPrint(ctl, _("Network filter %s XML " \
+ "configuration not changed.\n"), \
+ virNWFilterGetName(nwfilter)); \
+ ret = true; goto edit_cleanup;
+#define EDIT_DEFINE \
+ (nwfilter_edited = virNWFilterDefineXML(ctl->conn, doc_edited))
+#define EDIT_FREE \
+ if (nwfilter_edited) \
+ virNWFilterFree(nwfilter);
+#include "virsh-edit.c"
vshPrint(ctl, _("Network filter %s XML configuration edited.\n"),
virNWFilterGetName(nwfilter));
@@ -15761,17 +15761,17 @@ cmdEdit(vshControl *ctl, const vshCmd *cmd)
if (dom == NULL)
goto cleanup;
- #define EDIT_GET_XML virDomainGetXMLDesc(dom, flags)
- #define EDIT_NOT_CHANGED \
- vshPrint(ctl, _("Domain %s XML configuration not changed.\n"), \
- virDomainGetName (dom)); \
- ret = true; goto edit_cleanup;
- #define EDIT_DEFINE \
- (dom_edited = virDomainDefineXML(ctl->conn, doc_edited))
- #define EDIT_FREE \
- if (dom_edited) \
- virDomainFree(dom_edited);
- #include "virsh-edit.c"
+#define EDIT_GET_XML virDomainGetXMLDesc(dom, flags)
+#define EDIT_NOT_CHANGED \
+ vshPrint(ctl, _("Domain %s XML configuration not changed.\n"), \
+ virDomainGetName (dom)); \
+ ret = true; goto edit_cleanup;
+#define EDIT_DEFINE \
+ (dom_edited = virDomainDefineXML(ctl->conn, doc_edited))
+#define EDIT_FREE \
+ if (dom_edited) \
+ virDomainFree(dom_edited);
+#include "virsh-edit.c"
vshPrint(ctl, _("Domain %s XML configuration edited.\n"),
virDomainGetName(dom));
@@ -15817,17 +15817,17 @@ cmdNetworkEdit(vshControl *ctl, const vshCmd *cmd)
if (network == NULL)
goto cleanup;
- #define EDIT_GET_XML virNetworkGetXMLDesc(network, flags)
- #define EDIT_NOT_CHANGED \
- vshPrint(ctl, _("Network %s XML configuration not changed.\n"), \
- virNetworkGetName (network)); \
- ret = true; goto edit_cleanup;
- #define EDIT_DEFINE \
- (network_edited = virNetworkDefineXML(ctl->conn, doc_edited))
- #define EDIT_FREE \
- if (network_edited) \
- virNetworkFree(network_edited);
- #include "virsh-edit.c"
+#define EDIT_GET_XML virNetworkGetXMLDesc(network, flags)
+#define EDIT_NOT_CHANGED \
+ vshPrint(ctl, _("Network %s XML configuration not changed.\n"), \
+ virNetworkGetName (network)); \
+ ret = true; goto edit_cleanup;
+#define EDIT_DEFINE \
+ (network_edited = virNetworkDefineXML(ctl->conn, doc_edited))
+#define EDIT_FREE \
+ if (network_edited) \
+ virNetworkFree(network_edited);
+#include "virsh-edit.c"
vshPrint(ctl, _("Network %s XML configuration edited.\n"),
virNetworkGetName(network));
@@ -15872,17 +15872,17 @@ cmdPoolEdit(vshControl *ctl, const vshCmd *cmd)
if (pool == NULL)
goto cleanup;
- #define EDIT_GET_XML virStoragePoolGetXMLDesc(pool, flags)
- #define EDIT_NOT_CHANGED \
- vshPrint(ctl, _("Pool %s XML configuration not changed.\n"), \
- virStoragePoolGetName (pool)); \
- ret = true; goto edit_cleanup;
- #define EDIT_DEFINE \
- (pool_edited = virStoragePoolDefineXML(ctl->conn, doc_edited, 0))
- #define EDIT_FREE \
- if (pool_edited) \
- virStoragePoolFree(pool_edited);
- #include "virsh-edit.c"
+#define EDIT_GET_XML virStoragePoolGetXMLDesc(pool, flags)
+#define EDIT_NOT_CHANGED \
+ vshPrint(ctl, _("Pool %s XML configuration not changed.\n"), \
+ virStoragePoolGetName (pool)); \
+ ret = true; goto edit_cleanup;
+#define EDIT_DEFINE \
+ (pool_edited = virStoragePoolDefineXML(ctl->conn, doc_edited, 0))
+#define EDIT_FREE \
+ if (pool_edited) \
+ virStoragePoolFree(pool_edited);
+#include "virsh-edit.c"
vshPrint(ctl, _("Pool %s XML configuration edited.\n"),
virStoragePoolGetName(pool));
@@ -16315,25 +16315,25 @@ cmdSnapshotEdit(vshControl *ctl, const vshCmd *cmd)
&snapshot, &name) < 0)
goto cleanup;
- #define EDIT_GET_XML \
- virDomainSnapshotGetXMLDesc(snapshot, getxml_flags)
- #define EDIT_NOT_CHANGED \
- /* Depending on flags, we re-edit even if XML is unchanged. */ \
- if (!(define_flags & VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT)) { \
- vshPrint(ctl, \
- _("Snapshot %s XML configuration not changed.\n"), \
- name); \
- ret = true; \
- goto cleanup; \
- }
- #define EDIT_DEFINE \
- (strstr(doc, "<state>disk-snapshot</state>") ? \
- define_flags |= VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY : 0), \
- edited = virDomainSnapshotCreateXML(dom, doc_edited, define_flags)
- #define EDIT_FREE \
- if (edited) \
- virDomainSnapshotFree(edited);
- #include "virsh-edit.c"
+#define EDIT_GET_XML \
+ virDomainSnapshotGetXMLDesc(snapshot, getxml_flags)
+#define EDIT_NOT_CHANGED \
+ /* Depending on flags, we re-edit even if XML is unchanged. */ \
+ if (!(define_flags & VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT)) { \
+ vshPrint(ctl, \
+ _("Snapshot %s XML configuration not changed.\n"), \
+ name); \
+ ret = true; \
+ goto cleanup; \
+ }
+#define EDIT_DEFINE \
+ (strstr(doc, "<state>disk-snapshot</state>") ? \
+ define_flags |= VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY : 0), \
+ edited = virDomainSnapshotCreateXML(dom, doc_edited, define_flags)
+#define EDIT_FREE \
+ if (edited) \
+ virDomainSnapshotFree(edited);
+#include "virsh-edit.c"
edited_name = virDomainSnapshotGetName(edited);
if (STREQ(name, edited_name)) {
--
1.7.1
12 years, 6 months
[libvirt] [PATCH] build: fix sc_prohibit_readlink
by Eric Blake
I noticed this during 'make syntax-check':
prohibit_readlink
grep: Unmatched ( or \(
* cfg.mk (exclude_file_name_regexp--sc_prohibit_readlink): Fix
mismatched '('.
---
Pushing under the trivial rule.
cfg.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cfg.mk b/cfg.mk
index 5d38137..66d18d2 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -801,7 +801,7 @@ exclude_file_name_regexp--sc_prohibit_raw_allocation = \
^(src/util/memory\.[ch]|examples/.*)$$
exclude_file_name_regexp--sc_prohibit_readlink = \
- ^(src/(util/util|lxc/lxc_container)\.c$$
+ ^src/(util/util|lxc/lxc_container)\.c$$
exclude_file_name_regexp--sc_prohibit_setuid = ^src/util/util\.c$$
--
1.7.10.2
12 years, 6 months
[libvirt] [PATCH v2] file: Log closing filedescriptors
by Jiri Denemark
EBADF errors are logged as warnings as they normally indicate a double
close bug. This patch also provides VIR_MASS_CLOSE helper to be user in
the only case of mass close after fork when EBADF should rather be
ignored.
---
src/util/command.c | 2 +-
src/util/virfile.c | 31 +++++++++++++++++++++++--------
src/util/virfile.h | 11 ++++++++---
3 files changed, 32 insertions(+), 12 deletions(-)
diff --git a/src/util/command.c b/src/util/command.c
index dcac112..16defb1 100644
--- a/src/util/command.c
+++ b/src/util/command.c
@@ -529,7 +529,7 @@ virExecWithHook(const char *const*argv,
continue;
if (!keepfd || !virCommandFDIsSet(i, keepfd, keepfd_size)) {
tmpfd = i;
- VIR_FORCE_CLOSE(tmpfd);
+ VIR_MASS_CLOSE(tmpfd);
} else if (virSetInherit(i, true) < 0) {
virReportSystemError(errno, _("failed to preserve fd %d"), i);
goto fork_error;
diff --git a/src/util/virfile.c b/src/util/virfile.c
index db3d737..a0000d0 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -35,6 +35,7 @@
#include "configmake.h"
#include "memory.h"
#include "virterror_internal.h"
+#include "logging.h"
#define VIR_FROM_THIS VIR_FROM_NONE
#define virFileError(code, ...) \
@@ -42,19 +43,33 @@
__FUNCTION__, __LINE__, __VA_ARGS__)
-int virFileClose(int *fdptr, bool preserve_errno)
+int virFileClose(int *fdptr, bool preserve_errno, bool ignore_EBADF)
{
int saved_errno = 0;
int rc = 0;
- if (*fdptr >= 0) {
- if (preserve_errno)
- saved_errno = errno;
- rc = close(*fdptr);
- *fdptr = -1;
- if (preserve_errno)
- errno = saved_errno;
+ if (*fdptr < 0)
+ return 0;
+
+ if (preserve_errno)
+ saved_errno = errno;
+
+ rc = close(*fdptr);
+ if (rc < 0) {
+ if (errno == EBADF) {
+ if (!ignore_EBADF)
+ VIR_WARN("Tried to close invalid fd %d", *fdptr);
+ } else {
+ char ebuf[1024] ATTRIBUTE_UNUSED;
+ VIR_DEBUG("Failed to close fd %d: %s",
+ *fdptr, virStrerror(errno, ebuf, sizeof(ebuf)));
+ }
+ } else {
+ VIR_DEBUG("Closed fd %d", *fdptr);
}
+ *fdptr = -1;
+ if (preserve_errno)
+ errno = saved_errno;
return rc;
}
diff --git a/src/util/virfile.h b/src/util/virfile.h
index 05f5048..c033248 100644
--- a/src/util/virfile.h
+++ b/src/util/virfile.h
@@ -33,13 +33,14 @@
/* Don't call these directly - use the macros below */
-int virFileClose(int *fdptr, bool preserve_errno) ATTRIBUTE_RETURN_CHECK;
+int virFileClose(int *fdptr, bool preserve_errno, bool ignore_EBADF)
+ ATTRIBUTE_RETURN_CHECK;
int virFileFclose(FILE **file, bool preserve_errno) ATTRIBUTE_RETURN_CHECK;
FILE *virFileFdopen(int *fdptr, const char *mode) ATTRIBUTE_RETURN_CHECK;
/* For use on normal paths; caller must check return value,
and failure sets errno per close. */
-# define VIR_CLOSE(FD) virFileClose(&(FD), false)
+# define VIR_CLOSE(FD) virFileClose(&(FD), false, false)
# define VIR_FCLOSE(FILE) virFileFclose(&(FILE), false)
/* Wrapper around fdopen that consumes fd on success. */
@@ -47,9 +48,13 @@ FILE *virFileFdopen(int *fdptr, const char *mode) ATTRIBUTE_RETURN_CHECK;
/* For use on cleanup paths; errno is unaffected by close,
and no return value to worry about. */
-# define VIR_FORCE_CLOSE(FD) ignore_value(virFileClose(&(FD), true))
+# define VIR_FORCE_CLOSE(FD) ignore_value(virFileClose(&(FD), true, false))
# define VIR_FORCE_FCLOSE(FILE) ignore_value(virFileFclose(&(FILE), true))
+/* Similar VIR_FORCE_CLOSE() but ignores EBADF errors since they are expected
+ * during mass close after fork(). */
+# define VIR_MASS_CLOSE(FD) ignore_value(virFileClose(&(FD), true, true))
+
/* Opaque type for managing a wrapper around a fd. */
struct _virFileWrapperFd;
--
1.7.10.2
12 years, 6 months
[libvirt] [PATCH] virsh: use keepalive protocol in virsh for migration
by Guannan Ren
Bugzilla:https://bugzilla.redhat.com/show_bug.cgi?id=822839
For non-p2p migration, if the network is down in the process of migrate,
The virsh client will hang up for a fair long time. The patch will add
keepalive into virsh to determine the status of network connection with
remote libvirtd, aboring migration job after 30 seconds later since
disconnection.
---
tools/virsh.c | 29 +++++++++++++++++++++++------
1 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 5226bd8..9099328 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -414,13 +414,14 @@ typedef struct __vshCtrlData {
vshControl *ctl;
const vshCmd *cmd;
int writefd;
+ virConnectPtr dconn;
} vshCtrlData;
typedef void (*jobWatchTimeoutFunc) (vshControl *ctl, virDomainPtr dom,
void *opaque);
static bool
-vshWatchJob(vshControl *ctl,
+vshWatchJob(vshCtrlData *data,
virDomainPtr dom,
bool verbose,
int pipe_fd,
@@ -3277,6 +3278,7 @@ cmdSave(vshControl *ctl, const vshCmd *cmd)
data.ctl = ctl;
data.cmd = cmd;
data.writefd = p[1];
+ data.dconn = NULL;
if (virThreadCreate(&workerThread,
true,
@@ -3284,7 +3286,7 @@ cmdSave(vshControl *ctl, const vshCmd *cmd)
&data) < 0)
goto cleanup;
- ret = vshWatchJob(ctl, dom, verbose, p[0], 0, NULL, NULL, _("Save"));
+ ret = vshWatchJob(&data, dom, verbose, p[0], 0, NULL, NULL, _("Save"));
virThreadJoin(&workerThread);
@@ -3584,6 +3586,7 @@ cmdManagedSave(vshControl *ctl, const vshCmd *cmd)
data.ctl = ctl;
data.cmd = cmd;
data.writefd = p[1];
+ data.dconn = NULL;
if (virThreadCreate(&workerThread,
true,
@@ -3591,7 +3594,7 @@ cmdManagedSave(vshControl *ctl, const vshCmd *cmd)
&data) < 0)
goto cleanup;
- ret = vshWatchJob(ctl, dom, verbose, p[0], 0,
+ ret = vshWatchJob(&data, dom, verbose, p[0], 0,
NULL, NULL, _("Managedsave"));
virThreadJoin(&workerThread);
@@ -4062,6 +4065,7 @@ cmdDump(vshControl *ctl, const vshCmd *cmd)
data.ctl = ctl;
data.cmd = cmd;
data.writefd = p[1];
+ data.dconn = NULL;
if (virThreadCreate(&workerThread,
true,
@@ -4069,7 +4073,7 @@ cmdDump(vshControl *ctl, const vshCmd *cmd)
&data) < 0)
goto cleanup;
- ret = vshWatchJob(ctl, dom, verbose, p[0], 0, NULL, NULL, _("Dump"));
+ ret = vshWatchJob(&data, dom, verbose, p[0], 0, NULL, NULL, _("Dump"));
virThreadJoin(&workerThread);
@@ -7189,6 +7193,10 @@ doMigrate (void *opaque)
dconn = virConnectOpenAuth (desturi, virConnectAuthPtrDefault, 0);
if (!dconn) goto out;
+ data->dconn = dconn;
+ if (virConnectSetKeepAlive(dconn, 5, 5) < 0)
+ vshDebug(ctl, VSH_ERR_WARNING, "migrate: Failed to start keepalive\n");
+
ddom = virDomainMigrate2(dom, dconn, xml, flags, dname, migrateuri, 0);
if (ddom) {
virDomainFree(ddom);
@@ -7244,7 +7252,7 @@ vshMigrationTimeout(vshControl *ctl,
}
static bool
-vshWatchJob(vshControl *ctl,
+vshWatchJob(vshCtrlData *data,
virDomainPtr dom,
bool verbose,
int pipe_fd,
@@ -7262,6 +7270,7 @@ vshWatchJob(vshControl *ctl,
char retchar;
bool functionReturn = false;
sigset_t sigmask, oldsigmask;
+ vshControl *ctl = data->ctl;
sigemptyset(&sigmask);
sigaddset(&sigmask, SIGINT);
@@ -7305,6 +7314,13 @@ repoll:
goto cleanup;
}
+ if (data->dconn && virConnectIsAlive(data->dconn) <= 0) {
+ virDomainAbortJob(dom);
+ vshError(ctl, "%s",
+ _("Lost connection to destination host"));
+ goto cleanup;
+ }
+
GETTIMEOFDAY(&curr);
if (timeout && (((int)(curr.tv_sec - start.tv_sec) * 1000 +
(int)(curr.tv_usec - start.tv_usec) / 1000) >
@@ -7378,13 +7394,14 @@ cmdMigrate(vshControl *ctl, const vshCmd *cmd)
data.ctl = ctl;
data.cmd = cmd;
data.writefd = p[1];
+ data.dconn = NULL;
if (virThreadCreate(&workerThread,
true,
doMigrate,
&data) < 0)
goto cleanup;
- functionReturn = vshWatchJob(ctl, dom, verbose, p[0], timeout,
+ functionReturn = vshWatchJob(&data, dom, verbose, p[0], timeout,
vshMigrationTimeout, NULL, _("Migration"));
virThreadJoin(&workerThread);
--
1.7.7.5
12 years, 6 months
[libvirt] [PATCH] syntax-check: Don't check virsh.c for preprocessor indentation
by Michal Privoznik
With recent re-edit commits we have #define and #include not
indented as it ought to be from preprocessor POV. However, these
are part of a function, therefore they are indented well.
To solve this, skip preprocessor indentation check on virsh.c
---
cfg.mk | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index 5d38137..0153024 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -830,3 +830,6 @@ exclude_file_name_regexp--sc_unmarked_diagnostics = \
^(docs/apibuild.py|tests/virt-aa-helper-test)$$
exclude_file_name_regexp--sc_size_of_brackets = cfg.mk
+
+exclude_file_name_regexp--sc_preprocessor_indentation = \
+ ^tools/virsh.c$$
--
1.7.8.5
12 years, 6 months
[libvirt] [libvirt-glib] API to get/set domain title
by Zeeshan Ali (Khattak)
From: "Zeeshan Ali (Khattak)" <zeeshanak(a)gnome.org>
---
libvirt-gconfig/libvirt-gconfig-domain.c | 33 ++++++++++++++++++++++++++++++
libvirt-gconfig/libvirt-gconfig-domain.h | 2 ++
libvirt-gconfig/libvirt-gconfig.sym | 2 ++
3 files changed, 37 insertions(+)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c b/libvirt-gconfig/libvirt-gconfig-domain.c
index 7477400..d5a676a 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain.c
@@ -39,6 +39,7 @@ G_DEFINE_TYPE(GVirConfigDomain, gvir_config_domain, GVIR_CONFIG_TYPE_OBJECT);
enum {
PROP_0,
PROP_NAME,
+ PROP_TITLE,
PROP_DESCRIPTION,
PROP_MEMORY,
PROP_VCPU,
@@ -56,6 +57,9 @@ static void gvir_config_domain_get_property(GObject *object,
case PROP_NAME:
g_value_set_string(value, gvir_config_domain_get_name(domain));
break;
+ case PROP_TITLE:
+ g_value_set_string(value, gvir_config_domain_get_title(domain));
+ break;
case PROP_DESCRIPTION:
g_value_set_string(value, gvir_config_domain_get_description(domain));
break;
@@ -85,6 +89,9 @@ static void gvir_config_domain_set_property(GObject *object,
case PROP_NAME:
gvir_config_domain_set_name(domain, g_value_get_string(value));
break;
+ case PROP_TITLE:
+ gvir_config_domain_set_title(domain, g_value_get_string(value));
+ break;
case PROP_DESCRIPTION:
gvir_config_domain_set_description(domain, g_value_get_string(value));
break;
@@ -121,6 +128,14 @@ static void gvir_config_domain_class_init(GVirConfigDomainClass *klass)
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
g_object_class_install_property(object_class,
+ PROP_TITLE,
+ g_param_spec_string("title",
+ "Title",
+ "A short description - title - of the domain",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property(object_class,
PROP_DESCRIPTION,
g_param_spec_string("description",
"Description",
@@ -216,6 +231,12 @@ const char *gvir_config_domain_get_name(GVirConfigDomain *domain)
"name");
}
+const char *gvir_config_domain_get_title(GVirConfigDomain *domain)
+{
+ return gvir_config_object_get_node_content(GVIR_CONFIG_OBJECT(domain),
+ "title");
+}
+
/**
* gvir_config_domain_set_name:
* @domain: a #GVirConfigDomain
@@ -228,6 +249,18 @@ void gvir_config_domain_set_name(GVirConfigDomain *domain, const char *name)
g_object_notify(G_OBJECT(domain), "name");
}
+/**
+ * gvir_config_domain_set_title:
+ * @domain: a #GVirConfigDomain
+ * @title: (allow-none):
+ */
+void gvir_config_domain_set_title(GVirConfigDomain *domain, const char *title)
+{
+ gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(domain),
+ "title", title);
+ g_object_notify(G_OBJECT(domain), "title");
+}
+
const char *gvir_config_domain_get_description(GVirConfigDomain *domain)
{
return gvir_config_object_get_node_content(GVIR_CONFIG_OBJECT(domain),
diff --git a/libvirt-gconfig/libvirt-gconfig-domain.h b/libvirt-gconfig/libvirt-gconfig-domain.h
index 5deb58e..af8b86a 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain.h
@@ -120,6 +120,8 @@ void gvir_config_domain_set_os(GVirConfigDomain *domain,
GVirConfigDomainOs *os);
void gvir_config_domain_set_seclabel(GVirConfigDomain *domain,
GVirConfigDomainSeclabel *seclabel);
+const char *gvir_config_domain_get_title(GVirConfigDomain *domain);
+void gvir_config_domain_set_title(GVirConfigDomain *domain, const char *title);
void gvir_config_domain_set_devices(GVirConfigDomain *domain,
GList *devices);
void gvir_config_domain_add_device(GVirConfigDomain *domain,
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 10057a8..761a96b 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -377,6 +377,8 @@ LIBVIRT_GCONFIG_0.0.8 {
LIBVIRT_GCONFIG_0.0.9 {
global:
gvir_config_domain_get_os;
+ gvir_config_domain_get_title;
+ gvir_config_domain_set_title;
gvir_config_domain_get_virt_type;
gvir_config_domain_os_get_arch;
--
1.7.10.2
12 years, 6 months
[libvirt] [PATCH] Fixes for check and rpm builds without sanlock (and qemu)
by Martin Kletzander
Apart from the non-sanlock check build, there is also a little fix for
qemu (EXTRA_DIST had qemu.conf and others inside even if the build was
supposed to be without qemu).
---
libvirt.spec.in | 5 +++++
src/Makefile.am | 6 +++++-
2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index d4e43f6..3c544f1 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1232,6 +1232,11 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_qemu.aug
%endif
%find_lang %{name}
+%if ! %{with_sanlock}
+rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirt_sanlock.aug
+rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirt_sanlock.aug
+%endif
+
%if ! %{with_lxc}
rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/libvirtd_lxc.aug
rm -f $RPM_BUILD_ROOT%{_datadir}/augeas/lenses/tests/test_libvirtd_lxc.aug
diff --git a/src/Makefile.am b/src/Makefile.am
index 23747d7..e56a8ef 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -785,9 +785,9 @@ augeas_DATA += qemu/libvirtd_qemu.aug
augeastest_DATA += qemu/test_libvirtd_qemu.aug
CLEANFILES += qemu/test_libvirtd_qemu.aug
-endif
EXTRA_DIST += qemu/qemu.conf qemu/libvirtd_qemu.aug \
qemu/test_libvirtd_qemu.aug.in qemu/THREADS.txt
+endif
if WITH_LXC
@@ -1147,6 +1147,7 @@ else
check-augeas-lxc:
endif
+if HAVE_SANLOCK
test_libvirt_sanlock.aug: locking/test_libvirt_sanlock.aug.in \
locking/qemu-sanlock.conf $(AUG_GENTEST)
$(AUG_GENTEST) locking/qemu-sanlock.conf $< $@
@@ -1155,6 +1156,9 @@ check-augeas-sanlock: test_libvirt_sanlock.aug
$(AM_V_GEN)if test -x '$(AUGPARSE)'; then \
'$(AUGPARSE)' -I $(srcdir)/locking test_libvirt_sanlock.aug; \
fi
+else
+check-augeas-sanlock:
+endif
#
# Build our version script. This is composed of three parts:
--
1.7.8.6
12 years, 6 months
[libvirt] can't get right capabilities
by Li Zhang
Hi,
I am trying to use x86 machine to create VMs.
But one error occurs.
[root@mcd kvm-test]# virsh create test.xml
error: Failed to create domain from test.xml
error: unknown OS type hvm
My xml file is as the following:
<domain type='kvm'>
<name>test</name>
<memory>524288</memory>
<memorybacking>
<hugepages/>
</memorybacking>
<vcpu>2</vcpu>
<os>
<type arch='x86_64' machine='pc'>hvm</type>
</os>
<features>
<acpi/>
</features>
<clock offset='utc'/>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type='file' device='disk' >
<driver name='qemu' type='raw'/>
<source file='/home/zhlbj/kvm-test/disk1'/>
<target dev='sda' bus='scsi'/>
</disk>
<interface type='bridge'>
<source bridge='virbr0'/>
<mac address='52:54:00:19:bc:0c'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<memballoon model="none"/>
</devices>
</domain>
I check kvm module, it is available.
[root@mcd kvm-test]# lsmod |grep kvm
kvm_intel 119308 4
kvm 344876 1 kvm_intel
But I tried the capabilities, it is not right.
There is no guest capabilities.
<capabilities>
<host>
<uuid>d4ff0166-0f8b-e111-ab17-78a277034000</uuid>
<cpu>
<arch>x86_64</arch>
<model>Nehalem</model>
<vendor>Intel</vendor>
<topology sockets='1' cores='4' threads='1'/>
<feature name='rdtscp'/>
<feature name='avx'/>
<feature name='osxsave'/>
<feature name='xsave'/>
<feature name='tsc-deadline'/>
<feature name='x2apic'/>
<feature name='pdcm'/>
<feature name='xtpr'/>
<feature name='tm2'/>
<feature name='est'/>
<feature name='smx'/>
<feature name='vmx'/>
<feature name='ds_cpl'/>
<feature name='monitor'/>
<feature name='dtes64'/>
<feature name='pclmuldq'/>
<feature name='pbe'/>
<feature name='tm'/>
<feature name='ht'/>
<feature name='ss'/>
<feature name='acpi'/>
<feature name='ds'/>
<feature name='vme'/>
</cpu>
<power_management>
<suspend_mem/>
<suspend_disk/>
<suspend_hybrid/>
</power_management>
<migration_features>
<live/>
<uri_transports>
<uri_transport>tcp</uri_transport>
</uri_transports>
</migration_features>
<secmodel>
<model>selinux</model>
<doi>0</doi>
</secmodel>
</host>
</capabilities>
This problem occurs some times.
When I tried to find this problem, it didn't occur.
Now it occurs again. It's a little strange.
Is there anything I miss?
--
Best Regards
Li
IBM LTC, China System&Technology Lab, Beijing
12 years, 6 months