bool
libxlGetAutoballoonConf(libxlDriverPrivatePtr driver)
{
- const libxl_version_info *info;
regex_t regex;
int ret;
- info = libxl_get_version_info(driver->ctx);
- if (!info)
- return true; /* default to on */
-
ret = regcomp(®ex,
"(^| )dom0_mem=((|min:|max:)[0-9]+[bBkKmMgG]?,?)+($| )",
REG_NOSUB | REG_EXTENDED);
if (ret)
return true;
- ret = regexec(®ex, info->commandline, 0, NULL, 0);
+ ret = regexec(®ex, driver->verInfo->commandline, 0, NULL, 0);
regfree(®ex);
return ret == REG_NOMATCH;
}
libxlDoNodeGetInfo(libxlDriverPrivatePtr driver, virNodeInfoPtr info)
{
libxl_physinfo phy_info;
- const libxl_version_info* ver_info;
virArch hostarch = virArchFromHost();
if (libxl_get_physinfo(driver->ctx, &phy_info)) {
return -1;
}
- if ((ver_info = libxl_get_version_info(driver->ctx)) == NULL) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("libxl_get_version_info failed"));
- return -1;
- }
-
if (virStrcpyStatic(info->model, virArchToString(hostarch)) == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("machine type %s too big for destination"),
return -1;
}
- info->memory = phy_info.total_pages * (ver_info->pagesize / 1024);
+ info->memory = phy_info.total_pages * (driver->verInfo->pagesize / 1024);
info->cpus = phy_info.nr_cpus;
info->nodes = phy_info.nr_nodes;
info->cores = phy_info.cores_per_socket;
_("failed to get version information from libxenlight"));
goto error;
}
+ libxl_driver->verInfo = ver_info;
libxl_driver->version = (ver_info->xen_version_major * 1000000) +
- (ver_info->xen_version_minor * 1000);
+ (ver_info->xen_version_minor * 1000);
if ((libxl_driver->caps =
libxlMakeCapabilities(libxl_driver->ctx)) == NULL) {
unsigned int flags)
{
libxlDriverPrivatePtr driver = conn->privateData;
- const libxl_version_info *ver_info;
virDomainDefPtr def = NULL;
virConfPtr conf = NULL;
char *xml = NULL;
goto cleanup;
}
- if ((ver_info = libxl_get_version_info(driver->ctx)) == NULL) {
- VIR_ERROR(_("cannot get version information from libxenlight"));
- goto cleanup;
- }
-
if (!(conf = virConfReadMem(nativeConfig, strlen(nativeConfig), 0)))
goto cleanup;
- if (!(def = xenParseXM(conf, ver_info->xen_version_major, driver->caps))) {
+ if (!(def = xenParseXM(conf,
+ driver->verInfo->xen_version_major,
+ driver->caps))) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("parsing xm config failed"));
goto cleanup;
}
unsigned int flags)
{
libxlDriverPrivatePtr driver = conn->privateData;
- const libxl_version_info *ver_info;
virDomainDefPtr def = NULL;
virConfPtr conf = NULL;
int len = MAX_CONFIG_SIZE;
goto cleanup;
}
- if ((ver_info = libxl_get_version_info(driver->ctx)) == NULL) {
- VIR_ERROR(_("cannot get version information from libxenlight"));
- goto cleanup;
- }
-
if (!(def = virDomainDefParseString(domainXml,
driver->caps, driver->xmlopt,
1 << VIR_DOMAIN_VIRT_XEN, 0)))
goto cleanup;
- if (!(conf = xenFormatXM(conn, def, ver_info->xen_version_major)))
+ if (!(conf = xenFormatXM(conn, def, driver->verInfo->xen_version_major)))
goto cleanup;
if (VIR_ALLOC_N(ret, len) < 0)
libxlNodeGetFreeMemory(virConnectPtr conn)
{
libxl_physinfo phy_info;
- const libxl_version_info* ver_info;
libxlDriverPrivatePtr driver = conn->privateData;
if (virNodeGetFreeMemoryEnsureACL(conn) < 0)
return 0;
}
- if ((ver_info = libxl_get_version_info(driver->ctx)) == NULL) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("libxl_get_version_info failed"));
- return 0;
- }
-
- return phy_info.free_pages * ver_info->pagesize;
+ return phy_info.free_pages * driver->verInfo->pagesize;
}
static int