all: don't wait for driver lock during startup

When the drivers acquire their pidfile lock we don't want to wait if the
lock is already held. We need the driver to immediately report error,
causing the daemon to exit.

Reviewed-by: Erik Skultety <eskultet@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2019-07-11 15:57:34 +01:00
parent 38e9e7e0d7
commit cb1938eb58
12 changed files with 12 additions and 12 deletions

View File

@ -1280,7 +1280,7 @@ bhyveStateInitialize(bool privileged,
}
if ((bhyve_driver->lockFD =
virPidFileAcquire(BHYVE_STATE_DIR, "driver", true, getpid())) < 0)
virPidFileAcquire(BHYVE_STATE_DIR, "driver", false, getpid())) < 0)
goto cleanup;
if (virDomainObjListLoadAllConfigs(bhyve_driver->domains,

View File

@ -120,7 +120,7 @@ netcfStateInitialize(bool privileged,
}
if ((driver->lockFD =
virPidFileAcquire(driver->stateDir, "driver", true, getpid())) < 0)
virPidFileAcquire(driver->stateDir, "driver", false, getpid())) < 0)
goto error;
/* open netcf */

View File

@ -1199,7 +1199,7 @@ udevStateInitialize(bool privileged,
}
if ((driver->lockFD =
virPidFileAcquire(driver->stateDir, "driver", true, getpid())) < 0)
virPidFileAcquire(driver->stateDir, "driver", false, getpid())) < 0)
goto cleanup;
driver->udev = udev_new();

View File

@ -747,7 +747,7 @@ libxlStateInitialize(bool privileged,
}
if ((libxl_driver->lockFD =
virPidFileAcquire(cfg->stateDir, "driver", true, getpid())) < 0)
virPidFileAcquire(cfg->stateDir, "driver", false, getpid())) < 0)
goto error;
if (!(libxl_driver->lockManager =

View File

@ -1607,7 +1607,7 @@ static int lxcStateInitialize(bool privileged,
}
if ((lxc_driver->lockFD =
virPidFileAcquire(cfg->stateDir, "driver", true, getpid())) < 0)
virPidFileAcquire(cfg->stateDir, "driver", false, getpid())) < 0)
goto cleanup;
/* Get all the running persistent or transient configs first */

View File

@ -164,7 +164,7 @@ main(int argc, char **argv)
goto cleanup;
/* Try to claim the pidfile, exiting if we can't */
if ((pid_file_fd = virPidFileAcquirePath(pid_file, true, getpid())) < 0)
if ((pid_file_fd = virPidFileAcquirePath(pid_file, false, getpid())) < 0)
goto cleanup;
/* Since interfaces can be hot plugged, we need to make sure that the

View File

@ -637,7 +637,7 @@ nodeStateInitialize(bool privileged ATTRIBUTE_UNUSED,
}
if ((driver->lockFD =
virPidFileAcquire(driver->stateDir, "driver", true, getpid())) < 0)
virPidFileAcquire(driver->stateDir, "driver", false, getpid())) < 0)
goto failure;
if (!(driver->devs = virNodeDeviceObjListNew()))

View File

@ -1848,7 +1848,7 @@ nodeStateInitialize(bool privileged,
}
if ((driver->lockFD =
virPidFileAcquire(driver->stateDir, "driver", true, getpid())) < 0)
virPidFileAcquire(driver->stateDir, "driver", false, getpid())) < 0)
goto cleanup;
if (!(driver->devs = virNodeDeviceObjListNew()) ||

View File

@ -215,7 +215,7 @@ nwfilterStateInitialize(bool privileged,
}
if ((driver->lockFD =
virPidFileAcquire(driver->stateDir, "driver", true, getpid())) < 0)
virPidFileAcquire(driver->stateDir, "driver", false, getpid())) < 0)
goto error;
if (virNWFilterIPAddrMapInit() < 0)

View File

@ -677,7 +677,7 @@ qemuStateInitialize(bool privileged,
}
if ((qemu_driver->lockFD =
virPidFileAcquire(cfg->stateDir, "driver", true, getpid())) < 0)
virPidFileAcquire(cfg->stateDir, "driver", false, getpid())) < 0)
goto error;
qemu_driver->qemuImgBinary = virFindFileInPath("qemu-img");

View File

@ -504,7 +504,7 @@ secretStateInitialize(bool privileged,
}
if ((driver->lockFD =
virPidFileAcquire(driver->stateDir, "driver", true, getpid())) < 0)
virPidFileAcquire(driver->stateDir, "driver", false, getpid())) < 0)
goto error;
if (!(driver->secrets = virSecretObjListNew()))

View File

@ -4129,7 +4129,7 @@ vzStateInitialize(bool privileged,
}
if ((vz_driver_lock_fd =
virPidFileAcquire(VZ_STATEDIR, "driver", true, getpid())) < 0)
virPidFileAcquire(VZ_STATEDIR, "driver", false, getpid())) < 0)
return -1;
if (prlsdkInit() < 0) {