[PATCH 03/16] Remove redundant parameter to virBhyveProcessStart()

Ryan Moeller posted 16 patches 4 years, 9 months ago
There is a newer version of this series
[PATCH 03/16] Remove redundant parameter to virBhyveProcessStart()
Posted by Ryan Moeller 4 years, 9 months ago
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
---
 src/bhyve/bhyve_driver.c  |  6 +++---
 src/bhyve/bhyve_process.c | 18 ++++++++----------
 src/bhyve/bhyve_process.h |  1 -
 3 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 365a3777a0..7b8e4808f9 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -89,7 +89,7 @@ bhyveAutostartDomain(virDomainObjPtr vm, void *opaque)
     virObjectLock(vm);
     if (vm->autostart && !virDomainObjIsActive(vm)) {
         virResetLastError();
-        ret = virBhyveProcessStart(data->conn, data->driver, vm,
+        ret = virBhyveProcessStart(data->conn, vm,
                                    VIR_DOMAIN_RUNNING_BOOTED, 0);
         if (ret < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -861,7 +861,7 @@ bhyveDomainCreateWithFlags(virDomainPtr dom,
         goto cleanup;
     }
 
-    ret = virBhyveProcessStart(dom->conn, privconn, vm,
+    ret = virBhyveProcessStart(dom->conn, vm,
                                VIR_DOMAIN_RUNNING_BOOTED,
                                start_flags);
 
@@ -920,7 +920,7 @@ bhyveDomainCreateXML(virConnectPtr conn,
         goto cleanup;
     def = NULL;
 
-    if (virBhyveProcessStart(conn, privconn, vm,
+    if (virBhyveProcessStart(conn, vm,
                              VIR_DOMAIN_RUNNING_BOOTED,
                              start_flags) < 0) {
         /* If domain is not persistent, remove its data */
diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c
index 2ea8db3b55..b0b428eeb4 100644
--- a/src/bhyve/bhyve_process.c
+++ b/src/bhyve/bhyve_process.c
@@ -93,7 +93,6 @@ virBhyveFormatDevMapFile(const char *vm_name, char **fn_out)
 
 int
 virBhyveProcessStart(virConnectPtr conn,
-                     bhyveConnPtr driver,
                      virDomainObjPtr vm,
                      virDomainRunningReason reason,
                      unsigned int flags)
@@ -106,12 +105,11 @@ virBhyveProcessStart(virConnectPtr conn,
     char ebuf[1024];
     virCommandPtr cmd = NULL;
     virCommandPtr load_cmd = NULL;
-    bhyveConnPtr privconn = conn->privateData;
+    bhyveConnPtr driver = conn->privateData;
     bhyveDomainObjPrivatePtr priv = vm->privateData;
     int ret = -1, rc;
 
     logfile = g_strdup_printf("%s/%s.log", BHYVE_LOG_DIR, vm->def->name);
-
     if ((logfd = open(logfile, O_WRONLY | O_APPEND | O_CREAT,
                       S_IRUSR | S_IWUSR)) < 0) {
         virReportSystemError(errno,
@@ -120,19 +118,19 @@ virBhyveProcessStart(virConnectPtr conn,
         goto cleanup;
     }
 
-    VIR_FREE(privconn->pidfile);
-    if (!(privconn->pidfile = virPidFileBuildPath(BHYVE_STATE_DIR,
-                                                  vm->def->name))) {
+    VIR_FREE(driver->pidfile);
+    if (!(driver->pidfile = virPidFileBuildPath(BHYVE_STATE_DIR,
+                                                vm->def->name))) {
         virReportSystemError(errno,
                              "%s", _("Failed to build pidfile path"));
         goto cleanup;
     }
 
-    if (unlink(privconn->pidfile) < 0 &&
+    if (unlink(driver->pidfile) < 0 &&
         errno != ENOENT) {
         virReportSystemError(errno,
                              _("Cannot remove state PID file %s"),
-                             privconn->pidfile);
+                             driver->pidfile);
         goto cleanup;
     }
 
@@ -146,7 +144,7 @@ virBhyveProcessStart(virConnectPtr conn,
     virCommandSetOutputFD(cmd, &logfd);
     virCommandSetErrorFD(cmd, &logfd);
     virCommandWriteArgLog(cmd, logfd);
-    virCommandSetPidFile(cmd, privconn->pidfile);
+    virCommandSetPidFile(cmd, driver->pidfile);
     virCommandDaemonize(cmd);
 
     if (vm->def->os.loader == NULL) {
@@ -188,7 +186,7 @@ virBhyveProcessStart(virConnectPtr conn,
     if (virCommandRun(cmd, NULL) < 0)
         goto cleanup;
 
-    if (virPidFileReadPath(privconn->pidfile, &vm->pid) < 0) {
+    if (virPidFileReadPath(driver->pidfile, &vm->pid) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Domain %s didn't show up"), vm->def->name);
         goto cleanup;
diff --git a/src/bhyve/bhyve_process.h b/src/bhyve/bhyve_process.h
index 4f62f6be4b..8419e44faa 100644
--- a/src/bhyve/bhyve_process.h
+++ b/src/bhyve/bhyve_process.h
@@ -24,7 +24,6 @@
 #include "bhyve_utils.h"
 
 int virBhyveProcessStart(virConnectPtr conn,
-                         bhyveConnPtr driver,
                          virDomainObjPtr vm,
                          virDomainRunningReason reason,
                          unsigned int flags);
-- 
2.24.1


Re: [PATCH 03/16] Remove redundant parameter to virBhyveProcessStart()
Posted by Ján Tomko 4 years, 9 months ago
On Sat, Feb 22, 2020 at 01:38:42AM -0500, Ryan Moeller wrote:
>Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
>---
> src/bhyve/bhyve_driver.c  |  6 +++---
> src/bhyve/bhyve_process.c | 18 ++++++++----------
> src/bhyve/bhyve_process.h |  1 -
> 3 files changed, 11 insertions(+), 14 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano