qemu: Make sure BeginJob is always followed by EndJob

Otherwise we can end up with a dangling job that can only be cleared by
restarting libvirtd.
This commit is contained in:
Jiri Denemark 2011-10-13 12:51:02 +02:00
parent dddbfcf6d6
commit bf7676af30

View File

@ -2023,16 +2023,16 @@ static int qemuDomainSendKey(virDomainPtr domain,
if (!virDomainObjIsActive(vm)) { if (!virDomainObjIsActive(vm)) {
qemuReportError(VIR_ERR_OPERATION_INVALID, qemuReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running")); "%s", _("domain is not running"));
goto cleanup; goto endjob;
} }
qemuDomainObjEnterMonitorWithDriver(driver, vm); qemuDomainObjEnterMonitorWithDriver(driver, vm);
ret = qemuMonitorSendKey(priv->mon, holdtime, keycodes, nkeycodes); ret = qemuMonitorSendKey(priv->mon, holdtime, keycodes, nkeycodes);
qemuDomainObjExitMonitorWithDriver(driver, vm); qemuDomainObjExitMonitorWithDriver(driver, vm);
if (qemuDomainObjEndJob(driver, vm) == 0) {
endjob:
if (qemuDomainObjEndJob(driver, vm) == 0)
vm = NULL; vm = NULL;
goto cleanup;
}
cleanup: cleanup:
if (vm) if (vm)
@ -7221,7 +7221,7 @@ qemudDomainBlockStatsFlags (virDomainPtr dom,
if (virStrcpyStatic(param->field, VIR_DOMAIN_BLOCK_STATS_WRITE_BYTES) == NULL) { if (virStrcpyStatic(param->field, VIR_DOMAIN_BLOCK_STATS_WRITE_BYTES) == NULL) {
qemuReportError(VIR_ERR_INTERNAL_ERROR, qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Field write bytes too long for destination")); "%s", _("Field write bytes too long for destination"));
goto cleanup; goto endjob;
} }
param->type = VIR_TYPED_PARAM_LLONG; param->type = VIR_TYPED_PARAM_LLONG;
param->value.l = wr_bytes; param->value.l = wr_bytes;
@ -7231,7 +7231,7 @@ qemudDomainBlockStatsFlags (virDomainPtr dom,
if (virStrcpyStatic(param->field, VIR_DOMAIN_BLOCK_STATS_WRITE_REQ) == NULL) { if (virStrcpyStatic(param->field, VIR_DOMAIN_BLOCK_STATS_WRITE_REQ) == NULL) {
qemuReportError(VIR_ERR_INTERNAL_ERROR, qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Field write requests too long for destination")); "%s", _("Field write requests too long for destination"));
goto cleanup; goto endjob;
} }
param->type = VIR_TYPED_PARAM_LLONG; param->type = VIR_TYPED_PARAM_LLONG;
param->value.l = wr_req; param->value.l = wr_req;
@ -7241,7 +7241,7 @@ qemudDomainBlockStatsFlags (virDomainPtr dom,
if (virStrcpyStatic(param->field, VIR_DOMAIN_BLOCK_STATS_READ_BYTES) == NULL) { if (virStrcpyStatic(param->field, VIR_DOMAIN_BLOCK_STATS_READ_BYTES) == NULL) {
qemuReportError(VIR_ERR_INTERNAL_ERROR, qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Field read bytes too long for destination")); "%s", _("Field read bytes too long for destination"));
goto cleanup; goto endjob;
} }
param->type = VIR_TYPED_PARAM_LLONG; param->type = VIR_TYPED_PARAM_LLONG;
param->value.l = rd_bytes; param->value.l = rd_bytes;
@ -7251,7 +7251,7 @@ qemudDomainBlockStatsFlags (virDomainPtr dom,
if (virStrcpyStatic(param->field, VIR_DOMAIN_BLOCK_STATS_READ_REQ) == NULL) { if (virStrcpyStatic(param->field, VIR_DOMAIN_BLOCK_STATS_READ_REQ) == NULL) {
qemuReportError(VIR_ERR_INTERNAL_ERROR, qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Field read requests too long for destination")); "%s", _("Field read requests too long for destination"));
goto cleanup; goto endjob;
} }
param->type = VIR_TYPED_PARAM_LLONG; param->type = VIR_TYPED_PARAM_LLONG;
param->value.l = rd_req; param->value.l = rd_req;
@ -7261,7 +7261,7 @@ qemudDomainBlockStatsFlags (virDomainPtr dom,
if (virStrcpyStatic(param->field, VIR_DOMAIN_BLOCK_STATS_FLUSH_REQ) == NULL) { if (virStrcpyStatic(param->field, VIR_DOMAIN_BLOCK_STATS_FLUSH_REQ) == NULL) {
qemuReportError(VIR_ERR_INTERNAL_ERROR, qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Field flush requests too long for destination")); "%s", _("Field flush requests too long for destination"));
goto cleanup; goto endjob;
} }
param->type = VIR_TYPED_PARAM_LLONG; param->type = VIR_TYPED_PARAM_LLONG;
param->value.l = flush_req; param->value.l = flush_req;
@ -7271,7 +7271,7 @@ qemudDomainBlockStatsFlags (virDomainPtr dom,
if (virStrcpyStatic(param->field, VIR_DOMAIN_BLOCK_STATS_WRITE_TOTAL_TIMES) == NULL) { if (virStrcpyStatic(param->field, VIR_DOMAIN_BLOCK_STATS_WRITE_TOTAL_TIMES) == NULL) {
qemuReportError(VIR_ERR_INTERNAL_ERROR, qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Field write total times too long for destination")); "%s", _("Field write total times too long for destination"));
goto cleanup; goto endjob;
} }
param->type = VIR_TYPED_PARAM_LLONG; param->type = VIR_TYPED_PARAM_LLONG;
param->value.l = wr_total_times; param->value.l = wr_total_times;
@ -7281,7 +7281,7 @@ qemudDomainBlockStatsFlags (virDomainPtr dom,
if (virStrcpyStatic(param->field, VIR_DOMAIN_BLOCK_STATS_READ_TOTAL_TIMES) == NULL) { if (virStrcpyStatic(param->field, VIR_DOMAIN_BLOCK_STATS_READ_TOTAL_TIMES) == NULL) {
qemuReportError(VIR_ERR_INTERNAL_ERROR, qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Field read total times too long for destination")); "%s", _("Field read total times too long for destination"));
goto cleanup; goto endjob;
} }
param->type = VIR_TYPED_PARAM_LLONG; param->type = VIR_TYPED_PARAM_LLONG;
param->value.l = rd_total_times; param->value.l = rd_total_times;
@ -7291,7 +7291,7 @@ qemudDomainBlockStatsFlags (virDomainPtr dom,
if (virStrcpyStatic(param->field, VIR_DOMAIN_BLOCK_STATS_READ_TOTAL_TIMES) == NULL) { if (virStrcpyStatic(param->field, VIR_DOMAIN_BLOCK_STATS_READ_TOTAL_TIMES) == NULL) {
qemuReportError(VIR_ERR_INTERNAL_ERROR, qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Field flush total times too long for destination")); "%s", _("Field flush total times too long for destination"));
goto cleanup; goto endjob;
} }
param->type = VIR_TYPED_PARAM_LLONG; param->type = VIR_TYPED_PARAM_LLONG;
param->value.l = flush_total_times; param->value.l = flush_total_times;