提交 52888813 编写于 作者: M Matthias Bolte

esx: Support SMBIOS host mode

上级 45dc5a14
...@@ -74,6 +74,7 @@ def->os ...@@ -74,6 +74,7 @@ def->os
->loader ->loader
->bootloader ->bootloader
->bootloaderArgs ->bootloaderArgs
->smbios_mode <=> smbios.reflecthost = "<value>" # <value> == true means SMBIOS_HOST, otherwise it's SMBIOS_EMULATE, defaults to "false"
...@@ -880,6 +881,7 @@ esxVMX_ParseConfig(esxVMX_Context *ctx, virCapsPtr caps, const char *vmx, ...@@ -880,6 +881,7 @@ esxVMX_ParseConfig(esxVMX_Context *ctx, virCapsPtr caps, const char *vmx,
long long numvcpus = 0; long long numvcpus = 0;
char *sched_cpu_affinity = NULL; char *sched_cpu_affinity = NULL;
char *guestOS = NULL; char *guestOS = NULL;
bool smbios_reflecthost = false;
int controller; int controller;
int bus; int bus;
int port; int port;
...@@ -1195,6 +1197,16 @@ esxVMX_ParseConfig(esxVMX_Context *ctx, virCapsPtr caps, const char *vmx, ...@@ -1195,6 +1197,16 @@ esxVMX_ParseConfig(esxVMX_Context *ctx, virCapsPtr caps, const char *vmx,
goto cleanup; goto cleanup;
} }
/* vmx:smbios.reflecthost -> def:os.smbios_mode */
if (esxUtil_GetConfigBoolean(conf, "smbios.reflecthost",
&smbios_reflecthost, false, true) < 0) {
goto cleanup;
}
if (smbios_reflecthost) {
def->os.smbios_mode = VIR_DOMAIN_SMBIOS_HOST;
}
/* def:features */ /* def:features */
/* FIXME */ /* FIXME */
...@@ -2552,7 +2564,7 @@ esxVMX_FormatConfig(esxVMX_Context *ctx, virCapsPtr caps, virDomainDefPtr def, ...@@ -2552,7 +2564,7 @@ esxVMX_FormatConfig(esxVMX_Context *ctx, virCapsPtr caps, virDomainDefPtr def,
goto cleanup; goto cleanup;
} }
/* def:arch -> vmx:guestOS */ /* def:os.arch -> vmx:guestOS */
if (def->os.arch == NULL || STRCASEEQ(def->os.arch, "i686")) { if (def->os.arch == NULL || STRCASEEQ(def->os.arch, "i686")) {
virBufferAddLit(&buffer, "guestOS = \"other\"\n"); virBufferAddLit(&buffer, "guestOS = \"other\"\n");
} else if (STRCASEEQ(def->os.arch, "x86_64")) { } else if (STRCASEEQ(def->os.arch, "x86_64")) {
...@@ -2564,6 +2576,19 @@ esxVMX_FormatConfig(esxVMX_Context *ctx, virCapsPtr caps, virDomainDefPtr def, ...@@ -2564,6 +2576,19 @@ esxVMX_FormatConfig(esxVMX_Context *ctx, virCapsPtr caps, virDomainDefPtr def,
goto cleanup; goto cleanup;
} }
/* def:os.smbios_mode -> vmx:smbios.reflecthost */
if (def->os.smbios_mode == VIR_DOMAIN_SMBIOS_NONE ||
def->os.smbios_mode == VIR_DOMAIN_SMBIOS_EMULATE) {
/* nothing */
} else if (def->os.smbios_mode == VIR_DOMAIN_SMBIOS_HOST) {
virBufferAddLit(&buffer, "smbios.reflecthost = \"true\"\n");
} else {
ESX_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
_("Unsupported SMBIOS mode '%s'"),
virDomainSmbiosModeTypeToString(def->os.smbios_mode));
goto cleanup;
}
/* def:uuid -> vmx:uuid.action, vmx:uuid.bios */ /* def:uuid -> vmx:uuid.action, vmx:uuid.bios */
if (memcmp(def->uuid, zero, VIR_UUID_BUFLEN) == 0) { if (memcmp(def->uuid, zero, VIR_UUID_BUFLEN) == 0) {
virBufferAddLit(&buffer, "uuid.action = \"create\"\n"); virBufferAddLit(&buffer, "uuid.action = \"create\"\n");
......
config.version = "8"
virtualHW.version = "4"
smbios.reflecthost = "true"
<domain type='vmware'>
<uuid>00000000-0000-0000-0000-000000000000</uuid>
<memory>32768</memory>
<currentMemory>32768</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='i686'>hvm</type>
<smbios mode='host'/>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
</devices>
</domain>
...@@ -285,6 +285,8 @@ mymain(int argc, char **argv) ...@@ -285,6 +285,8 @@ mymain(int argc, char **argv)
DO_TEST("annotation", "annotation", esxVI_ProductVersion_ESX35); DO_TEST("annotation", "annotation", esxVI_ProductVersion_ESX35);
DO_TEST("smbios", "smbios", esxVI_ProductVersion_ESX35);
virCapabilitiesFree(caps); virCapabilitiesFree(caps);
return result == 0 ? EXIT_SUCCESS : EXIT_FAILURE; return result == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
......
.encoding = "UTF-8"
config.version = "8"
virtualHW.version = "4"
guestOS = "other"
smbios.reflecthost = "true"
uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15"
displayName = "smbios"
memsize = "4"
numvcpus = "1"
floppy0.present = "false"
floppy1.present = "false"
<domain type='vmware'>
<name>smbios</name>
<uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid>
<memory>4096</memory>
<os>
<type>hvm</type>
<smbios mode='host'/>
</os>
</domain>
...@@ -278,6 +278,8 @@ mymain(int argc, char **argv) ...@@ -278,6 +278,8 @@ mymain(int argc, char **argv)
DO_TEST("annotation", "annotation", esxVI_ProductVersion_ESX35); DO_TEST("annotation", "annotation", esxVI_ProductVersion_ESX35);
DO_TEST("smbios", "smbios", esxVI_ProductVersion_ESX35);
virCapabilitiesFree(caps); virCapabilitiesFree(caps);
return result == 0 ? EXIT_SUCCESS : EXIT_FAILURE; return result == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册