[libvirt] [PATCH] bhyve: monitor: do not override domain's privateData
by Roman Bogorodskiy
Current monitor code overrides domain object's privateData, e.g.
in virBhyveProcessStart():
vm->privateData = bhyveMonitorOpen(vm, driver);
where bhyveMonitorPtr() returns bhyveMonitorPtr.
This is not right thing to do, so make bhyveMonitorPtr
a part of the bhyveDomainObjPrivate struct and change related code
accordingly.
---
src/bhyve/bhyve_domain.h | 4 ++++
src/bhyve/bhyve_monitor.c | 36 +++++++++++++++++++-----------------
src/bhyve/bhyve_process.c | 11 +++++++----
3 files changed, 30 insertions(+), 21 deletions(-)
diff --git a/src/bhyve/bhyve_domain.h b/src/bhyve/bhyve_domain.h
index b8ef22a..0a60392 100644
--- a/src/bhyve/bhyve_domain.h
+++ b/src/bhyve/bhyve_domain.h
@@ -26,11 +26,15 @@
# include "domain_addr.h"
# include "domain_conf.h"
+# include "bhyve_monitor.h"
+
typedef struct _bhyveDomainObjPrivate bhyveDomainObjPrivate;
typedef bhyveDomainObjPrivate *bhyveDomainObjPrivatePtr;
struct _bhyveDomainObjPrivate {
virDomainPCIAddressSetPtr pciaddrs;
bool persistentAddrs;
+
+ bhyveMonitorPtr mon;
};
extern virDomainXMLPrivateDataCallbacks virBhyveDriverPrivateDataCallbacks;
diff --git a/src/bhyve/bhyve_monitor.c b/src/bhyve/bhyve_monitor.c
index 1316720..37c9e79 100644
--- a/src/bhyve/bhyve_monitor.c
+++ b/src/bhyve/bhyve_monitor.c
@@ -27,6 +27,7 @@
#include <sys/time.h>
#include <sys/wait.h>
+#include "bhyve_domain.h"
#include "bhyve_monitor.h"
#include "bhyve_process.h"
#include "viralloc.h"
@@ -41,7 +42,6 @@ VIR_LOG_INIT("bhyve.bhyve_monitor");
struct _bhyveMonitor {
int kq;
int watch;
- virDomainObjPtr vm;
bhyveConnPtr driver;
};
@@ -49,7 +49,9 @@ static void
bhyveMonitorIO(int watch, int kq, int events ATTRIBUTE_UNUSED, void *opaque)
{
const struct timespec zerowait = { 0, 0 };
- bhyveMonitorPtr mon = opaque;
+ virDomainObjPtr vm = opaque;
+ bhyveDomainObjPrivatePtr priv = vm->privateData;
+ bhyveMonitorPtr mon = priv->mon;
struct kevent kev;
int rc, status;
@@ -75,10 +77,10 @@ bhyveMonitorIO(int watch, int kq, int events ATTRIBUTE_UNUSED, void *opaque)
}
if (kev.filter == EVFILT_PROC && (kev.fflags & NOTE_EXIT) != 0) {
- if ((pid_t)kev.ident != mon->vm->pid) {
+ if ((pid_t)kev.ident != vm->pid) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("event from unexpected proc %ju!=%ju"),
- (uintmax_t)mon->vm->pid, (uintmax_t)kev.ident);
+ (uintmax_t)vm->pid, (uintmax_t)kev.ident);
return;
}
@@ -86,28 +88,28 @@ bhyveMonitorIO(int watch, int kq, int events ATTRIBUTE_UNUSED, void *opaque)
if (WIFSIGNALED(status) && WCOREDUMP(status)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Guest %s got signal %d and crashed"),
- mon->vm->def->name,
+ vm->def->name,
WTERMSIG(status));
- virBhyveProcessStop(mon->driver, mon->vm,
+ virBhyveProcessStop(mon->driver, vm,
VIR_DOMAIN_SHUTOFF_CRASHED);
} else if (WIFEXITED(status)) {
if (WEXITSTATUS(status) == 0) {
/* 0 - reboot */
/* TODO: Implementing reboot is a little more complicated. */
VIR_INFO("Guest %s rebooted; destroying domain.",
- mon->vm->def->name);
- virBhyveProcessStop(mon->driver, mon->vm,
+ vm->def->name);
+ virBhyveProcessStop(mon->driver, vm,
VIR_DOMAIN_SHUTOFF_SHUTDOWN);
} else if (WEXITSTATUS(status) < 3) {
/* 1 - shutdown, 2 - halt, 3 - triple fault. others - error */
VIR_INFO("Guest %s shut itself down; destroying domain.",
- mon->vm->def->name);
- virBhyveProcessStop(mon->driver, mon->vm,
+ vm->def->name);
+ virBhyveProcessStop(mon->driver, vm,
VIR_DOMAIN_SHUTOFF_SHUTDOWN);
} else {
VIR_INFO("Guest %s had an error and exited with status %d; destroying domain.",
- mon->vm->def->name, WEXITSTATUS(status));
- virBhyveProcessStop(mon->driver, mon->vm,
+ vm->def->name, WEXITSTATUS(status));
+ virBhyveProcessStop(mon->driver, vm,
VIR_DOMAIN_SHUTOFF_UNKNOWN);
}
}
@@ -117,24 +119,24 @@ bhyveMonitorIO(int watch, int kq, int events ATTRIBUTE_UNUSED, void *opaque)
static void
bhyveMonitorRelease(void *opaque)
{
- bhyveMonitorPtr mon = opaque;
+ virDomainObjPtr vm = opaque;
+ bhyveDomainObjPrivatePtr priv = vm->privateData;
+ bhyveMonitorPtr mon = priv->mon;
VIR_FORCE_CLOSE(mon->kq);
- virObjectUnref(mon->vm);
VIR_FREE(mon);
}
bhyveMonitorPtr
bhyveMonitorOpen(virDomainObjPtr vm, bhyveConnPtr driver)
{
- bhyveMonitorPtr mon;
+ bhyveMonitorPtr mon = NULL;
struct kevent kev;
int rc;
if (VIR_ALLOC(mon) < 0)
return NULL;
- mon->vm = virObjectRef(vm);
mon->driver = driver;
mon->kq = kqueue();
@@ -157,7 +159,7 @@ bhyveMonitorOpen(virDomainObjPtr vm, bhyveConnPtr driver)
VIR_EVENT_HANDLE_ERROR |
VIR_EVENT_HANDLE_HANGUP,
bhyveMonitorIO,
- mon,
+ vm,
bhyveMonitorRelease);
if (mon->watch < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c
index 284641a..42255d2 100644
--- a/src/bhyve/bhyve_process.c
+++ b/src/bhyve/bhyve_process.c
@@ -113,6 +113,7 @@ virBhyveProcessStart(virConnectPtr conn,
virCommandPtr cmd = NULL;
virCommandPtr load_cmd = NULL;
bhyveConnPtr privconn = conn->privateData;
+ bhyveDomainObjPrivatePtr priv = vm->privateData;
int ret = -1, rc;
if (virAsprintf(&logfile, "%s/%s.log",
@@ -210,7 +211,7 @@ virBhyveProcessStart(virConnectPtr conn,
vm->def->id = vm->pid;
virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, reason);
- vm->privateData = bhyveMonitorOpen(vm, driver);
+ priv->mon = bhyveMonitorOpen(vm, driver);
if (virDomainSaveStatus(driver->xmlopt,
BHYVE_STATE_DIR,
@@ -257,6 +258,7 @@ virBhyveProcessStop(bhyveConnPtr driver,
{
int ret = -1;
virCommandPtr cmd = NULL;
+ bhyveDomainObjPrivatePtr priv = vm->privateData;
if (!virDomainObjIsActive(vm)) {
VIR_DEBUG("VM '%s' not active", vm->def->name);
@@ -270,8 +272,8 @@ virBhyveProcessStop(bhyveConnPtr driver,
return -1;
}
- if (vm->privateData != NULL)
- bhyveMonitorClose((bhyveMonitorPtr)vm->privateData);
+ if ((priv != NULL) && (priv->mon != NULL))
+ bhyveMonitorClose(priv->mon);
/* First, try to kill 'bhyve' process */
if (virProcessKillPainfully(vm->pid, true) != 0)
@@ -358,6 +360,7 @@ virBhyveProcessReconnect(virDomainObjPtr vm,
int nprocs;
char **proc_argv;
char *expected_proctitle = NULL;
+ bhyveDomainObjPrivatePtr priv = vm->privateData;
int ret = -1;
if (!virDomainObjIsActive(vm))
@@ -379,7 +382,7 @@ virBhyveProcessReconnect(virDomainObjPtr vm,
if (proc_argv && proc_argv[0]) {
if (STREQ(expected_proctitle, proc_argv[0])) {
ret = 0;
- vm->privateData = bhyveMonitorOpen(vm, data->driver);
+ priv->mon = bhyveMonitorOpen(vm, data->driver);
}
}
--
2.6.1
9 years
[libvirt] split string into tokens via libvirt
by Vasiliy Tolstov
Hi. I'm need to parse string like "= test\ aaa 3 10 0 0 1336557216 7c2b27 3 22"
I can use virStringSplitCount, but second word contains space and
splitting not works right.
Does this need i need to parse string by hand via strtok ?
--
Vasiliy Tolstov,
e-mail: v.tolstov(a)selfip.ru
9 years
[libvirt] [PATCH v2] syntax-check: Add prohibit_space_in_label rule
by Andrea Bolognani
This guards against code such as
cleanup :
which is happily accepted by the compiler but does not conform
to our style guidelines.
---
cfg.mk | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/cfg.mk b/cfg.mk
index a9bba38..7a5a1de 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -919,6 +919,15 @@ sc_require_space_before_label:
halt="Top-level labels should be indented by one space" \
$(_sc_search_regexp)
+# Allow for up to three spaces before the label: this is to avoid running
+# into situations where require_space_before_label is not applied, eg. a
+# line matching ^[a-zA-Z0-9]+ :$
+sc_prohibit_space_in_label:
+ @prohibit='^ ? ? ?[_a-zA-Z0-9]+ +:$$' \
+ in_vc_files='\.[ch]$$' \
+ halt="There should be no space between label name and colon" \
+ $(_sc_search_regexp)
+
# Doesn't catch all cases of mismatched braces across if-else, but it helps
sc_require_if_else_matching_braces:
@prohibit='( else( if .*\))? {|} else( if .*\))?$$)' \
--
2.4.3
9 years
[libvirt] [PATCH] util: remove unnecessary needSize
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)gmail.com>
Use toadd->use directly.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)gmail.com>
---
src/util/virbuffer.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/util/virbuffer.c b/src/util/virbuffer.c
index 5b338f8..55dad37 100644
--- a/src/util/virbuffer.c
+++ b/src/util/virbuffer.c
@@ -186,8 +186,6 @@ virBufferAdd(virBufferPtr buf, const char *str, int len)
void
virBufferAddBuffer(virBufferPtr buf, virBufferPtr toadd)
{
- unsigned int needSize;
-
if (!toadd)
return;
@@ -200,8 +198,7 @@ virBufferAddBuffer(virBufferPtr buf, virBufferPtr toadd)
goto done;
}
- needSize = buf->use + toadd->use;
- if (virBufferGrow(buf, needSize - buf->use) < 0)
+ if (virBufferGrow(buf, toadd->use) < 0)
goto done;
memcpy(&buf->content[buf->use], toadd->content, toadd->use);
--
1.9.0
9 years
[libvirt] [PATCH v2] gobject: Add wrapper virDomainSetTime()
by Zeeshan Ali (Khattak)
---
This version:
* Replaces the seconds and nseconds arguments by a GDateTime.
* Drops the use of flags argument, since caller can specify the only flag currently possible (VIR_DOMAIN_TIME_SYNC) by simply passing a NULL as the GDateTime argument.
* Add some needed articles to doc comment.
libvirt-gobject/libvirt-gobject-domain.c | 121 +++++++++++++++++++++++++++++++
libvirt-gobject/libvirt-gobject-domain.h | 15 +++-
libvirt-gobject/libvirt-gobject.sym | 9 +++
3 files changed, 144 insertions(+), 1 deletion(-)
diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c
index 34eb7ca..debae2d 100644
--- a/libvirt-gobject/libvirt-gobject-domain.c
+++ b/libvirt-gobject/libvirt-gobject-domain.c
@@ -1886,3 +1886,124 @@ gboolean gvir_domain_get_has_current_snapshot(GVirDomain *dom,
return TRUE;
}
+
+/**
+ * gvir_domain_set_time:
+ * @dom: the domain
+ * @date_time: (allow-none)(transfer none): the time to set as #GDateTime.
+ * @flags: Unused, Pass 0.
+ *
+ * This function tries to set guest time to the given value. The passed
+ * time must in UTC.
+ *
+ * If @date_time is %NULL, the time is reset using the domain's RTC.
+ *
+ * Please note that some hypervisors may require guest agent to be configured
+ * and running in order for this function to work.
+ */
+gboolean gvir_domain_set_time(GVirDomain *dom,
+ GDateTime *date_time,
+ guint flags G_GNUC_UNUSED,
+ GError **err)
+{
+ GVirDomainPrivate *priv;
+ int ret;
+ GTimeVal tv;
+ gint64 seconds;
+ guint nseconds;
+ guint settime_flags;
+
+ g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
+
+ if (date_time != NULL) {
+ if (!g_date_time_to_timeval(date_time, &tv)) {
+ gvir_set_error_literal(err, GVIR_DOMAIN_ERROR,
+ 0,
+ "Failed to parse given time argument");
+ return FALSE;
+ }
+
+ seconds = tv.tv_sec;
+ nseconds = tv.tv_usec * 1000;
+ settime_flags = 0;
+ } else {
+ seconds = 0;
+ nseconds = 0;
+ settime_flags = VIR_DOMAIN_TIME_SYNC;
+ }
+
+ priv = dom->priv;
+ ret = virDomainSetTime(priv->handle, seconds, nseconds, settime_flags);
+ if (ret < 0) {
+ gvir_set_error_literal(err, GVIR_DOMAIN_ERROR,
+ 0,
+ "Unable to set domain time");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static void
+gvir_domain_set_time_helper(GTask *task,
+ gpointer object,
+ gpointer task_data,
+ GCancellable *cancellable G_GNUC_UNUSED)
+{
+ GVirDomain *dom = GVIR_DOMAIN(object);
+ GDateTime *date_time = (GDateTime *) task_data;
+ GError *err = NULL;
+
+ if (!gvir_domain_set_time(dom, date_time, 0, &err))
+ g_task_return_error(task, err);
+ else
+ g_task_return_boolean(task, TRUE);
+}
+
+/**
+ * gvir_domain_set_time_async:
+ * @dom: the domain
+ * @date_time: (allow-none)(transfer none): the time to set as #GDateTime.
+ * @flags: bitwise-OR of #GVirDomainSetTimeFlags.
+ * @cancellable: (allow-none)(transfer none): cancellation object
+ * @callback: (scope async): completion callback
+ * @user_data: (closure): opaque data for callback
+ *
+ * Asynchronous variant of #gvir_domain_set_time.
+ */
+void gvir_domain_set_time_async(GVirDomain *dom,
+ GDateTime *date_time,
+ guint flags G_GNUC_UNUSED,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ GTask *task;
+
+ g_return_if_fail(GVIR_IS_DOMAIN(dom));
+ g_return_if_fail((cancellable == NULL) || G_IS_CANCELLABLE(cancellable));
+
+ task = g_task_new(G_OBJECT(dom),
+ cancellable,
+ callback,
+ user_data);
+ if (date_time != NULL)
+ g_task_set_task_data(task,
+ g_date_time_ref(date_time),
+ (GDestroyNotify)g_date_time_unref);
+ g_task_run_in_thread(task, gvir_domain_set_time_helper);
+
+ g_object_unref(task);
+}
+
+gboolean gvir_domain_set_time_finish(GVirDomain *dom,
+ GAsyncResult *result,
+ GError **err)
+{
+ g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE);
+ g_return_val_if_fail(g_task_is_valid(result, G_OBJECT(dom)), FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
+
+ return g_task_propagate_boolean(G_TASK(result), err);
+}
diff --git a/libvirt-gobject/libvirt-gobject-domain.h b/libvirt-gobject/libvirt-gobject-domain.h
index 4fe381e..099cde3 100644
--- a/libvirt-gobject/libvirt-gobject-domain.h
+++ b/libvirt-gobject/libvirt-gobject-domain.h
@@ -215,7 +215,6 @@ typedef enum {
GVIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL = VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL
} GVirDomainSnapshotListFlags;
-
typedef struct _GVirDomainInfo GVirDomainInfo;
struct _GVirDomainInfo
{
@@ -401,6 +400,20 @@ gboolean gvir_domain_get_has_current_snapshot(GVirDomain *dom,
gboolean *has_current_snapshot,
GError **error);
+gboolean gvir_domain_set_time(GVirDomain *dom,
+ GDateTime *date_time,
+ guint flags,
+ GError **err);
+void gvir_domain_set_time_async(GVirDomain *dom,
+ GDateTime *date_time,
+ guint flags,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gboolean gvir_domain_set_time_finish(GVirDomain *dom,
+ GAsyncResult *result,
+ GError **err);
+
G_END_DECLS
#endif /* __LIBVIRT_GOBJECT_DOMAIN_H__ */
diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
index ca89a45..cbfaa71 100644
--- a/libvirt-gobject/libvirt-gobject.sym
+++ b/libvirt-gobject/libvirt-gobject.sym
@@ -304,4 +304,13 @@ LIBVIRT_GOBJECT_0.2.2 {
gvir_network_get_dhcp_leases;
} LIBVIRT_GOBJECT_0.2.1;
+LIBVIRT_GOBJECT_0.2.3 {
+ global:
+ gvir_domain_set_time_flags_get_type;
+
+ gvir_domain_set_time;
+ gvir_domain_set_time_async;
+ gvir_domain_set_time_finish;
+} LIBVIRT_GOBJECT_0.2.2;
+
# .... define new API here using predicted next version number ....
--
2.5.0
9 years
[libvirt] [PATCH] util: remove unnecessary needSize
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)gmail.com>
Use toadd->use directly.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)gmail.com>
---
src/util/virbuffer.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/util/virbuffer.c b/src/util/virbuffer.c
index 5b338f8..55dad37 100644
--- a/src/util/virbuffer.c
+++ b/src/util/virbuffer.c
@@ -186,8 +186,6 @@ virBufferAdd(virBufferPtr buf, const char *str, int len)
void
virBufferAddBuffer(virBufferPtr buf, virBufferPtr toadd)
{
- unsigned int needSize;
-
if (!toadd)
return;
@@ -200,8 +198,7 @@ virBufferAddBuffer(virBufferPtr buf, virBufferPtr toadd)
goto done;
}
- needSize = buf->use + toadd->use;
- if (virBufferGrow(buf, needSize - buf->use) < 0)
+ if (virBufferGrow(buf, toadd->use) < 0)
goto done;
memcpy(&buf->content[buf->use], toadd->content, toadd->use);
--
1.9.0
9 years
[libvirt] [PATCH 0/4] Fix crash resuling from script doing FC/SCSI pool-create destroy
by John Ferlan
Details in the patches - essentially testing found an issue creating
and destroying an FC/SCSI pool due to the refresh thread created for
bz 1152382 running after the destroy.
Seen using script which has
for i in 1 2 3 ; \
do virsh pool-create /tmp/test.xml; \
sleep 1; \
virsh pool-destroy p1; \
sleep 1; \
done
John Ferlan (4):
storage: Make active boolean
storage: Change cbdata scsi refresh thread field name
storage: Introduce virStoragePoolObjFindPoolByUUID
storage: Don't assume storage pool exists for scsi refresh thread
src/conf/storage_conf.h | 2 +-
src/storage/storage_backend_scsi.c | 30 +++++++++++++++++-------------
src/storage/storage_driver.c | 31 ++++++++++++++++++++++++++-----
src/storage/storage_driver.h | 3 +++
4 files changed, 47 insertions(+), 19 deletions(-)
--
2.1.0
9 years
[libvirt] [PATCH] vz: add func to set shared drivers after libvirtd init
by Mikhail Feoktistov
Built-in drivers in libvirt are initialized before libvirtd initialization.
Libvirt loads shared drivers on libvirtd initialization step.
For built-in drivers we can't set shared drivers, because they are not initialized yet.
This patch adds function to set shared drivers after libvirtd init.
---
daemon/libvirtd.c | 4 ++++
src/libvirt.c | 41 +++++++++++++++++++++++++++++++++++++++++
src/libvirt_internal.h | 1 +
src/libvirt_private.syms | 1 +
4 files changed, 47 insertions(+)
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 250094b..aac1826 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -431,6 +431,10 @@ static void daemonInitialize(void)
bhyveRegister();
# endif
#endif
+# ifdef WITH_VZ
+ virAssignSharedDrivers("vz");
+ virAssignSharedDrivers("Parallels");
+# endif
}
diff --git a/src/libvirt.c b/src/libvirt.c
index 2602dde..4c4b7bd 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -1433,3 +1433,44 @@ virTypedParameterValidateSet(virConnectPtr conn,
}
return 0;
}
+
+/**
+ * virAssignSharedDrivers:
+ * @name: name of connection driver
+ *
+ * This function fills in any empty pointers for shared drivers
+ * in connect driver structure
+ *
+ * Returns 0 in case of success, -1 in case of error
+*/
+int
+virAssignSharedDrivers(const char *name)
+{
+ size_t i;
+
+ if (name == NULL) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Driver name must be specified"));
+ return -1;
+ }
+
+ for (i = 0; i < virConnectDriverTabCount; i++) {
+ if (STREQ(virConnectDriverTab[i]->hypervisorDriver->name, name)) {
+ if (virConnectDriverTab[i]->interfaceDriver == NULL)
+ virConnectDriverTab[i]->interfaceDriver = virSharedInterfaceDriver;
+ if (virConnectDriverTab[i]->networkDriver == NULL)
+ virConnectDriverTab[i]->networkDriver = virSharedNetworkDriver;
+ if (virConnectDriverTab[i]->nodeDeviceDriver == NULL)
+ virConnectDriverTab[i]->nodeDeviceDriver = virSharedNodeDeviceDriver;
+ if (virConnectDriverTab[i]->nwfilterDriver == NULL)
+ virConnectDriverTab[i]->nwfilterDriver = virSharedNWFilterDriver;
+ if (virConnectDriverTab[i]->secretDriver == NULL)
+ virConnectDriverTab[i]->secretDriver = virSharedSecretDriver;
+ if (virConnectDriverTab[i]->storageDriver == NULL)
+ virConnectDriverTab[i]->storageDriver = virSharedStorageDriver;
+ break;
+ }
+ }
+
+ return 0;
+}
diff --git a/src/libvirt_internal.h b/src/libvirt_internal.h
index 1313b58..2a7227b 100644
--- a/src/libvirt_internal.h
+++ b/src/libvirt_internal.h
@@ -289,4 +289,5 @@ virTypedParameterValidateSet(virConnectPtr conn,
virTypedParameterPtr params,
int nparams);
+int virAssignSharedDrivers(const char *name);
#endif
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index be6ee19..340555a 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -943,6 +943,7 @@ virFDStreamSetInternalCloseCb;
# libvirt_internal.h
+virAssignSharedDrivers;
virConnectSupportsFeature;
virDomainMigrateBegin3;
virDomainMigrateBegin3Params;
--
1.8.3.1
9 years
[libvirt] [PATCHv3 0/4] Hyper-v crash feature support
by Dmitry Andreev
A new Hyper-V cpu feature 'hv_crash' was added to QEMU. The feature
will become available in v2.5.0.
This patch adds support for this feature.
The previous version of this patch is
https://www.redhat.com/archives/libvir-list/2015-November/msg00400.html
What is changed:
* 'model' is an optional attribute and will not be added
if it wasn't specified by the user [1/4]
* docs text fixed [1/4] [3/4]
* schema and code allows multiple panic devices [3/4]
* more tests is added and all changes in old tests
are removed [4/4]
What isn't changed:
I didn't add <code> tag around model values in docs because there
are many examples of "<ul><li> 'value' —" without a <code> tag.
Dmitry Andreev (4):
conf: add 'model' attribute for panic device with values isa, pseries,
hyperv
qemu: add support for hv_crash feature as a panic device
schema: allow multiple panic devices
tests: add tests for panic models and multiple panic devices
docs/formatdomain.html.in | 19 +++-
docs/schemas/domaincommon.rng | 13 ++-
src/conf/domain_conf.c | 101 ++++++++++++---------
src/conf/domain_conf.h | 15 ++-
src/qemu/qemu_command.c | 84 +++++++++++++++--
src/qemu/qemu_domain.c | 21 ++++-
tests/qemuargv2xmltest.c | 1 +
.../qemuxml2argv-hyperv-panic.args | 21 +++++
.../qemuxml2argvdata/qemuxml2argv-hyperv-panic.xml | 25 +++++
.../qemuxml2argv-panic-double.args | 21 +++++
.../qemuxml2argvdata/qemuxml2argv-panic-double.xml | 28 ++++++
tests/qemuxml2argvdata/qemuxml2argv-panic-isa.xml | 31 +++++++
.../qemuxml2argv-panic-pseries.xml | 30 ++++++
tests/qemuxml2argvtest.c | 3 +
tests/qemuxml2xmltest.c | 4 +
15 files changed, 353 insertions(+), 64 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hyperv-panic.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hyperv-panic.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-panic-double.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-panic-double.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-panic-isa.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-panic-pseries.xml
--
1.8.3.1
9 years
[libvirt] [PATCH 0/5] Initial patches to introduce a virtlogd daemon
by Daniel P. Berrange
Currently we have stdout + stderr of QEMU guests setup to write
to a log file (eg /var/log/libvirt/qemu/$GUEST.log). This is nice
and simple, but it in fact opens the possibility of a malicious or
accidental denial of service, whereby QEMU can write logs of data
to stdio and thus fill up the host filesystem holding the log.
Although we have logrotate policy in place, this is only processed
once a day, so there is still a window where disk usage is not
constrained.
The only way to solve this is to not let QEMU directly write to
the log file, instead connect its stdio to a pipe and copy data
from the pipe to the real log file, performing file rollover
when it reaches a certain size.
If we do this, we need something to keep open the pipe for as long
as QEMU is running. This can't be libvirtd since we expect libvirtd
to be able to be stopped while QEMU is running. Thus we introduce a
new single-purpose daemon virtlogd whose job is exclusively to deal
with log file writing. This daemon has support for SIGUSR1 to tell
it to re-exec itself while keeping open the pipe to QEMU so it can
be safely upgraded while QEMU is running.
This series switches QEMU to use virtlogd by default, but in case
of problems we can revert back to the old direct file access by
setting 'stdio_handler = "file"' in /etc/libvirt/qemu.conf
This series is only the first step. The same problem exists when
character devices are told to use the file backend. There is a
further use case from OpenStack which that they want to allow
the use of both a TCP backend and a file backend at the same
time. The idea is that the serial port is to be used for an
interactive console, so needs the TCP backend support, but we
also want to be able to record all output on that serial port to
a file for logging purposes.
Thus, in a followup I will work on creating a new character
device backend "logd" that will use virtlogd to provide this
combined tcp+logfile facility for QEMU guests.
Daniel P. Berrange (5):
util: add API for writing to rotating files
Import stripped down virtlockd code as basis of virtlogd
logging: introduce log handling protocol
logging: add client for virtlogd daemon
qemu: add support for sending QEMU stdout/stderr to virtlogd
.gitignore | 7 +
cfg.mk | 6 +-
include/libvirt/virterror.h | 1 +
libvirt.spec.in | 24 +-
po/POTFILES.in | 5 +
src/Makefile.am | 176 +++++-
src/libvirt_private.syms | 12 +
src/logging/log_daemon.c | 1207 ++++++++++++++++++++++++++++++++++++
src/logging/log_daemon.h | 45 ++
src/logging/log_daemon_config.c | 203 ++++++
src/logging/log_daemon_config.h | 50 ++
src/logging/log_daemon_dispatch.c | 67 ++
src/logging/log_daemon_dispatch.h | 31 +
src/logging/log_handler.c | 429 +++++++++++++
src/logging/log_handler.h | 46 ++
src/logging/log_manager.c | 197 ++++++
src/logging/log_manager.h | 42 ++
src/logging/log_protocol.x | 71 +++
src/logging/test_virtlogd.aug.in | 12 +
src/logging/virtlogd.aug | 45 ++
src/logging/virtlogd.conf | 67 ++
src/logging/virtlogd.init.in | 94 +++
src/logging/virtlogd.pod.in | 162 +++++
src/logging/virtlogd.service.in | 17 +
src/logging/virtlogd.socket.in | 8 +
src/logging/virtlogd.sysconf | 3 +
src/qemu/libvirtd_qemu.aug | 1 +
src/qemu/qemu.conf | 15 +
src/qemu/qemu_conf.c | 18 +
src/qemu/qemu_conf.h | 1 +
src/qemu/qemu_domain.c | 43 +-
src/qemu/qemu_process.c | 42 +-
src/qemu/test_libvirtd_qemu.aug.in | 1 +
src/util/virerror.c | 1 +
src/util/virrotatingfile.c | 237 +++++++
src/util/virrotatingfile.h | 44 ++
tests/Makefile.am | 6 +
tests/virrotatingfiletest.c | 415 +++++++++++++
38 files changed, 3802 insertions(+), 49 deletions(-)
create mode 100644 src/logging/log_daemon.c
create mode 100644 src/logging/log_daemon.h
create mode 100644 src/logging/log_daemon_config.c
create mode 100644 src/logging/log_daemon_config.h
create mode 100644 src/logging/log_daemon_dispatch.c
create mode 100644 src/logging/log_daemon_dispatch.h
create mode 100644 src/logging/log_handler.c
create mode 100644 src/logging/log_handler.h
create mode 100644 src/logging/log_manager.c
create mode 100644 src/logging/log_manager.h
create mode 100644 src/logging/log_protocol.x
create mode 100644 src/logging/test_virtlogd.aug.in
create mode 100644 src/logging/virtlogd.aug
create mode 100644 src/logging/virtlogd.conf
create mode 100644 src/logging/virtlogd.init.in
create mode 100644 src/logging/virtlogd.pod.in
create mode 100644 src/logging/virtlogd.service.in
create mode 100644 src/logging/virtlogd.socket.in
create mode 100644 src/logging/virtlogd.sysconf
create mode 100644 src/util/virrotatingfile.c
create mode 100644 src/util/virrotatingfile.h
create mode 100644 tests/virrotatingfiletest.c
--
2.5.0
9 years