mirror of
https://github.com/libvirt/libvirt.git
synced 2026-09-03 20:53:04 -05:00
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:
@@ -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,
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()))
|
||||
|
||||
@@ -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()) ||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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()))
|
||||
|
||||
+1
-1
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user