Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: add SMBIOS tags support #1051

Open
Tulux opened this issue Dec 4, 2023 · 1 comment
Open

Enhancement: add SMBIOS tags support #1051

Tulux opened this issue Dec 4, 2023 · 1 comment

Comments

@Tulux
Copy link

Tulux commented Dec 4, 2023

A quick and portable way to transmit information such as strings to guest is using SMBIOS tables.

Can be implemented in a simple way by using a list that would fill the OEM section:
smbios = ['string1', 'string2']
which would be converted to:

<sysinfo type="smbios">
  <oemStrings>
    <entry>string1</entry>
    <entry>string2</entry>
  </oemStrings>
</sysinfo>

Or by using a mix of dict/list:
smbios = {'system':{'manufacturer':'Fedora'}}
Which would be converted to:

<system>
  <entry name='manufacturer'>Fedora</entry>
</system>
@Tulux
Copy link
Author

Tulux commented Dec 4, 2023

Quick work-around to set OEM strings from list:

Terraform part:

  xml {
    xslt = templatefile("${path.module}/smbios.xsl.tftpl", {"oemstrings": ["hello", "world"]})
  }

XSLT/template smbios.xsl.tftpl part:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output omit-xml-declaration="yes" indent="yes"/>
  <xsl:template match="node()|@*">
      <xsl:copy>
         <xsl:apply-templates select="node()|@*"/>
      </xsl:copy>
   </xsl:template>

  <xsl:template match="/domain/os">
    <xsl:copy>
        <xsl:apply-templates select="node()|@*"/>
            <xsl:element name ="smbios">
                <xsl:attribute name="mode">sysinfo</xsl:attribute>
            </xsl:element>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="/domain">
    <xsl:copy>
        <xsl:apply-templates select="node()|@*"/>
            <xsl:element name ="sysinfo">
                <xsl:attribute name="type">smbios</xsl:attribute>
                <xsl:element name="oemStrings">
                    %{ for oemstring in oemstrings ~}
                    <xsl:element name="entry">${oemstring}</xsl:element>
                    %{ endfor ~}
                </xsl:element>
            </xsl:element>
    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant