提交 89de838f 编写于 作者: N Nehal J Wani 提交者: Daniel P. Berrange

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: NDaniel P. Berrange <berrange@redhat.com>
上级 7d84ca46
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册