mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
bhyve: detect 32 SATA devices per controller support
Introduce a BHYVE_CAP_AHCI32SLOT capability that shows if 32 devices per SATA controller are supported, and a bhyveProbeCapsAHCI32Slot function that probes it.
This commit is contained in:
parent
b66bf0730a
commit
20a7737d35
@ -168,19 +168,13 @@ virBhyveProbeGrubCaps(virBhyveGrubCapsFlags *caps)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
virBhyveProbeCaps(unsigned int *caps)
|
bhyveProbeCapsRTC_UTC(unsigned int *caps, char *binary)
|
||||||
{
|
{
|
||||||
char *binary, *help;
|
char *help;
|
||||||
virCommandPtr cmd = NULL;
|
virCommandPtr cmd = NULL;
|
||||||
int ret = 0, exit;
|
int ret = 0, exit;
|
||||||
|
|
||||||
binary = virFindFileInPath("bhyve");
|
|
||||||
if (binary == NULL)
|
|
||||||
goto out;
|
|
||||||
if (!virFileIsExecutable(binary))
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
cmd = virCommandNew(binary);
|
cmd = virCommandNew(binary);
|
||||||
virCommandAddArg(cmd, "-h");
|
virCommandAddArg(cmd, "-h");
|
||||||
virCommandSetErrorBuffer(cmd, &help);
|
virCommandSetErrorBuffer(cmd, &help);
|
||||||
@ -195,6 +189,53 @@ virBhyveProbeCaps(unsigned int *caps)
|
|||||||
out:
|
out:
|
||||||
VIR_FREE(help);
|
VIR_FREE(help);
|
||||||
virCommandFree(cmd);
|
virCommandFree(cmd);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
bhyveProbeCapsAHCI32Slot(unsigned int *caps, char *binary)
|
||||||
|
{
|
||||||
|
char *error;
|
||||||
|
virCommandPtr cmd = NULL;
|
||||||
|
int ret = 0, exit;
|
||||||
|
|
||||||
|
cmd = virCommandNew(binary);
|
||||||
|
virCommandAddArgList(cmd, "-s", "0,ahci", NULL);
|
||||||
|
virCommandSetErrorBuffer(cmd, &error);
|
||||||
|
if (virCommandRun(cmd, &exit) < 0) {
|
||||||
|
ret = -1;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strstr(error, "pci slot 0:0: unknown device \"ahci\"") == NULL)
|
||||||
|
*caps |= BHYVE_CAP_AHCI32SLOT;
|
||||||
|
|
||||||
|
out:
|
||||||
|
VIR_FREE(error);
|
||||||
|
virCommandFree(cmd);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
virBhyveProbeCaps(unsigned int *caps)
|
||||||
|
{
|
||||||
|
char *binary;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
binary = virFindFileInPath("bhyve");
|
||||||
|
if (binary == NULL)
|
||||||
|
goto out;
|
||||||
|
if (!virFileIsExecutable(binary))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
if ((ret = bhyveProbeCapsRTC_UTC(caps, binary)))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
if ((ret = bhyveProbeCapsAHCI32Slot(caps, binary)))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
out:
|
||||||
VIR_FREE(binary);
|
VIR_FREE(binary);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,8 @@ typedef enum {
|
|||||||
} virBhyveGrubCapsFlags;
|
} virBhyveGrubCapsFlags;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
BHYVE_CAP_RTC_UTC = 1,
|
BHYVE_CAP_RTC_UTC = 1 << 0,
|
||||||
|
BHYVE_CAP_AHCI32SLOT = 1 << 1,
|
||||||
} virBhyveCapsFlags;
|
} virBhyveCapsFlags;
|
||||||
|
|
||||||
int virBhyveProbeGrubCaps(virBhyveGrubCapsFlags *caps);
|
int virBhyveProbeGrubCaps(virBhyveGrubCapsFlags *caps);
|
||||||
|
Loading…
Reference in New Issue
Block a user