mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
Use virFileFindResource to locate libvirt_lxc for capabilities
Instead of hardcoding LIBEXECDIR as the location of the libvirt_lxc binary set in the LXC driver capabilities, use virFileFindResource to optionally find it in the current build directory. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
7d84ca4649
commit
89de838f1b
@ -38,6 +38,7 @@
|
||||
#include "lxc_container.h"
|
||||
#include "virnodesuspend.h"
|
||||
#include "virstring.h"
|
||||
#include "virfile.h"
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_LXC
|
||||
|
||||
@ -66,6 +67,7 @@ virCapsPtr virLXCDriverCapsInit(virLXCDriverPtr driver)
|
||||
virCapsPtr caps;
|
||||
virCapsGuestPtr guest;
|
||||
virArch altArch;
|
||||
char *lxc_path = NULL;
|
||||
|
||||
if ((caps = virCapabilitiesNew(virArchFromHost(),
|
||||
0, 0)) == NULL)
|
||||
@ -89,10 +91,15 @@ virCapsPtr virLXCDriverCapsInit(virLXCDriverPtr driver)
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!(lxc_path = virFileFindResource("libvirt_lxc",
|
||||
"src",
|
||||
LIBEXECDIR)))
|
||||
goto error;
|
||||
|
||||
if ((guest = virCapabilitiesAddGuest(caps,
|
||||
"exe",
|
||||
caps->host.arch,
|
||||
LIBEXECDIR "/libvirt_lxc",
|
||||
lxc_path,
|
||||
NULL,
|
||||
0,
|
||||
NULL)) == NULL)
|
||||
@ -111,7 +118,7 @@ virCapsPtr virLXCDriverCapsInit(virLXCDriverPtr driver)
|
||||
if ((guest = virCapabilitiesAddGuest(caps,
|
||||
"exe",
|
||||
altArch,
|
||||
LIBEXECDIR "/libvirt_lxc",
|
||||
lxc_path,
|
||||
NULL,
|
||||
0,
|
||||
NULL)) == NULL)
|
||||
@ -126,6 +133,8 @@ virCapsPtr virLXCDriverCapsInit(virLXCDriverPtr driver)
|
||||
goto error;
|
||||
}
|
||||
|
||||
VIR_FREE(lxc_path);
|
||||
|
||||
if (driver) {
|
||||
/* Security driver data */
|
||||
const char *doi, *model, *label, *type;
|
||||
@ -158,6 +167,7 @@ virCapsPtr virLXCDriverCapsInit(virLXCDriverPtr driver)
|
||||
return caps;
|
||||
|
||||
error:
|
||||
VIR_FREE(lxc_path);
|
||||
virObjectUnref(caps);
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user