if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
goto cleanup;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
+ if (virDomainObjCheckActive(vm) < 0)
goto endjob;
- }
if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_PAUSED) {
if (libxl_domain_pause(cfg->ctx, vm->def->id) != 0) {
if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
goto cleanup;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
+ if (virDomainObjCheckActive(vm) < 0)
goto endjob;
- }
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
if (libxl_domain_unpause(cfg->ctx, vm->def->id) != 0) {
if (virDomainShutdownFlagsEnsureACL(dom->conn, vm->def, flags) < 0)
goto cleanup;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("Domain is not running"));
+ if (virDomainObjCheckActive(vm) < 0)
goto cleanup;
- }
if (flags & VIR_DOMAIN_SHUTDOWN_PARAVIRT) {
ret = libxl_domain_shutdown(cfg->ctx, vm->def->id);
if (virDomainRebootEnsureACL(dom->conn, vm->def, flags) < 0)
goto cleanup;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("Domain is not running"));
+ if (virDomainObjCheckActive(vm) < 0)
goto cleanup;
- }
if (flags & VIR_DOMAIN_REBOOT_PARAVIRT) {
ret = libxl_domain_reboot(cfg->ctx, vm->def->id);
if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
goto cleanup;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("Domain is not running"));
+ if (virDomainObjCheckActive(vm) < 0)
goto endjob;
- }
if (libxlDomainDestroyInternal(driver, vm) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
goto cleanup;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
+ if (virDomainObjCheckActive(vm) < 0)
goto endjob;
- }
if (libxlDoDomainSave(driver, vm, to) < 0)
goto endjob;
if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
goto cleanup;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
+ if (virDomainObjCheckActive(vm) < 0)
goto endjob;
- }
if (!(flags & VIR_DUMP_LIVE) &&
virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
goto cleanup;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
+ if (virDomainObjCheckActive(vm) < 0)
goto endjob;
- }
if (!vm->persistent) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("cannot do managed save for transient domain"));
if (virDomainGetVcpusEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
+ if (virDomainObjCheckActive(vm) < 0)
goto cleanup;
- }
if ((vcpuinfo = libxl_list_vcpu(cfg->ctx, vm->def->id, &maxcpu,
&hostcpus)) == NULL) {
if (virDomainGetSchedulerTypeEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
+ if (virDomainObjCheckActive(vm) < 0)
goto cleanup;
- }
sched_id = libxl_get_scheduler(cfg->ctx);
if (virDomainGetSchedulerParametersFlagsEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("Domain is not running"));
+ if (virDomainObjCheckActive(vm) < 0)
goto cleanup;
- }
sched_id = libxl_get_scheduler(cfg->ctx);
if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0)
goto cleanup;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
+ if (virDomainObjCheckActive(vm) < 0)
goto endjob;
- }
sched_id = libxl_get_scheduler(cfg->ctx);
if (virDomainOpenConsoleEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
+ if (virDomainObjCheckActive(vm) < 0)
goto cleanup;
- }
priv = vm->privateData;
if (dev_name) {
if (virDomainGetNumaParametersEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("Domain is not running"));
+ if (virDomainObjCheckActive(vm) < 0)
goto cleanup;
- }
if ((*nparams) == 0) {
*nparams = LIBXL_NUMA_NPARAM;
if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_QUERY) < 0)
goto cleanup;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
+ if (virDomainObjCheckActive(vm) < 0)
goto endjob;
- }
if (!(net = virDomainNetFind(vm->def, device)))
goto endjob;
if (virDomainGetCPUStatsEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
+ if (virDomainObjCheckActive(vm) < 0)
goto cleanup;
- }
if (start_cpu == -1)
ret = libxlDomainGetTotalCPUStats(driver, vm, params, nparams);
if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_QUERY) < 0)
goto cleanup;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
+ if (virDomainObjCheckActive(vm) < 0)
goto endjob;
- }
if (libxl_domain_info(cfg->ctx, &d_info, vm->def->id) != 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_QUERY) < 0)
goto cleanup;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
+ if (virDomainObjCheckActive(vm) < 0)
goto endjob;
- }
memset(&blkstats, 0, sizeof(libxlBlockStats));
if ((ret = libxlDomainBlockStatsGather(vm, path, &blkstats)) < 0)
if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_QUERY) < 0)
goto cleanup;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
+ if (virDomainObjCheckActive(vm) < 0)
goto endjob;
- }
/* return count of supported stats */
if (*nparams == 0) {
if (virDomainMigrateBegin3ParamsEnsureACL(domain->conn, vm->def) < 0)
goto cleanup;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is not running"));
+ if (virDomainObjCheckActive(vm) < 0)
goto cleanup;
- }
xmlout = libxlDomainMigrationSrcBegin(domain->conn, vm, xmlin,
cookieout, cookieoutlen);
if (virDomainInterfaceAddressesEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
- if (!virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("domain is not running"));
+ if (virDomainObjCheckActive(vm) < 0)
goto cleanup;
- }
switch (source) {
case VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE: