[libvirt] [PATCH] Rename VIR_DOMAIN_PAUSED_GUEST_PANICKED to VIR_DOMAIN_PAUSED_CRASHED
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The VIR_DOMAIN_PAUSED_GUEST_PANICKED constant is badly named,
leaking the QEMU event name. Elsewhere in the API we use
'CRASHED' rather than 'PANICKED', and the addition of 'GUEST'
is redundant since all events are guest related.
Thus rename it to VIR_DOMAIN_PAUSED_CRASHED, which matches
with VIR_DOMAIN_RUNNING_CRASHED and VIR_DOMAIN_EVENT_CRASHED.
It was added in commit 14e7e0ae8db9843aea80245a3d9e6cf5f2ef720d
which post-dates v1.1.0, so is safe to rename before 1.1.1
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
include/libvirt/libvirt.h.in | 2 +-
src/qemu/qemu_monitor.c | 2 +-
src/qemu/qemu_process.c | 2 +-
tools/virsh-domain-monitor.c | 4 ++--
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 4eae7bf..7bd3559 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -181,7 +181,7 @@ typedef enum {
VIR_DOMAIN_PAUSED_FROM_SNAPSHOT = 7, /* paused after restoring from snapshot */
VIR_DOMAIN_PAUSED_SHUTTING_DOWN = 8, /* paused during shutdown process */
VIR_DOMAIN_PAUSED_SNAPSHOT = 9, /* paused while creating a snapshot */
- VIR_DOMAIN_PAUSED_GUEST_PANICKED = 10, /* paused due to a guest panicked event */
+ VIR_DOMAIN_PAUSED_CRASHED = 10, /* paused due to a guest crash */
#ifdef VIR_ENUM_SENTINELS
VIR_DOMAIN_PAUSED_LAST
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 0b73411..5b2fb04 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -3335,7 +3335,7 @@ int qemuMonitorVMStatusToPausedReason(const char *status)
return VIR_DOMAIN_PAUSED_WATCHDOG;
case QEMU_MONITOR_VM_STATUS_GUEST_PANICKED:
- return VIR_DOMAIN_PAUSED_GUEST_PANICKED;
+ return VIR_DOMAIN_PAUSED_CRASHED;
/* unreachable from this point on */
case QEMU_MONITOR_VM_STATUS_LAST:
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index e8e459e..d631a6f 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2724,7 +2724,7 @@ qemuProcessUpdateState(virQEMUDriverPtr driver, virDomainObjPtr vm)
newState = VIR_DOMAIN_SHUTDOWN;
newReason = VIR_DOMAIN_SHUTDOWN_UNKNOWN;
ignore_value(VIR_STRDUP_QUIET(msg, "shutdown"));
- } else if (reason == VIR_DOMAIN_PAUSED_GUEST_PANICKED) {
+ } else if (reason == VIR_DOMAIN_PAUSED_CRASHED) {
newState = VIR_DOMAIN_CRASHED;
newReason = VIR_DOMAIN_CRASHED_PANICKED;
ignore_value(VIR_STRDUP_QUIET(msg, "crashed"));
diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index 98fe7fe..b29b82a 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -228,8 +228,8 @@ vshDomainStateReasonToString(int state, int reason)
return N_("shutting down");
case VIR_DOMAIN_PAUSED_SNAPSHOT:
return N_("creating snapshot");
- case VIR_DOMAIN_PAUSED_GUEST_PANICKED:
- return N_("guest panicked");
+ case VIR_DOMAIN_PAUSED_CRASHED:
+ return N_("crashed");
case VIR_DOMAIN_PAUSED_UNKNOWN:
case VIR_DOMAIN_PAUSED_LAST:
;
--
1.8.1.4
11 years, 5 months
[libvirt] [PATCH V5] add console support in libxl
by Bamvor Jian Zhang
this patch introduce the console api in libxl driver for both pv and
hvm guest. and import and update the libxlMakeChrdevStr function
which was deleted in commit dfa1e1dd.
Signed-off-by: Bamvor Jian Zhang <bjzhang(a)suse.com>
---
Changes since V4:
1), using proper error instead of VIR_ERR_INTERNAL_ERROR.
2), treat safe as unsupported flags in libxl openConsole api.
3), some format and minor logic changes.
Changes since V3:
implicity forbit dev_name pass to libxl driver due to only one
console supported by libxl.
Changes since V2:
1), forbid parallel configure because libxl do not support it
2), only support one serial on libxl driver.
3), also remove console code in libxl driver, AFAICS serial is enough for
connecting to libxl console.
Changes since V1:
1), add virDomainOpenConsoleEnsureACL
3), remove virReportOOMErrorFull when virAsprintf fail.
4), change size_t for non-nagetive number in libxlDomainOpenConsole
size_t i;
size_t num = 0;
5), fix for make check
(1), replace virAsprintf with VIR_STRDUP in two places
(2), delete space.
src/libxl/libxl_conf.c | 104 +++++++++++++++++++++++++++++++++++++++++++++++
src/libxl/libxl_conf.h | 3 ++
src/libxl/libxl_driver.c | 93 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 200 insertions(+)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 5273a26..827dfdd 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -331,6 +331,92 @@ error:
}
static int
+libxlMakeChrdevStr(virDomainChrDefPtr def, char **buf)
+{
+ virDomainChrSourceDef srcdef = def->source;
+ const char *type = virDomainChrTypeToString(srcdef.type);
+
+ if (!type) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ "%s", _("unknown chrdev type"));
+ return -1;
+ }
+
+ switch (srcdef.type) {
+ case VIR_DOMAIN_CHR_TYPE_NULL:
+ case VIR_DOMAIN_CHR_TYPE_STDIO:
+ case VIR_DOMAIN_CHR_TYPE_VC:
+ case VIR_DOMAIN_CHR_TYPE_PTY:
+ if (VIR_STRDUP(*buf, type) < 0)
+ return -1;
+ break;
+
+ case VIR_DOMAIN_CHR_TYPE_FILE:
+ case VIR_DOMAIN_CHR_TYPE_PIPE:
+ if (virAsprintf(buf, "%s:%s", type, srcdef.data.file.path) < 0)
+ return -1;
+ break;
+
+ case VIR_DOMAIN_CHR_TYPE_DEV:
+ if (VIR_STRDUP(*buf, srcdef.data.file.path) < 0)
+ return -1;
+ break;
+
+ case VIR_DOMAIN_CHR_TYPE_UDP: {
+ const char *connectHost = srcdef.data.udp.connectHost;
+ const char *bindHost = srcdef.data.udp.bindHost;
+ const char *bindService = srcdef.data.udp.bindService;
+
+ if (connectHost == NULL)
+ connectHost = "";
+ if (bindHost == NULL)
+ bindHost = "";
+ if (bindService == NULL)
+ bindService = "0";
+
+ if (virAsprintf(buf, "udp:%s:%s@%s:%s",
+ connectHost,
+ srcdef.data.udp.connectService,
+ bindHost,
+ bindService) < 0)
+ return -1;
+ break;
+ }
+
+ case VIR_DOMAIN_CHR_TYPE_TCP: {
+ const char *prefix;
+
+ if (srcdef.data.tcp.protocol == VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET)
+ prefix = "telnet";
+ else
+ prefix = "tcp";
+
+ if (virAsprintf(buf, "%s:%s:%s%s",
+ prefix,
+ srcdef.data.tcp.host,
+ srcdef.data.tcp.service,
+ srcdef.data.tcp.listen ? ",server,nowait" : "") < 0)
+ return -1;
+ break;
+ }
+
+ case VIR_DOMAIN_CHR_TYPE_UNIX:
+ if (virAsprintf(buf, "unix:%s%s",
+ srcdef.data.nix.path,
+ srcdef.data.nix.listen ? ",server,nowait" : "") < 0)
+ return -1;
+ break;
+
+ default:
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unsupported chardev '%s'"), type);
+ return -1;
+ }
+
+ return 0;
+}
+
+static int
libxlMakeDomBuildInfo(virDomainObjPtr vm, libxl_domain_config *d_config)
{
virDomainDefPtr def = vm->def;
@@ -411,6 +497,24 @@ libxlMakeDomBuildInfo(virDomainObjPtr vm, libxl_domain_config *d_config)
if (VIR_STRDUP(b_info->u.hvm.boot, bootorder) < 0)
goto error;
+ if (def->nserials) {
+ if (def->nserials > 1) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ "%s",
+ _("Only one serial device is supported by libxl"));
+ goto error;
+ }
+ if (libxlMakeChrdevStr(def->serials[0], &b_info->u.hvm.serial) < 0)
+ goto error;
+ }
+
+ if (def->nparallels) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ "%s",
+ _("Parallel devices are not supported by libxl"));
+ goto error;
+ }
+
/*
* The following comment and calculation were taken directly from
* libxenlight's internal function libxl_get_required_shadow_memory():
diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
index 942cdd5..aa57710 100644
--- a/src/libxl/libxl_conf.h
+++ b/src/libxl/libxl_conf.h
@@ -34,6 +34,7 @@
# include "configmake.h"
# include "virportallocator.h"
# include "virobject.h"
+# include "virchrdev.h"
# define LIBXL_VNC_PORT_MIN 5900
@@ -94,6 +95,8 @@ struct _libxlDomainObjPrivate {
/* per domain libxl ctx */
libxl_ctx *ctx;
+ /* console */
+ virChrdevsPtr devs;
libxl_evgen_domain_death *deathW;
/* list of libxl timeout registrations */
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 98b1985..0d42062 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -417,6 +417,9 @@ libxlDomainObjPrivateAlloc(void)
libxl_osevent_register_hooks(priv->ctx, &libxl_event_callbacks, priv);
+ if (!(priv->devs = virChrdevAlloc()))
+ return NULL;
+
return priv;
}
@@ -428,6 +431,7 @@ libxlDomainObjPrivateDispose(void *obj)
if (priv->deathW)
libxl_evdisable_domain_death(priv->ctx, priv->deathW);
+ virChrdevFree(priv->devs);
libxl_ctx_free(priv->ctx);
}
@@ -4493,6 +4497,94 @@ cleanup:
return ret;
}
+
+static int
+libxlDomainOpenConsole(virDomainPtr dom,
+ const char *dev_name,
+ virStreamPtr st,
+ unsigned int flags)
+{
+ libxlDriverPrivatePtr driver = dom->conn->privateData;
+ virDomainObjPtr vm = NULL;
+ int ret = -1;
+ virDomainChrDefPtr chr = NULL;
+ libxlDomainObjPrivatePtr priv;
+ char *console = NULL;
+
+ virCheckFlags(VIR_DOMAIN_CONSOLE_FORCE, -1);
+
+ if (dev_name) {
+ /* XXX support device aliases in future */
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Named device aliases are not supported"));
+ goto cleanup;
+ }
+
+ libxlDriverLock(driver);
+ vm = virDomainObjListFindByUUID(driver->domains, dom->uuid);
+ libxlDriverUnlock(driver);
+ if (!vm) {
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
+ virUUIDFormat(dom->uuid, uuidstr);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("No domain with matching uuid '%s'"), uuidstr);
+ goto cleanup;
+ }
+
+ if (virDomainOpenConsoleEnsureACL(dom->conn, vm->def) < 0)
+ goto cleanup;
+
+ if (!virDomainObjIsActive(vm)) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("domain is not running"));
+ goto cleanup;
+ }
+
+ priv = vm->privateData;
+
+ if (vm->def->nserials)
+ chr = vm->def->serials[0];
+
+ if (!chr) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("cannot find character device %s"),
+ NULLSTR(dev_name));
+ goto cleanup;
+ }
+
+ if (chr->source.type != VIR_DOMAIN_CHR_TYPE_PTY) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("character device %s is not using a PTY"),
+ NULLSTR(dev_name));
+ goto cleanup;
+ }
+
+ ret = libxl_primary_console_get_tty(priv->ctx, vm->def->id, &console);
+ if (ret)
+ goto cleanup;
+
+ if (VIR_STRDUP(chr->source.data.file.path, console) < 0)
+ goto cleanup;
+
+ /* handle mutually exclusive access to console devices */
+ ret = virChrdevOpen(priv->devs,
+ &chr->source,
+ st,
+ (flags & VIR_DOMAIN_CONSOLE_FORCE) != 0);
+
+ if (ret == 1) {
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("Active console session exists for this domain"));
+ ret = -1;
+ }
+
+cleanup:
+ VIR_FREE(console);
+ if (vm)
+ virObjectUnlock(vm);
+ return ret;
+}
+
static int
libxlDomainSetSchedulerParameters(virDomainPtr dom, virTypedParameterPtr params,
int nparams)
@@ -4875,6 +4967,7 @@ static virDriver libxlDriver = {
.domainManagedSave = libxlDomainManagedSave, /* 0.9.2 */
.domainHasManagedSaveImage = libxlDomainHasManagedSaveImage, /* 0.9.2 */
.domainManagedSaveRemove = libxlDomainManagedSaveRemove, /* 0.9.2 */
+ .domainOpenConsole = libxlDomainOpenConsole, /* 1.1.2 */
.domainIsActive = libxlDomainIsActive, /* 0.9.0 */
.domainIsPersistent = libxlDomainIsPersistent, /* 0.9.0 */
.domainIsUpdated = libxlDomainIsUpdated, /* 0.9.0 */
--
1.8.1.4
11 years, 5 months
[libvirt] [PATCH] maint: fix typo for SENTINEL
by Eric Blake
* src/openvz/openvz_driver.c: Use correct spelling.
* src/vmware/vmware_conf.c: Likewise.
* src/vmware/vmware_conf.h: Likewise.
* src/vmware/vmware_driver.c: Likewise.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Pushing under the trivial rule.
src/openvz/openvz_driver.c | 24 ++++++++++++------------
src/vmware/vmware_conf.c | 4 ++--
src/vmware/vmware_conf.h | 2 +-
src/vmware/vmware_driver.c | 18 +++++++++---------
4 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index de4e4ff..d268647 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -564,12 +564,12 @@ cleanup:
* key value. This lets us declare the argv on the
* stack and just splice in the domain name after
*/
-#define PROGRAM_SENTINAL ((char *)0x1)
+#define PROGRAM_SENTINEL ((char *)0x1)
static void openvzSetProgramSentinal(const char **prog, const char *key)
{
const char **tmp = prog;
while (tmp && *tmp) {
- if (*tmp == PROGRAM_SENTINAL) {
+ if (*tmp == PROGRAM_SENTINEL) {
*tmp = key;
break;
}
@@ -580,7 +580,7 @@ static void openvzSetProgramSentinal(const char **prog, const char *key)
static int openvzDomainSuspend(virDomainPtr dom) {
struct openvz_driver *driver = dom->conn->privateData;
virDomainObjPtr vm;
- const char *prog[] = {VZCTL, "--quiet", "chkpnt", PROGRAM_SENTINAL, "--suspend", NULL};
+ const char *prog[] = {VZCTL, "--quiet", "chkpnt", PROGRAM_SENTINEL, "--suspend", NULL};
int ret = -1;
openvzDriverLock(driver);
@@ -618,7 +618,7 @@ cleanup:
static int openvzDomainResume(virDomainPtr dom) {
struct openvz_driver *driver = dom->conn->privateData;
virDomainObjPtr vm;
- const char *prog[] = {VZCTL, "--quiet", "chkpnt", PROGRAM_SENTINAL, "--resume", NULL};
+ const char *prog[] = {VZCTL, "--quiet", "chkpnt", PROGRAM_SENTINEL, "--resume", NULL};
int ret = -1;
openvzDriverLock(driver);
@@ -658,7 +658,7 @@ openvzDomainShutdownFlags(virDomainPtr dom,
unsigned int flags) {
struct openvz_driver *driver = dom->conn->privateData;
virDomainObjPtr vm;
- const char *prog[] = {VZCTL, "--quiet", "stop", PROGRAM_SENTINAL, NULL};
+ const char *prog[] = {VZCTL, "--quiet", "stop", PROGRAM_SENTINEL, NULL};
int ret = -1;
int status;
@@ -721,7 +721,7 @@ static int openvzDomainReboot(virDomainPtr dom,
{
struct openvz_driver *driver = dom->conn->privateData;
virDomainObjPtr vm;
- const char *prog[] = {VZCTL, "--quiet", "restart", PROGRAM_SENTINAL, NULL};
+ const char *prog[] = {VZCTL, "--quiet", "restart", PROGRAM_SENTINEL, NULL};
int ret = -1;
int status;
@@ -1041,7 +1041,7 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
virDomainDefPtr vmdef = NULL;
virDomainObjPtr vm = NULL;
virDomainPtr dom = NULL;
- const char *progstart[] = {VZCTL, "--quiet", "start", PROGRAM_SENTINAL, NULL};
+ const char *progstart[] = {VZCTL, "--quiet", "start", PROGRAM_SENTINEL, NULL};
virCheckFlags(0, NULL);
@@ -1126,7 +1126,7 @@ openvzDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
{
struct openvz_driver *driver = dom->conn->privateData;
virDomainObjPtr vm;
- const char *prog[] = {VZCTL, "--quiet", "start", PROGRAM_SENTINAL, NULL };
+ const char *prog[] = {VZCTL, "--quiet", "start", PROGRAM_SENTINEL, NULL };
int ret = -1;
int status;
@@ -1180,7 +1180,7 @@ openvzDomainUndefineFlags(virDomainPtr dom,
{
struct openvz_driver *driver = dom->conn->privateData;
virDomainObjPtr vm;
- const char *prog[] = { VZCTL, "--quiet", "destroy", PROGRAM_SENTINAL, NULL };
+ const char *prog[] = { VZCTL, "--quiet", "destroy", PROGRAM_SENTINEL, NULL };
int ret = -1;
int status;
@@ -1228,7 +1228,7 @@ openvzDomainSetAutostart(virDomainPtr dom, int autostart)
{
struct openvz_driver *driver = dom->conn->privateData;
virDomainObjPtr vm;
- const char *prog[] = { VZCTL, "--quiet", "set", PROGRAM_SENTINAL,
+ const char *prog[] = { VZCTL, "--quiet", "set", PROGRAM_SENTINEL,
"--onboot", autostart ? "yes" : "no",
"--save", NULL };
int ret = -1;
@@ -1326,7 +1326,7 @@ static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
unsigned int nvcpus)
{
char str_vcpus[32];
- const char *prog[] = { VZCTL, "--quiet", "set", PROGRAM_SENTINAL,
+ const char *prog[] = { VZCTL, "--quiet", "set", PROGRAM_SENTINEL,
"--cpus", str_vcpus, "--save", NULL };
unsigned int pcpus;
pcpus = openvzGetNodeCPUs();
@@ -1685,7 +1685,7 @@ openvzDomainSetMemoryInternal(virDomainObjPtr vm,
unsigned long long mem)
{
char str_mem[16];
- const char *prog[] = { VZCTL, "--quiet", "set", PROGRAM_SENTINAL,
+ const char *prog[] = { VZCTL, "--quiet", "set", PROGRAM_SENTINEL,
"--kmemsize", str_mem, "--save", NULL
};
diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c
index 23da92d..e00c66c 100644
--- a/src/vmware/vmware_conf.c
+++ b/src/vmware/vmware_conf.c
@@ -205,7 +205,7 @@ vmwareSetSentinal(const char **prog, const char *key)
const char **tmp = prog;
while (tmp && *tmp) {
- if (*tmp == PROGRAM_SENTINAL) {
+ if (*tmp == PROGRAM_SENTINEL) {
*tmp = key;
break;
}
@@ -392,7 +392,7 @@ int
vmwareMoveFile(char *srcFile, char *dstFile)
{
const char *cmdmv[] =
- { "mv", PROGRAM_SENTINAL, PROGRAM_SENTINAL, NULL };
+ { "mv", PROGRAM_SENTINEL, PROGRAM_SENTINEL, NULL };
if (!virFileExists(srcFile)) {
virReportError(VIR_ERR_INTERNAL_ERROR, _("file %s does not exist"),
diff --git a/src/vmware/vmware_conf.h b/src/vmware/vmware_conf.h
index cb11aca..6666eaf 100644
--- a/src/vmware/vmware_conf.h
+++ b/src/vmware/vmware_conf.h
@@ -28,7 +28,7 @@
# include "virthread.h"
# define VIR_FROM_THIS VIR_FROM_VMWARE
-# define PROGRAM_SENTINAL ((char *)0x1)
+# define PROGRAM_SENTINEL ((char *)0x1)
# define TYPE_PLAYER 0
# define TYPE_WORKSTATION 1
diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
index 988552f..74591d6 100644
--- a/src/vmware/vmware_driver.c
+++ b/src/vmware/vmware_driver.c
@@ -252,8 +252,8 @@ vmwareStopVM(struct vmware_driver *driver,
virDomainShutoffReason reason)
{
const char *cmd[] = {
- VMRUN, "-T", PROGRAM_SENTINAL, "stop",
- PROGRAM_SENTINAL, "soft", NULL
+ VMRUN, "-T", PROGRAM_SENTINEL, "stop",
+ PROGRAM_SENTINEL, "soft", NULL
};
vmwareSetSentinal(cmd, vmw_types[driver->type]);
@@ -273,8 +273,8 @@ static int
vmwareStartVM(struct vmware_driver *driver, virDomainObjPtr vm)
{
const char *cmd[] = {
- VMRUN, "-T", PROGRAM_SENTINAL, "start",
- PROGRAM_SENTINAL, PROGRAM_SENTINAL, NULL
+ VMRUN, "-T", PROGRAM_SENTINEL, "start",
+ PROGRAM_SENTINEL, PROGRAM_SENTINEL, NULL
};
const char *vmxPath = ((vmwareDomainPtr) vm->privateData)->vmxPath;
@@ -446,8 +446,8 @@ vmwareDomainSuspend(virDomainPtr dom)
virDomainObjPtr vm;
const char *cmd[] = {
- VMRUN, "-T", PROGRAM_SENTINAL, "pause",
- PROGRAM_SENTINAL, NULL
+ VMRUN, "-T", PROGRAM_SENTINEL, "pause",
+ PROGRAM_SENTINEL, NULL
};
int ret = -1;
@@ -495,7 +495,7 @@ vmwareDomainResume(virDomainPtr dom)
virDomainObjPtr vm;
const char *cmd[] = {
- VMRUN, "-T", PROGRAM_SENTINAL, "unpause", PROGRAM_SENTINAL,
+ VMRUN, "-T", PROGRAM_SENTINEL, "unpause", PROGRAM_SENTINEL,
NULL
};
int ret = -1;
@@ -544,8 +544,8 @@ vmwareDomainReboot(virDomainPtr dom, unsigned int flags)
const char * vmxPath = NULL;
virDomainObjPtr vm;
const char *cmd[] = {
- VMRUN, "-T", PROGRAM_SENTINAL,
- "reset", PROGRAM_SENTINAL, "soft", NULL
+ VMRUN, "-T", PROGRAM_SENTINEL,
+ "reset", PROGRAM_SENTINEL, "soft", NULL
};
int ret = -1;
--
1.8.3.1
11 years, 5 months
[libvirt] [PATCH] spec: Use --enable-werror on RHEL
by Jiri Denemark
As RHEL provides a stable tool chain, we don't have to worry about
frequent changes in reported compiler warnings (which prevents us from
enabling -Werror unconditionally).
---
libvirt.spec.in | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index e74f774..6d6203b 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -352,6 +352,14 @@
%endif
+# RHEL releases provide stable tool chains and so it is safe to turn
+# compiler warning into errors without being worried about frequent
+# changes in reported warnings
+%if 0%{?rhel}
+ %define enable_werror --enable-werror
+%endif
+
+
Summary: Library providing a simple virtualization API
Name: libvirt
Version: @VERSION@
@@ -1386,6 +1394,7 @@ of recent versions of Linux (and other OSes).
%{with_packager_version} \
--with-qemu-user=%{qemu_user} \
--with-qemu-group=%{qemu_group} \
+ %{?enable_werror} \
%{init_scripts}
make %{?_smp_mflags}
gzip -9 ChangeLog
--
1.8.3.2
11 years, 5 months
[libvirt] [PATCH] spec: RHEL-7 does not have sanlock on i686
by Jiri Denemark
---
libvirt.spec.in | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 6236c08..e74f774 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -245,11 +245,16 @@
%if 0%{?fedora} >= 16
%define with_sanlock 0%{!?_without_sanlock:%{server_drivers}}
%endif
-%if 0%{?rhel} >= 6
+%if 0%{?rhel} == 6
%ifarch %{ix86} x86_64
%define with_sanlock 0%{!?_without_sanlock:%{server_drivers}}
%endif
%endif
+%if 0%{?rhel} >= 7
+ %ifarch x86_64
+ %define with_sanlock 0%{!?_without_sanlock:%{server_drivers}}
+ %endif
+%endif
# Enable libssh2 transport for new enough distros
%if 0%{?fedora} >= 17
--
1.8.3.2
11 years, 5 months
[libvirt] [PATCH] spec: Disable libssh2 support for RHEL
by Jiri Denemark
From: Peter Krempa <pkrempa(a)redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=905513
Libssh2 isn't reliable enough to support the libvirt transport using it.
The problems include mishandling of "known_hosts" files that may confuse
users.
---
libvirt.spec.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index a3a831f..6236c08 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -252,7 +252,7 @@
%endif
# Enable libssh2 transport for new enough distros
-%if 0%{?fedora} >= 17 || 0%{?rhel} >= 6
+%if 0%{?fedora} >= 17
%define with_libssh2 0%{!?_without_libssh2:1}
%endif
--
1.8.3.2
11 years, 5 months
[libvirt] [PATCH] tests: Put a mock library at the start of LD_PRELOAD
by Jiri Denemark
This fixes vircgrouptest when run in a sandbox which already overrides
open() and others.
---
tests/testutils.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tests/testutils.h b/tests/testutils.h
index 27af5da..8583747 100644
--- a/tests/testutils.h
+++ b/tests/testutils.h
@@ -87,8 +87,9 @@ int virtTestMain(int argc,
perror(lib); \
return EXIT_FAILURE; \
} \
- if (virAsprintf(&newenv, "%s%s%s", preload ? preload : "", \
- preload ? ":" : "", lib) < 0) { \
+ if (!preload) { \
+ newenv = (char *) lib; \
+ } else if (virAsprintf(&newenv, "%s:%s", lib, preload) < 0) { \
perror("virAsprintf"); \
return EXIT_FAILURE; \
} \
--
1.8.3.2
11 years, 5 months
[libvirt] [PATCH] spec: Don't mix commands with macro definitions
by Jiri Denemark
%build section should first define all required macros and then run
commands. Interleaving them makes it harder to spot what commands are
run.
---
libvirt.spec.in | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 6d6203b..0fdba54 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1333,10 +1333,6 @@ of recent versions of Linux (and other OSes).
%define init_scripts --with-init_script=redhat
%endif
-%if 0%{?enable_autotools}
- autoreconf -if
-%endif
-
%if %{with_selinux}
%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7
%define with_selinux_mount --with-selinux-mount="/sys/fs/selinux"
@@ -1345,6 +1341,11 @@ of recent versions of Linux (and other OSes).
%endif
%endif
+
+%if 0%{?enable_autotools}
+ autoreconf -if
+%endif
+
%configure %{?_without_xen} \
%{?_without_qemu} \
%{?_without_openvz} \
--
1.8.3.2
11 years, 5 months
[libvirt] 3rd pass at virt-login-shell for joining an LXC Container
by dwalsh@redhat.com
All comments applied except for comments below. Also additional cleanup of
error handling.
> You'll need to call virGetUserDirectory() before any fork(), since it
> calls code which is not async-signal safe.
The reason I did this is I needed to call it after the shell setuid, if I
call it earlier it sees the UID=0 and gives me /root. I added a new interface
char *virGetUserDirectoryByUID(uid_t uid); Since the original interface does not
take a UID.
> Hmm, looking at this again, I'm wondering you need to fork()
> at all. In virsh we do the double-fork dance, because virsh
> is an interactive shell & we don't want to affect other parts
> of virsh.
> This login shell though is different - its only job is to run
> inside the namespace. So can't the main process just enter
> the namespace directly ?
I think you still need to do the second fork to make sure the /bin/sh PID
gets put in the container. Otherwise you will have a process running within
the container without a local PID.
[PATCH] virt-login-shell joins users into lxc container.
11 years, 5 months
[libvirt] [PATCH] Configuring systemd to restart libvirt on abort
by Mooli Tayer
----- Original Message -----
> On Mon, Jul 29, 2013 at 05:36:21PM +0300, Mooli Tayer wrote:
> > From: Mooli Tayer <mtayer(a)redhat.com>
> >
> > This will create a respawn behaviour in case libvirt
> > process exits due to an uncaught signal not specified
> > as a clean exit status.
> > see http://www.freedesktop.org/software/systemd/man/systemd.service.html
> > ---
> > daemon/libvirtd.service.in | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/daemon/libvirtd.service.in b/daemon/libvirtd.service.in
> > index aa5913b..b3c0849 100644
> > --- a/daemon/libvirtd.service.in
> > +++ b/daemon/libvirtd.service.in
> > @@ -15,6 +15,7 @@ EnvironmentFile=-/etc/sysconfig/libvirtd
> > ExecStart=@sbindir@/libvirtd $LIBVIRTD_ARGS
> > ExecReload=/bin/kill -HUP $MAINPID
> > KillMode=process
> > +Restart=on-abort
> > # Override the maximum number of opened files
> > #LimitNOFILE=2048
>
> I'm wondering whether 'on-abort' is the best choice or if
> 'on-failure' or 'always' are better. The systemd.service
> man page says
>
> [quote]
> Takes one of no, on-success, on-failure,
> on-abort, or always. If set to no (the
> default) the service will not be restarted. If
> set to on-success it will be restarted only
> when the service process exits cleanly. In
> this context, a clean exit means an exit code
> of 0, or one of the signals SIGHUP, SIGINT,
> SIGTERM, or SIGPIPE, and additionally, exit
> statuses and signals specified in
> SuccessExitStatus=. If set to on-failure the
> service will be restarted when the process
> exits with an nonzero exit code, is terminated
> by a signal (including on core dump), when an
> operation (such as service reload) times out,
> and when the configured watchdog timeout is
> triggered. If set to on-abort the service will
> be restarted only if the service process exits
> due to an uncaught signal not specified as a
> clean exit status. If set to always the
> service will be restarted regardless whether
> it exited cleanly or not, got terminated
> abnormally by a signal or hit a timeout.
> [/quote]
>
> I tend towards saying 'on-failure' here.
I agree. we defiantly want restart in the 'on-failure'
cases.
>
> Daniel
> --
> |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
> |: http://libvirt.org -o- http://virt-manager.org :|
> |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
> |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
>
> --
> libvir-list mailing list
> libvir-list(a)redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
>
11 years, 5 months