Invoke virCHProcessStop to kill CH process incase of any failures during
restore operation.
Signed-off-by: Purna Pavan Chandra <paekkaladevi(a)linux.microsoft.com>
---
src/ch/ch_process.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/ch/ch_process.c b/src/ch/ch_process.c
index ff0fc5ca63..38216bbf8d 100644
--- a/src/ch/ch_process.c
+++ b/src/ch/ch_process.c
@@ -980,7 +980,7 @@ virCHProcessStartRestore(virCHDriver *driver, virDomainObj *vm, const
char *from
if (!(priv->monitor = virCHProcessConnectMonitor(driver, vm))) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("failed to create connection to CH socket"));
- return -1;
+ goto cleanup;
}
}
@@ -991,7 +991,7 @@ virCHProcessStartRestore(virCHDriver *driver, virDomainObj *vm, const
char *from
if (virCHMonitorBuildRestoreJson(vm->def, from, &payload) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("failed to restore domain"));
- return -1;
+ goto cleanup;
}
virBufferAddLit(&http_headers, "PUT /api/v1/vm.restore HTTP/1.1\r\n");
@@ -1004,7 +1004,7 @@ virCHProcessStartRestore(virCHDriver *driver, virDomainObj *vm,
const char *from
payload = virBufferContentAndReset(&buf);
if ((mon_sockfd = chMonitorSocketConnect(priv->monitor)) < 0)
- return -1;
+ goto cleanup;
if (virCHRestoreCreateNetworkDevices(driver, vm->def, &tapfds, &ntapfds,
&nicindexes, &nnicindexes) < 0)
goto cleanup;
@@ -1041,5 +1041,7 @@ virCHProcessStartRestore(virCHDriver *driver, virDomainObj *vm,
const char *from
cleanup:
if (tapfds)
chCloseFDs(tapfds, ntapfds);
+ if (ret)
+ virCHProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED);
return ret;
}
--
2.34.1