Skip to content

Conversation

@rhjyoung
Copy link
Contributor

@rhjyoung rhjyoung commented Jan 8, 2026

Add Trusted Platform Module (TPM) support

Signed-off-by: Jerone Young jyoung@redhat.com

Signed-off-by: Jerone Young jyoung@redhat.com
There was an unneeded space in the conditional.

Signed-off-by: Jerone Young <jyoung@redhat.com>
Fix designation of ARM architecture and add ppc64le.

Signed-off-by: Jerone Young <jyoung@redhat.com
Add s390x support
 
Signed-off-by: Jerone Young <jyoung@redhat.com>
Copy link
Contributor

@ekohl ekohl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are just my first impressions. Haven't done actual testing on it.

#
VERSIONS = ['1.2', '2.0'].freeze

def initialize(attributes = {}, arch = "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd normally keep the options at the end and even consider the following

Suggested change
def initialize(attributes = {}, arch = "")
def initialize(arch, **attributes)

Copy link
Contributor Author

@rhjyoung rhjyoung Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can definitely move the order. But using **attributes breaks with the convention used in network.rb. Also Trying to change to ** attributes breaks the code.

rhjyoung and others added 13 commits January 12, 2026 05:39
Fix conditional & change argument order when creating new TPM object

Signed-off-by: Jerone Young <jyoung@redhat.com>
Fix argument initialization order and fix error calls

Signed-off-by: Jerone Young <jyoung@redhat.com>
Signed-off-by: Jerone Young <jyoung@redhat.com>
Signed-off-by: Jerone Young <jyoung@redhat.com>
Signed-off-by: Jerone Young <jyoung@redhat.com>
Signed-off-by: Jerone Young <jyoung@redhat.com>
Signed-off-by: Jerone Young <jyoung@redhat.com>

Co-authored-by: Ewoud Kohl van Wijngaarden <ewoud@kohlvanwijngaarden.nl>
Signed-off-by: Jerone Young <jyoung@redhat.com>
Signed-off-by: Jerone Young <jyoung@redhat.com>
Signed-off-by: Jerone Young <jyoung@redhat.com>
By default change ppc64 to tpm0. As tpmrm0 is to be used by spapr-tpm-proxy and not spapr in case of using passthrough option.

Signed-off-by: Jerone Young <jyoung@redhat.com>
Signed-off-by: Jerone Young <jyoung@redhat.com>
Signed-off-by: Jerone Young <jyoung@redhat.com>
@rhjyoung rhjyoung changed the title Add Trusted Computing Module (TPM) support Add Trusted Platform Module (TPM) support Jan 15, 2026
@rhjyoung
Copy link
Contributor Author

Created code for Foreman:
theforeman/foreman#10824

Copy link
Contributor

@ekohl ekohl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me. A quick test in tests/libvirt/models/compute/server_tests.rb tells me it works. I used this test:

test("with tpm set to true") do
  server = Fog::Libvirt::Compute::Server.new(
    {
      :tpm => true,
      :nics => [],
      :volumes => []
    }
  )
  xml = server.to_xml

  xml.include?('<tpm model="tpm-crb">') && xml.include?('<backend type="emulator" version="2.0"/>')
end

Then get the following XML:

<tpm model="tpm-crb">
  <backend type="emulator" version="2.0"/>
</tpm>

Is this what you'd expect?

@rhjyoung
Copy link
Contributor Author

Yeap for x86_64 that is the expected result.

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

Successfully merging this pull request may close these issues.

2 participants