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