mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
qemu: Label correct per-VM path when starting
Commit f1f68ca334
overused mdir_name()
event though it was not needed in the latest version, hence labelling
directory one level up in the tree and not the one it should.
If anyone with SElinux managed to try run a domain with guest agent set
up, it's highly possible that they will need to run 'restorecon -F
/var/lib/libvirt/qemu/channel/target' to fix what was done.
Reported-by: Luyao Huang <lhuang@redhat.com>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
bf2788218a
commit
f674dc6794
@ -46,7 +46,6 @@
|
|||||||
|
|
||||||
#include "cpu/cpu.h"
|
#include "cpu/cpu.h"
|
||||||
#include "datatypes.h"
|
#include "datatypes.h"
|
||||||
#include "dirname.h"
|
|
||||||
#include "virlog.h"
|
#include "virlog.h"
|
||||||
#include "virerror.h"
|
#include "virerror.h"
|
||||||
#include "viralloc.h"
|
#include "viralloc.h"
|
||||||
@ -4390,7 +4389,7 @@ int qemuProcessStart(virConnectPtr conn,
|
|||||||
unsigned int hostdev_flags = 0;
|
unsigned int hostdev_flags = 0;
|
||||||
size_t nnicindexes = 0;
|
size_t nnicindexes = 0;
|
||||||
int *nicindexes = NULL;
|
int *nicindexes = NULL;
|
||||||
char *tmppath = NULL, *tmpdirpath = NULL;
|
char *tmppath = NULL;
|
||||||
|
|
||||||
VIR_DEBUG("vm=%p name=%s id=%d asyncJob=%d migrateFrom=%s stdin_fd=%d "
|
VIR_DEBUG("vm=%p name=%s id=%d asyncJob=%d migrateFrom=%s stdin_fd=%d "
|
||||||
"stdin_path=%s snapshot=%p vmop=%d flags=0x%x",
|
"stdin_path=%s snapshot=%p vmop=%d flags=0x%x",
|
||||||
@ -4738,15 +4737,11 @@ int qemuProcessStart(virConnectPtr conn,
|
|||||||
if (virFileMakePath(tmppath) < 0)
|
if (virFileMakePath(tmppath) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(tmpdirpath = mdir_name(tmppath)))
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (virSecurityManagerDomainSetDirLabel(driver->securityManager,
|
if (virSecurityManagerDomainSetDirLabel(driver->securityManager,
|
||||||
vm->def, tmpdirpath) < 0)
|
vm->def, tmppath) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
VIR_FREE(tmppath);
|
VIR_FREE(tmppath);
|
||||||
VIR_FREE(tmpdirpath);
|
|
||||||
|
|
||||||
if (virAsprintf(&tmppath, "%s/domain-%s",
|
if (virAsprintf(&tmppath, "%s/domain-%s",
|
||||||
cfg->channelTargetDir, vm->def->name) < 0)
|
cfg->channelTargetDir, vm->def->name) < 0)
|
||||||
@ -4755,14 +4750,10 @@ int qemuProcessStart(virConnectPtr conn,
|
|||||||
if (virFileMakePath(tmppath) < 0)
|
if (virFileMakePath(tmppath) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(tmpdirpath = mdir_name(tmppath)))
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (virSecurityManagerDomainSetDirLabel(driver->securityManager,
|
if (virSecurityManagerDomainSetDirLabel(driver->securityManager,
|
||||||
vm->def, tmpdirpath) < 0)
|
vm->def, tmppath) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
VIR_FREE(tmpdirpath);
|
|
||||||
VIR_FREE(tmppath);
|
VIR_FREE(tmppath);
|
||||||
|
|
||||||
/* now that we know it is about to start call the hook if present */
|
/* now that we know it is about to start call the hook if present */
|
||||||
@ -5119,7 +5110,6 @@ int qemuProcessStart(virConnectPtr conn,
|
|||||||
* if we failed to initialize the now running VM. kill it off and
|
* if we failed to initialize the now running VM. kill it off and
|
||||||
* pretend we never started it */
|
* pretend we never started it */
|
||||||
VIR_FREE(tmppath);
|
VIR_FREE(tmppath);
|
||||||
VIR_FREE(tmpdirpath);
|
|
||||||
VIR_FREE(nodeset);
|
VIR_FREE(nodeset);
|
||||||
virCommandFree(cmd);
|
virCommandFree(cmd);
|
||||||
VIR_FORCE_CLOSE(logfile);
|
VIR_FORCE_CLOSE(logfile);
|
||||||
|
Loading…
Reference in New Issue
Block a user