mirror of https://gitee.com/openkylin/libvirt.git
qemu: Generate SMBIOS Chassis strings command line
This wires up the previously added Chassis strings XML schema to be able to generate comamnd line args for QEMU. This requires QEMU >= 2.1 release containing this patch: SMBIOS: Build aggregate smbios tables and entry point https://git.qemu.org/?p=qemu.git;a=commit;h=c97294ec1b9e36887e119589d456557d72ab37b5 Signed-off-by: Zhuang Yanying <ann.zhuangyanying@huawei.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
c8fec25692
commit
204916d85f
|
@ -5817,6 +5817,51 @@ qemuBuildSmbiosOEMStringsStr(virSysinfoOEMStringsDefPtr def)
|
|||
}
|
||||
|
||||
|
||||
static char *
|
||||
qemuBuildSmbiosChassisStr(virSysinfoChassisDefPtr def)
|
||||
{
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
|
||||
if (!def)
|
||||
return NULL;
|
||||
|
||||
virBufferAddLit(&buf, "type=3");
|
||||
|
||||
/* 3:Manufacturer */
|
||||
virBufferAddLit(&buf, ",manufacturer=");
|
||||
virQEMUBuildBufferEscapeComma(&buf, def->manufacturer);
|
||||
/* 3:Version */
|
||||
if (def->version) {
|
||||
virBufferAddLit(&buf, ",version=");
|
||||
virQEMUBuildBufferEscapeComma(&buf, def->version);
|
||||
}
|
||||
/* 3:Serial Number */
|
||||
if (def->serial) {
|
||||
virBufferAddLit(&buf, ",serial=");
|
||||
virQEMUBuildBufferEscapeComma(&buf, def->serial);
|
||||
}
|
||||
/* 3:Asset Tag */
|
||||
if (def->asset) {
|
||||
virBufferAddLit(&buf, ",asset=");
|
||||
virQEMUBuildBufferEscapeComma(&buf, def->asset);
|
||||
}
|
||||
/* 3:Sku */
|
||||
if (def->sku) {
|
||||
virBufferAddLit(&buf, ",sku=");
|
||||
virQEMUBuildBufferEscapeComma(&buf, def->sku);
|
||||
}
|
||||
|
||||
if (virBufferCheckError(&buf) < 0)
|
||||
goto error;
|
||||
|
||||
return virBufferContentAndReset(&buf);
|
||||
|
||||
error:
|
||||
virBufferFreeAndReset(&buf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuBuildSmbiosCommandLine(virCommandPtr cmd,
|
||||
virQEMUDriverPtr driver,
|
||||
|
@ -5888,6 +5933,12 @@ qemuBuildSmbiosCommandLine(virCommandPtr cmd,
|
|||
VIR_FREE(smbioscmd);
|
||||
}
|
||||
|
||||
smbioscmd = qemuBuildSmbiosChassisStr(source->chassis);
|
||||
if (smbioscmd != NULL) {
|
||||
virCommandAddArgList(cmd, "-smbios", smbioscmd, NULL);
|
||||
VIR_FREE(smbioscmd);
|
||||
}
|
||||
|
||||
if (source->oemStrings) {
|
||||
if (!(smbioscmd = qemuBuildSmbiosOEMStringsStr(source->oemStrings)))
|
||||
return -1;
|
||||
|
|
|
@ -17,6 +17,8 @@ serial=32dfcb37-5af1-552b-357c-be8c3aa38310,\
|
|||
uuid=c7a5fdbd-edaf-9455-926a-d65c16db1809,sku=1234567890,family=Red Hat' \
|
||||
-smbios 'type=2,manufacturer=Hewlett-Packard,product=0B4Ch,version=D,\
|
||||
serial=CZC1065993,asset=CZC1065993,location=Upside down' \
|
||||
-smbios 'type=3,manufacturer=Dell Inc.,version=2.12,serial=65X0XF2,\
|
||||
asset=40000101,sku=Type3Sku1' \
|
||||
-smbios 'type=11,value=Hello,value=World,value=This is,,\
|
||||
more tricky value=escaped' \
|
||||
-nographic \
|
||||
|
|
Loading…
Reference in New Issue