提交 8f7c25ae 编写于 作者: P Peter Krempa

qemu: process: Change semantics of functions starting PR daemon

Libvirt only manages one PR daemon. This means that we don't need to
pass the 'disk' object and also rename the functions dealing with this
so that it's obvious we only deal with the managed PR daemon.

Signed-off-by: Peter Krempa <pkrempa@redhat st.com>
上级 b571e7ba
...@@ -377,7 +377,7 @@ qemuDomainMaybeStartPRDaemon(virDomainObjPtr vm, ...@@ -377,7 +377,7 @@ qemuDomainMaybeStartPRDaemon(virDomainObjPtr vm,
/* @disk requires qemu-pr-helper but none is running. /* @disk requires qemu-pr-helper but none is running.
* Start it now. */ * Start it now. */
if (qemuProcessStartPRDaemon(vm, disk) < 0) if (qemuProcessStartManagedPRDaemon(vm) < 0)
return -1; return -1;
return 1; return 1;
...@@ -567,7 +567,7 @@ qemuDomainAttachDiskGeneric(virQEMUDriverPtr driver, ...@@ -567,7 +567,7 @@ qemuDomainAttachDiskGeneric(virQEMUDriverPtr driver,
qemuDomainDelDiskSrcTLSObject(driver, vm, disk->src); qemuDomainDelDiskSrcTLSObject(driver, vm, disk->src);
ignore_value(qemuHotplugPrepareDiskAccess(driver, vm, disk, NULL, true)); ignore_value(qemuHotplugPrepareDiskAccess(driver, vm, disk, NULL, true));
if (prdStarted) if (prdStarted)
qemuProcessKillPRDaemon(vm); qemuProcessKillManagedPRDaemon(vm);
goto cleanup; goto cleanup;
} }
...@@ -3963,7 +3963,7 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver, ...@@ -3963,7 +3963,7 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver,
} }
if (stopPRDaemon) if (stopPRDaemon)
qemuProcessKillPRDaemon(vm); qemuProcessKillManagedPRDaemon(vm);
qemuDomainReleaseDeviceAddress(vm, &disk->info, src); qemuDomainReleaseDeviceAddress(vm, &disk->info, src);
......
...@@ -2566,7 +2566,7 @@ qemuProcessBuildPRHelperPidfilePath(virDomainObjPtr vm) ...@@ -2566,7 +2566,7 @@ qemuProcessBuildPRHelperPidfilePath(virDomainObjPtr vm)
void void
qemuProcessKillPRDaemon(virDomainObjPtr vm) qemuProcessKillManagedPRDaemon(virDomainObjPtr vm)
{ {
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
virErrorPtr orig_err; virErrorPtr orig_err;
...@@ -2624,8 +2624,7 @@ qemuProcessStartPRDaemonHook(void *opaque) ...@@ -2624,8 +2624,7 @@ qemuProcessStartPRDaemonHook(void *opaque)
int int
qemuProcessStartPRDaemon(virDomainObjPtr vm, qemuProcessStartManagedPRDaemon(virDomainObjPtr vm)
const virDomainDiskDef *disk)
{ {
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
virQEMUDriverPtr driver = priv->driver; virQEMUDriverPtr driver = priv->driver;
...@@ -2640,10 +2639,6 @@ qemuProcessStartPRDaemon(virDomainObjPtr vm, ...@@ -2640,10 +2639,6 @@ qemuProcessStartPRDaemon(virDomainObjPtr vm,
const unsigned long long timeout = 500000; /* ms */ const unsigned long long timeout = 500000; /* ms */
int ret = -1; int ret = -1;
if (!virStoragePRDefIsManaged(disk->src->pr) ||
priv->prDaemonRunning)
return 0;
cfg = virQEMUDriverGetConfig(driver); cfg = virQEMUDriverGetConfig(driver);
if (!virFileIsExecutable(cfg->prHelperName)) { if (!virFileIsExecutable(cfg->prHelperName)) {
...@@ -2734,7 +2729,7 @@ qemuProcessStartPRDaemon(virDomainObjPtr vm, ...@@ -2734,7 +2729,7 @@ qemuProcessStartPRDaemon(virDomainObjPtr vm,
goto cleanup; goto cleanup;
priv->prDaemonRunning = true; priv->prDaemonRunning = true;
ret = 1; ret = 0;
cleanup: cleanup:
if (ret < 0) { if (ret < 0) {
virCommandAbort(cmd); virCommandAbort(cmd);
...@@ -2754,22 +2749,22 @@ qemuProcessStartPRDaemon(virDomainObjPtr vm, ...@@ -2754,22 +2749,22 @@ qemuProcessStartPRDaemon(virDomainObjPtr vm,
static int static int
qemuProcessMaybeStartPRDaemon(virDomainObjPtr vm) qemuProcessMaybeStartManagedPRDaemon(virDomainObjPtr vm)
{ {
bool hasManaged = false;
size_t i; size_t i;
int rv;
for (i = 0; i < vm->def->ndisks; i++) { for (i = 0; i < vm->def->ndisks; i++) {
const virDomainDiskDef *disk = vm->def->disks[i]; if (virStoragePRDefIsManaged(vm->def->disks[i]->src->pr)) {
hasManaged = true;
if ((rv = qemuProcessStartPRDaemon(vm, disk)) < 0) break;
return -1; }
if (rv > 0)
return 1;
} }
if (!hasManaged)
return 0; return 0;
return qemuProcessStartManagedPRDaemon(vm);
} }
...@@ -6289,8 +6284,8 @@ qemuProcessLaunch(virConnectPtr conn, ...@@ -6289,8 +6284,8 @@ qemuProcessLaunch(virConnectPtr conn,
if (qemuProcessResctrlCreate(driver, vm) < 0) if (qemuProcessResctrlCreate(driver, vm) < 0)
goto cleanup; goto cleanup;
VIR_DEBUG("Setting up PR daemon"); VIR_DEBUG("Setting up managed PR daemon");
if (qemuProcessMaybeStartPRDaemon(vm) < 0) if (qemuProcessMaybeStartManagedPRDaemon(vm) < 0)
goto cleanup; goto cleanup;
VIR_DEBUG("Setting domain security labels"); VIR_DEBUG("Setting domain security labels");
...@@ -6821,7 +6816,7 @@ void qemuProcessStop(virQEMUDriverPtr driver, ...@@ -6821,7 +6816,7 @@ void qemuProcessStop(virQEMUDriverPtr driver,
qemuDomainMasterKeyRemove(priv); qemuDomainMasterKeyRemove(priv);
/* Do this before we delete the tree and remove pidfile. */ /* Do this before we delete the tree and remove pidfile. */
qemuProcessKillPRDaemon(vm); qemuProcessKillManagedPRDaemon(vm);
virFileDeleteTree(priv->libDir); virFileDeleteTree(priv->libDir);
virFileDeleteTree(priv->channelTargetDir); virFileDeleteTree(priv->channelTargetDir);
......
...@@ -205,9 +205,8 @@ int qemuProcessRefreshDisks(virQEMUDriverPtr driver, ...@@ -205,9 +205,8 @@ int qemuProcessRefreshDisks(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob); qemuDomainAsyncJob asyncJob);
int qemuProcessStartPRDaemon(virDomainObjPtr vm, int qemuProcessStartManagedPRDaemon(virDomainObjPtr vm);
const virDomainDiskDef *disk);
void qemuProcessKillPRDaemon(virDomainObjPtr vm); void qemuProcessKillManagedPRDaemon(virDomainObjPtr vm);
#endif /* __QEMU_PROCESS_H__ */ #endif /* __QEMU_PROCESS_H__ */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册