前往小程序,Get更优阅读体验!
立即前往
发布
社区首页 >专栏 >定制虚拟机smbios信息

定制虚拟机smbios信息

作者头像
虚拟化云计算
发布2018-07-23 17:52:06
发布2018-07-23 17:52:06
2.4K00
代码可运行
举报
文章被收录于专栏:虚拟化云计算虚拟化云计算
运行总次数:0
代码可运行

在某些需要给机器做认证和加密的场景下,会需要读取机器的厂家和主板等信息,这些信息都存放在SMBIOS信息中。在虚拟化场景下可以定制虚拟机的SMBIOS信息。

SMBIOS是什么

SMBIOS(System Management BIOS)是由工业化组织DMTF提出的通过系统固件传递管理信息的标准。

详见https://www.dmtf.org/cn/standards/smbios

在SMBIOS标准中规定了若干的Type,每种Type都包含特定信息。例如:

BIOS Information (Type 0)

System Information (Type 1)

Baseboard (or Module) Information (Type 2)

System Enclosure or Chassis (Type 3)

Processor Information (Type 4)

Memory Controller Information (Type 5, Obsolete)

Memory Module Information (Type 6, Obsolete)

OEM Strings (Type 11)

在libvirt中可以定制Guest的smbios信息,首先填写smbios的mode,然后定制sysinfo。

指定smbios mode

在<os>中指定<smbios mode='sysinfo'/>:

代码语言:javascript
代码运行次数:0
复制
<os>
  ......
  <smbios mode='sysinfo'/>
</os>

这里的mode有三种取值:

"emulate": 让qemu自动产生

"host" :从宿主机上拷贝SMBIOS的 Block 0和Block 1(UUID除外)

"sysinfo" :(使用sysinfo单元中指定的值)

填写sysinfo单元

代码语言:javascript
代码运行次数:0
复制
<sysinfo type='smbios'>
  <bios>
      <entry name='vendor'>myvendor</entry>
    </bios>
    <system>
      <entry name='manufacturer'>manufacturer01</entry>
      <entry name='product'>test</entry>
      <entry name='version'>0.1</entry>
    </system>
    <baseBoard>
      <entry name='manufacturer'>manufacturer02</entry>
      <entry name='product'>0101010101</entry>
      <entry name='version'>0202020202</entry>
      <entry name='serial'>abcdefgh</entry>
    </baseBoard>
  <chassis>
    <entry name='manufacturer'>Dell Inc.</entry>
    <entry name='version'>2.12</entry>
    <entry name='serial'>65X0XF2</entry>
    <entry name='asset'>40000101</entry>
    <entry name='sku'>Type3Sku1</entry>
  </chassis>
  <oemStrings>
    <entry>myappname:some arbitrary data</entry>
    <entry>otherappname:more arbitrary data</entry>
  </oemStrings>
</sysinfo>

其中:

bios:对应SMBIOS标准中的 BIOS Information (Type 0)

system:对应SMBIOS标准中的 System Information (Type 1)

baseBoard:对应SMBIOS标准中的 Baseboard (or Module) Information (Type 2)

chassis:对应SMBIOS标准中的 System Enclosure or Chassis (Type 3)

oemStrings:对应SMBIOS标准中的 OEM Strings (Type 11)

(chassis和oemStrings从libvirt4.1.0开始支持)

在虚拟机内部查看

# dmidecode

可以看到在虚拟机中查询到的每一个type和我们在libvirt的domain中定制的完全相同。

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2018-05-30,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 虚拟化云计算 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档