esx: Support SMBIOS host mode

This commit is contained in:
Matthias Bolte 2010-11-10 20:05:51 +01:00
parent 45dc5a142f
commit 5288881344
7 changed files with 69 additions and 1 deletions

View File

@ -74,6 +74,7 @@ def->os
->loader
->bootloader
->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,
long long numvcpus = 0;
char *sched_cpu_affinity = NULL;
char *guestOS = NULL;
bool smbios_reflecthost = false;
int controller;
int bus;
int port;
@ -1195,6 +1197,16 @@ esxVMX_ParseConfig(esxVMX_Context *ctx, virCapsPtr caps, const char *vmx,
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 */
/* FIXME */
@ -2552,7 +2564,7 @@ esxVMX_FormatConfig(esxVMX_Context *ctx, virCapsPtr caps, virDomainDefPtr def,
goto cleanup;
}
/* def:arch -> vmx:guestOS */
/* def:os.arch -> vmx:guestOS */
if (def->os.arch == NULL || STRCASEEQ(def->os.arch, "i686")) {
virBufferAddLit(&buffer, "guestOS = \"other\"\n");
} else if (STRCASEEQ(def->os.arch, "x86_64")) {
@ -2564,6 +2576,19 @@ esxVMX_FormatConfig(esxVMX_Context *ctx, virCapsPtr caps, virDomainDefPtr def,
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 */
if (memcmp(def->uuid, zero, VIR_UUID_BUFLEN) == 0) {
virBufferAddLit(&buffer, "uuid.action = \"create\"\n");

View File

@ -0,0 +1,3 @@
config.version = "8"
virtualHW.version = "4"
smbios.reflecthost = "true"

View File

@ -0,0 +1,16 @@
<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>

View File

@ -285,6 +285,8 @@ mymain(int argc, char **argv)
DO_TEST("annotation", "annotation", esxVI_ProductVersion_ESX35);
DO_TEST("smbios", "smbios", esxVI_ProductVersion_ESX35);
virCapabilitiesFree(caps);
return result == 0 ? EXIT_SUCCESS : EXIT_FAILURE;

View File

@ -0,0 +1,11 @@
.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"

View File

@ -0,0 +1,9 @@
<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>

View File

@ -278,6 +278,8 @@ mymain(int argc, char **argv)
DO_TEST("annotation", "annotation", esxVI_ProductVersion_ESX35);
DO_TEST("smbios", "smbios", esxVI_ProductVersion_ESX35);
virCapabilitiesFree(caps);
return result == 0 ? EXIT_SUCCESS : EXIT_FAILURE;