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

vcsim: Gen enc key w default provider on createvm #3552

Merged
merged 1 commit into from
Sep 18, 2024

Conversation

akutz
Copy link
Member

@akutz akutz commented Sep 18, 2024

Description

This patch adds support to vcsim for generating encryption keys using the default provider (if one exists) for new VMs that specify they are to be encrypted, but do not specify a key ID or provider ID.

Closes: NA

Type of change

Please mark options that are relevant:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Build related change

How Has This Been Tested?

$ go test -v -count 1 -run 'TestCreateVmWithDefaultKeyProvider|TestCreateVmWithGeneratedKey|TestEncryptDecryptVM' ./simulator
=== RUN   TestEncryptDecryptVM
=== RUN   TestEncryptDecryptVM/encrypt
=== RUN   TestEncryptDecryptVM/encrypt_w_default_key_provider
=== RUN   TestEncryptDecryptVM/encrypt_w_generated_key
=== RUN   TestEncryptDecryptVM/encrypt_w_already_encrypted
=== RUN   TestEncryptDecryptVM/encrypt_w_powered_on
=== RUN   TestEncryptDecryptVM/encrypt_w_snapshots
=== RUN   TestEncryptDecryptVM/decrypt
=== RUN   TestEncryptDecryptVM/decrypt_w_not_encrypted
=== RUN   TestEncryptDecryptVM/decrypt_w_powered_on
=== RUN   TestEncryptDecryptVM/decrypt_w_snapshots
=== RUN   TestEncryptDecryptVM/deep_recrypt
=== RUN   TestEncryptDecryptVM/deep_recrypt_w_default_key_provider
=== RUN   TestEncryptDecryptVM/deep_recrypt_w_generated_key
=== RUN   TestEncryptDecryptVM/deep_recrypt_w_same_provider_id
=== RUN   TestEncryptDecryptVM/deep_recrypt_w_not_encrypted
=== RUN   TestEncryptDecryptVM/deep_recrypt_w_powered_on
=== RUN   TestEncryptDecryptVM/deep_recrypt_w_snapshots
=== RUN   TestEncryptDecryptVM/shallow_recrypt
=== RUN   TestEncryptDecryptVM/shallow_recrypt_w_default_key_provider
=== RUN   TestEncryptDecryptVM/shallow_recrypt_w_generated_key
=== RUN   TestEncryptDecryptVM/shallow_recrypt_w_same_provider_id
=== RUN   TestEncryptDecryptVM/shallow_recrypt_w_not_encrypted
=== RUN   TestEncryptDecryptVM/shallow_recrypt_w_single_snapshot_chain
=== RUN   TestEncryptDecryptVM/shallow_recrypt_w_snapshot_tree
2024/09/18 10:40:03 *types.FileAlreadyExists: /var/folders/j4/r0gh7dx10fv4j0jwdfb6hz980000gq/T/govcsim-DC0-LocalDS_0-1469873255/DC0_C0_RP0_VM0/DC0_C0_RP0_VM0-Snapshot1.vmsn
2024/09/18 10:40:03 *types.FileAlreadyExists: /var/folders/j4/r0gh7dx10fv4j0jwdfb6hz980000gq/T/govcsim-DC0-LocalDS_0-1469873255/DC0_C0_RP0_VM0/DC0_C0_RP0_VM0-Snapshot1.vmsn
2024/09/18 10:40:03 *types.FileAlreadyExists: /var/folders/j4/r0gh7dx10fv4j0jwdfb6hz980000gq/T/govcsim-DC0-LocalDS_0-1469873255/DC0_C0_RP0_VM0/DC0_C0_RP0_VM0-Snapshot2.vmsn
=== RUN   TestEncryptDecryptVM/noop
=== RUN   TestEncryptDecryptVM/register
--- PASS: TestEncryptDecryptVM (6.39s)
    --- PASS: TestEncryptDecryptVM/encrypt (0.22s)
    --- PASS: TestEncryptDecryptVM/encrypt_w_default_key_provider (0.21s)
    --- PASS: TestEncryptDecryptVM/encrypt_w_generated_key (0.24s)
    --- PASS: TestEncryptDecryptVM/encrypt_w_already_encrypted (0.24s)
    --- PASS: TestEncryptDecryptVM/encrypt_w_powered_on (0.24s)
    --- PASS: TestEncryptDecryptVM/encrypt_w_snapshots (0.24s)
    --- PASS: TestEncryptDecryptVM/decrypt (0.20s)
    --- PASS: TestEncryptDecryptVM/decrypt_w_not_encrypted (0.22s)
    --- PASS: TestEncryptDecryptVM/decrypt_w_powered_on (0.29s)
    --- PASS: TestEncryptDecryptVM/decrypt_w_snapshots (0.24s)
    --- PASS: TestEncryptDecryptVM/deep_recrypt (0.24s)
    --- PASS: TestEncryptDecryptVM/deep_recrypt_w_default_key_provider (0.22s)
    --- PASS: TestEncryptDecryptVM/deep_recrypt_w_generated_key (0.23s)
    --- PASS: TestEncryptDecryptVM/deep_recrypt_w_same_provider_id (0.20s)
    --- PASS: TestEncryptDecryptVM/deep_recrypt_w_not_encrypted (0.23s)
    --- PASS: TestEncryptDecryptVM/deep_recrypt_w_powered_on (0.21s)
    --- PASS: TestEncryptDecryptVM/deep_recrypt_w_snapshots (0.26s)
    --- PASS: TestEncryptDecryptVM/shallow_recrypt (0.32s)
    --- PASS: TestEncryptDecryptVM/shallow_recrypt_w_default_key_provider (0.26s)
    --- PASS: TestEncryptDecryptVM/shallow_recrypt_w_generated_key (0.20s)
    --- PASS: TestEncryptDecryptVM/shallow_recrypt_w_same_provider_id (0.27s)
    --- PASS: TestEncryptDecryptVM/shallow_recrypt_w_not_encrypted (0.25s)
    --- PASS: TestEncryptDecryptVM/shallow_recrypt_w_single_snapshot_chain (0.28s)
    --- PASS: TestEncryptDecryptVM/shallow_recrypt_w_snapshot_tree (0.36s)
    --- PASS: TestEncryptDecryptVM/noop (0.24s)
    --- PASS: TestEncryptDecryptVM/register (0.26s)
=== RUN   TestCreateVmWithDefaultKeyProvider
=== RUN   TestCreateVmWithDefaultKeyProvider/when_default_key_provider_exists
=== RUN   TestCreateVmWithDefaultKeyProvider/when_default_key_provider_does_not_exist
--- PASS: TestCreateVmWithDefaultKeyProvider (0.94s)
    --- PASS: TestCreateVmWithDefaultKeyProvider/when_default_key_provider_exists (0.45s)
    --- PASS: TestCreateVmWithDefaultKeyProvider/when_default_key_provider_does_not_exist (0.49s)
=== RUN   TestCreateVmWithGeneratedKey
--- PASS: TestCreateVmWithGeneratedKey (0.45s)
PASS
ok  	github.com/vmware/govmomi/simulator	8.196s

Checklist:

  • My code follows the CONTRIBUTION guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged

@akutz akutz force-pushed the feature/gen-enc-key-on-create-vm branch from 9974f2d to 8bf8475 Compare September 18, 2024 14:28
dougm
dougm previously approved these changes Sep 18, 2024
Copy link
Member

@dougm dougm left a comment

Choose a reason for hiding this comment

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

Nice, lgtm

@akutz akutz force-pushed the feature/gen-enc-key-on-create-vm branch 2 times, most recently from a2fbe7b to 697a9c7 Compare September 18, 2024 15:39
This patch adds support to vcsim for generating encryption keys
using the default provider (if one exists) for new VMs that
specify they are to be encrypted, but do not specify a key ID or
provider ID.
@akutz akutz force-pushed the feature/gen-enc-key-on-create-vm branch from 697a9c7 to cddbe1f Compare September 18, 2024 15:40
Copy link
Member

@dougm dougm left a comment

Choose a reason for hiding this comment

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

Thanks @akutz

@akutz akutz merged commit 219a6ba into vmware:main Sep 18, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants