# HG changeset patch
# User john.levon(a)sun.com
# Date 1233765613 28800
# Node ID 706a43692cceeba796e36c070e2b46f85d8cb4f0
# Parent bda41ea0cbbdea409447686c30b7afb10b9cae85
Report error for some xend operations on shutdown domain
Signed-off-by: John Levon <john.levon(a)sun.com>
diff --git a/src/xend_internal.c b/src/xend_internal.c
--- a/src/xend_internal.c
+++ b/src/xend_internal.c
@@ -2833,8 +2833,13 @@ xenDaemonDomainSuspend(virDomainPtr doma
__FUNCTION__);
return(-1);
}
- if (domain->id < 0)
+
+ if (domain->id < 0) {
+ virXendError(domain->conn, VIR_ERR_INVALID_ARG,
+ _("Domain %s isn't running."), domain->name);
return(-1);
+ }
+
return xend_op(domain->conn, domain->name, "op", "pause",
NULL);
}
@@ -2855,8 +2860,13 @@ xenDaemonDomainResume(virDomainPtr domai
__FUNCTION__);
return(-1);
}
- if (domain->id < 0)
+
+ if (domain->id < 0) {
+ virXendError(domain->conn, VIR_ERR_INVALID_ARG,
+ _("Domain %s isn't running."), domain->name);
return(-1);
+ }
+
return xend_op(domain->conn, domain->name, "op", "unpause",
NULL);
}
@@ -2878,8 +2888,13 @@ xenDaemonDomainShutdown(virDomainPtr dom
__FUNCTION__);
return(-1);
}
- if (domain->id < 0)
+
+ if (domain->id < 0) {
+ virXendError(domain->conn, VIR_ERR_INVALID_ARG,
+ _("Domain %s isn't running."), domain->name);
return(-1);
+ }
+
return xend_op(domain->conn, domain->name, "op",
"shutdown", "reason", "poweroff", NULL);
}
@@ -2902,8 +2917,13 @@ xenDaemonDomainReboot(virDomainPtr domai
__FUNCTION__);
return(-1);
}
- if (domain->id < 0)
+
+ if (domain->id < 0) {
+ virXendError(domain->conn, VIR_ERR_INVALID_ARG,
+ _("Domain %s isn't running."), domain->name);
return(-1);
+ }
+
return xend_op(domain->conn, domain->name, "op",
"shutdown", "reason", "reboot", NULL);
}
@@ -2928,8 +2948,13 @@ xenDaemonDomainDestroy(virDomainPtr doma
__FUNCTION__);
return(-1);
}
- if (domain->id < 0)
+
+ if (domain->id < 0) {
+ virXendError(domain->conn, VIR_ERR_INVALID_ARG,
+ _("Domain %s isn't running."), domain->name);
return(-1);
+ }
+
return xend_op(domain->conn, domain->name, "op", "destroy",
NULL);
}
@@ -2993,12 +3018,17 @@ xenDaemonDomainSave(virDomainPtr domain,
xenDaemonDomainSave(virDomainPtr domain, const char *filename)
{
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL) ||
- (filename == NULL) || (domain->id < 0)) {
+ (filename == NULL)) {
virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
__FUNCTION__);
return(-1);
}
+ if (domain->id < 0) {
+ virXendError(domain->conn, VIR_ERR_INVALID_ARG,
+ _("Domain %s isn't running."), domain->name);
+ return(-1);
+ }
/* We can't save the state of Domain-0, that would mean stopping it too */
if (domain->id == 0) {
@@ -3030,8 +3060,13 @@ xenDaemonDomainCoreDump(virDomainPtr dom
__FUNCTION__);
return(-1);
}
- if (domain->id < 0)
+
+ if (domain->id < 0) {
+ virXendError(domain->conn, VIR_ERR_INVALID_ARG,
+ _("Domain %s isn't running."), domain->name);
return(-1);
+ }
+
return xend_op(domain->conn, domain->name, "op", "dump",
"file", filename,
"live", "0", "crash", "0",
NULL);
}
@@ -3599,8 +3634,12 @@ xenDaemonDomainPinVcpu(virDomainPtr doma
__FUNCTION__);
return (-1);
}
- if (domain->id < 0)
+
+ if (domain->id < 0) {
+ virXendError(domain->conn, VIR_ERR_INVALID_ARG,
+ _("Domain %s isn't running."), domain->name);
return(-1);
+ }
/* from bit map, build character string of mapped CPU numbers */
for (i = 0; i < maplen; i++) for (j = 0; j < 8; j++)