提交 cb1938eb 编写于 作者: D Daniel P. Berrangé

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: NErik Skultety <eskultet@redhat.com>
Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 38e9e7e0
...@@ -1280,7 +1280,7 @@ bhyveStateInitialize(bool privileged, ...@@ -1280,7 +1280,7 @@ bhyveStateInitialize(bool privileged,
} }
if ((bhyve_driver->lockFD = if ((bhyve_driver->lockFD =
virPidFileAcquire(BHYVE_STATE_DIR, "driver", true, getpid())) < 0) virPidFileAcquire(BHYVE_STATE_DIR, "driver", false, getpid())) < 0)
goto cleanup; goto cleanup;
if (virDomainObjListLoadAllConfigs(bhyve_driver->domains, if (virDomainObjListLoadAllConfigs(bhyve_driver->domains,
......
...@@ -120,7 +120,7 @@ netcfStateInitialize(bool privileged, ...@@ -120,7 +120,7 @@ netcfStateInitialize(bool privileged,
} }
if ((driver->lockFD = if ((driver->lockFD =
virPidFileAcquire(driver->stateDir, "driver", true, getpid())) < 0) virPidFileAcquire(driver->stateDir, "driver", false, getpid())) < 0)
goto error; goto error;
/* open netcf */ /* open netcf */
......
...@@ -1199,7 +1199,7 @@ udevStateInitialize(bool privileged, ...@@ -1199,7 +1199,7 @@ udevStateInitialize(bool privileged,
} }
if ((driver->lockFD = if ((driver->lockFD =
virPidFileAcquire(driver->stateDir, "driver", true, getpid())) < 0) virPidFileAcquire(driver->stateDir, "driver", false, getpid())) < 0)
goto cleanup; goto cleanup;
driver->udev = udev_new(); driver->udev = udev_new();
......
...@@ -747,7 +747,7 @@ libxlStateInitialize(bool privileged, ...@@ -747,7 +747,7 @@ libxlStateInitialize(bool privileged,
} }
if ((libxl_driver->lockFD = if ((libxl_driver->lockFD =
virPidFileAcquire(cfg->stateDir, "driver", true, getpid())) < 0) virPidFileAcquire(cfg->stateDir, "driver", false, getpid())) < 0)
goto error; goto error;
if (!(libxl_driver->lockManager = if (!(libxl_driver->lockManager =
......
...@@ -1607,7 +1607,7 @@ static int lxcStateInitialize(bool privileged, ...@@ -1607,7 +1607,7 @@ static int lxcStateInitialize(bool privileged,
} }
if ((lxc_driver->lockFD = if ((lxc_driver->lockFD =
virPidFileAcquire(cfg->stateDir, "driver", true, getpid())) < 0) virPidFileAcquire(cfg->stateDir, "driver", false, getpid())) < 0)
goto cleanup; goto cleanup;
/* Get all the running persistent or transient configs first */ /* Get all the running persistent or transient configs first */
......
...@@ -164,7 +164,7 @@ main(int argc, char **argv) ...@@ -164,7 +164,7 @@ main(int argc, char **argv)
goto cleanup; goto cleanup;
/* Try to claim the pidfile, exiting if we can't */ /* 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; goto cleanup;
/* Since interfaces can be hot plugged, we need to make sure that the /* Since interfaces can be hot plugged, we need to make sure that the
......
...@@ -637,7 +637,7 @@ nodeStateInitialize(bool privileged ATTRIBUTE_UNUSED, ...@@ -637,7 +637,7 @@ nodeStateInitialize(bool privileged ATTRIBUTE_UNUSED,
} }
if ((driver->lockFD = if ((driver->lockFD =
virPidFileAcquire(driver->stateDir, "driver", true, getpid())) < 0) virPidFileAcquire(driver->stateDir, "driver", false, getpid())) < 0)
goto failure; goto failure;
if (!(driver->devs = virNodeDeviceObjListNew())) if (!(driver->devs = virNodeDeviceObjListNew()))
......
...@@ -1848,7 +1848,7 @@ nodeStateInitialize(bool privileged, ...@@ -1848,7 +1848,7 @@ nodeStateInitialize(bool privileged,
} }
if ((driver->lockFD = if ((driver->lockFD =
virPidFileAcquire(driver->stateDir, "driver", true, getpid())) < 0) virPidFileAcquire(driver->stateDir, "driver", false, getpid())) < 0)
goto cleanup; goto cleanup;
if (!(driver->devs = virNodeDeviceObjListNew()) || if (!(driver->devs = virNodeDeviceObjListNew()) ||
......
...@@ -215,7 +215,7 @@ nwfilterStateInitialize(bool privileged, ...@@ -215,7 +215,7 @@ nwfilterStateInitialize(bool privileged,
} }
if ((driver->lockFD = if ((driver->lockFD =
virPidFileAcquire(driver->stateDir, "driver", true, getpid())) < 0) virPidFileAcquire(driver->stateDir, "driver", false, getpid())) < 0)
goto error; goto error;
if (virNWFilterIPAddrMapInit() < 0) if (virNWFilterIPAddrMapInit() < 0)
......
...@@ -677,7 +677,7 @@ qemuStateInitialize(bool privileged, ...@@ -677,7 +677,7 @@ qemuStateInitialize(bool privileged,
} }
if ((qemu_driver->lockFD = if ((qemu_driver->lockFD =
virPidFileAcquire(cfg->stateDir, "driver", true, getpid())) < 0) virPidFileAcquire(cfg->stateDir, "driver", false, getpid())) < 0)
goto error; goto error;
qemu_driver->qemuImgBinary = virFindFileInPath("qemu-img"); qemu_driver->qemuImgBinary = virFindFileInPath("qemu-img");
......
...@@ -504,7 +504,7 @@ secretStateInitialize(bool privileged, ...@@ -504,7 +504,7 @@ secretStateInitialize(bool privileged,
} }
if ((driver->lockFD = if ((driver->lockFD =
virPidFileAcquire(driver->stateDir, "driver", true, getpid())) < 0) virPidFileAcquire(driver->stateDir, "driver", false, getpid())) < 0)
goto error; goto error;
if (!(driver->secrets = virSecretObjListNew())) if (!(driver->secrets = virSecretObjListNew()))
......
...@@ -4129,7 +4129,7 @@ vzStateInitialize(bool privileged, ...@@ -4129,7 +4129,7 @@ vzStateInitialize(bool privileged,
} }
if ((vz_driver_lock_fd = if ((vz_driver_lock_fd =
virPidFileAcquire(VZ_STATEDIR, "driver", true, getpid())) < 0) virPidFileAcquire(VZ_STATEDIR, "driver", false, getpid())) < 0)
return -1; return -1;
if (prlsdkInit() < 0) { if (prlsdkInit() < 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册