qemu: Translate the volume type disk source before cgroup setting

The translation must be done before both of cgroup and security
setting, otherwise since the disk source is not translated yet,
it might be skipped on cgroup and security setting.
This commit is contained in:
Osier Yang 2013-06-18 16:36:42 +08:00 committed by John Ferlan
parent 985843586f
commit b6c162d3bb

View File

@ -3663,6 +3663,14 @@ int qemuProcessStart(virConnectPtr conn,
} }
hookData.nodemask = nodemask; hookData.nodemask = nodemask;
/* "volume" type disk's source must be translated before
* cgroup and security setting.
*/
for (i = 0; i < vm->def->ndisks; i++) {
if (qemuTranslateDiskSourcePool(conn, vm->def->disks[i]) < 0)
goto cleanup;
}
VIR_DEBUG("Setting up domain cgroup (if required)"); VIR_DEBUG("Setting up domain cgroup (if required)");
if (qemuSetupCgroup(driver, vm, nodemask) < 0) if (qemuSetupCgroup(driver, vm, nodemask) < 0)
goto cleanup; goto cleanup;
@ -3707,11 +3715,6 @@ int qemuProcessStart(virConnectPtr conn,
goto cleanup; goto cleanup;
} }
for (i = 0; i < vm->def->ndisks; i++) {
if (qemuTranslateDiskSourcePool(conn, vm->def->disks[i]) < 0)
goto cleanup;
}
VIR_DEBUG("Building emulator command line"); VIR_DEBUG("Building emulator command line");
if (!(cmd = qemuBuildCommandLine(conn, driver, vm->def, priv->monConfig, if (!(cmd = qemuBuildCommandLine(conn, driver, vm->def, priv->monConfig,
priv->monJSON, priv->qemuCaps, priv->monJSON, priv->qemuCaps,