提交 f3e359d6 编写于 作者: E Eric Blake

Revert "lxcDomainShutdownFlags: Cleanup @flags usage"

This reverts commit aa461933.

This patch was accidentally pushed prematurely, and has incorrect
logic for which shutdown methods to attempt.
Signed-off-by: NEric Blake <eblake@redhat.com>
上级 8531301d
...@@ -2701,8 +2701,7 @@ lxcDomainShutdownFlags(virDomainPtr dom, ...@@ -2701,8 +2701,7 @@ lxcDomainShutdownFlags(virDomainPtr dom,
virDomainObjPtr vm; virDomainObjPtr vm;
char *vroot = NULL; char *vroot = NULL;
int ret = -1; int ret = -1;
int rc = 0; int rc;
bool useInitctl = false, initctlRequested, signalRequested;
virCheckFlags(VIR_DOMAIN_SHUTDOWN_INITCTL | virCheckFlags(VIR_DOMAIN_SHUTDOWN_INITCTL |
VIR_DOMAIN_SHUTDOWN_SIGNAL, -1); VIR_DOMAIN_SHUTDOWN_SIGNAL, -1);
...@@ -2731,24 +2730,25 @@ lxcDomainShutdownFlags(virDomainPtr dom, ...@@ -2731,24 +2730,25 @@ lxcDomainShutdownFlags(virDomainPtr dom,
(unsigned long long)priv->initpid) < 0) (unsigned long long)priv->initpid) < 0)
goto cleanup; goto cleanup;
initctlRequested = flags & VIR_DOMAIN_SHUTDOWN_INITCTL; if (flags == 0 ||
signalRequested = flags & VIR_DOMAIN_SHUTDOWN_SIGNAL; (flags & VIR_DOMAIN_SHUTDOWN_INITCTL)) {
if ((rc = virInitctlSetRunLevel(VIR_INITCTL_RUNLEVEL_POWEROFF,
if (initctlRequested || !flags) vroot)) < 0) {
useInitctl = true;
if (useInitctl) {
rc = virInitctlSetRunLevel(VIR_INITCTL_RUNLEVEL_POWEROFF, vroot);
if (rc < 0 && !signalRequested)
goto cleanup; goto cleanup;
if (rc == 0 && !signalRequested) { }
if (rc == 0 && flags != 0 &&
((flags & ~VIR_DOMAIN_SHUTDOWN_INITCTL) == 0)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("Container does not provide an initctl pipe")); _("Container does not provide an initctl pipe"));
goto cleanup; goto cleanup;
} }
} else {
rc = 0;
} }
if (rc == 0 && !useInitctl) { if (rc == 0 &&
(flags == 0 ||
(flags & VIR_DOMAIN_SHUTDOWN_SIGNAL))) {
if (kill(priv->initpid, SIGTERM) < 0 && if (kill(priv->initpid, SIGTERM) < 0 &&
errno != ESRCH) { errno != ESRCH) {
virReportSystemError(errno, virReportSystemError(errno,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册