mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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 "lxc_container.h"
|
||||||
#include "virnodesuspend.h"
|
#include "virnodesuspend.h"
|
||||||
#include "virstring.h"
|
#include "virstring.h"
|
||||||
|
#include "virfile.h"
|
||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_LXC
|
#define VIR_FROM_THIS VIR_FROM_LXC
|
||||||
|
|
||||||
@ -66,6 +67,7 @@ virCapsPtr virLXCDriverCapsInit(virLXCDriverPtr driver)
|
|||||||
virCapsPtr caps;
|
virCapsPtr caps;
|
||||||
virCapsGuestPtr guest;
|
virCapsGuestPtr guest;
|
||||||
virArch altArch;
|
virArch altArch;
|
||||||
|
char *lxc_path = NULL;
|
||||||
|
|
||||||
if ((caps = virCapabilitiesNew(virArchFromHost(),
|
if ((caps = virCapabilitiesNew(virArchFromHost(),
|
||||||
0, 0)) == NULL)
|
0, 0)) == NULL)
|
||||||
@ -89,10 +91,15 @@ virCapsPtr virLXCDriverCapsInit(virLXCDriverPtr driver)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(lxc_path = virFileFindResource("libvirt_lxc",
|
||||||
|
"src",
|
||||||
|
LIBEXECDIR)))
|
||||||
|
goto error;
|
||||||
|
|
||||||
if ((guest = virCapabilitiesAddGuest(caps,
|
if ((guest = virCapabilitiesAddGuest(caps,
|
||||||
"exe",
|
"exe",
|
||||||
caps->host.arch,
|
caps->host.arch,
|
||||||
LIBEXECDIR "/libvirt_lxc",
|
lxc_path,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
NULL)) == NULL)
|
NULL)) == NULL)
|
||||||
@ -111,7 +118,7 @@ virCapsPtr virLXCDriverCapsInit(virLXCDriverPtr driver)
|
|||||||
if ((guest = virCapabilitiesAddGuest(caps,
|
if ((guest = virCapabilitiesAddGuest(caps,
|
||||||
"exe",
|
"exe",
|
||||||
altArch,
|
altArch,
|
||||||
LIBEXECDIR "/libvirt_lxc",
|
lxc_path,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
NULL)) == NULL)
|
NULL)) == NULL)
|
||||||
@ -126,6 +133,8 @@ virCapsPtr virLXCDriverCapsInit(virLXCDriverPtr driver)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VIR_FREE(lxc_path);
|
||||||
|
|
||||||
if (driver) {
|
if (driver) {
|
||||||
/* Security driver data */
|
/* Security driver data */
|
||||||
const char *doi, *model, *label, *type;
|
const char *doi, *model, *label, *type;
|
||||||
@ -158,6 +167,7 @@ virCapsPtr virLXCDriverCapsInit(virLXCDriverPtr driver)
|
|||||||
return caps;
|
return caps;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
VIR_FREE(lxc_path);
|
||||||
virObjectUnref(caps);
|
virObjectUnref(caps);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user