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

Support the retirement of VM provisioned by OVF service template #684

Merged
merged 1 commit into from
Jan 11, 2021

Conversation

lfu
Copy link
Member

@lfu lfu commented Jan 7, 2021

Tag the VM provisioned by OVF service template to enable the retirement in the future.

https://github.ibm.com/IBMPrivateCloud/CP4MCM/issues/16312

cc @tinaafitz

@agrare
Copy link
Member

agrare commented Jan 7, 2021

@lfu I'm not very familiar with this type of tagging so I'd like @tinaafitz to approve, can you point me to where this is done for standard vm provisioning?

@agrare agrare requested a review from tinaafitz January 7, 2021 17:41
@agrare agrare self-assigned this Jan 7, 2021
@agrare agrare added the bug label Jan 7, 2021
@tinaafitz
Copy link
Member

Hi @agrare,

The out-of-the-box behavior for VM retirement is to only remove VM's from the provider if:

  1. They're provisioned by us, or
  2. They're tagged with lifecycle retire_full

Here's a code snippet from the remove_from_provider Automate code:
remove_from_disk if @vm.miq_provision || @vm.tagged_with?(category, tag)

https://github.com/ManageIQ/manageiq-content/pull/684/files#diff-29237c366b070571a98c87b6d428eb43e568244e2db028b35b82bd440df650e4L39

Any VM's that do not meet the above criteria will be powered off and marked as retired. There's a built policy that prevents a retired VM from starting, or powers it off if it's powered on. (I don't remember the exact policy details.)

The VM's in the OVF Service were not getting removed from the provider because they were provisioned by a generic Service, so they don't have an miq_provision object. We don't normally automatically tag VMs with the lifecycle retire_full tag, but it seems like a reasonable way forward as long as we add a notification that we tagged the VM because we knew it was created by the OVF Service and we consider it "provisioned by us".

Let me know if you have any questions or would like to discuss it further.

Copy link
Member

@tinaafitz tinaafitz left a comment

Choose a reason for hiding this comment

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

Hi @agrare,

The out-of-the-box behavior for VM retirement is to only remove VM's from the provider if:

  1. They're provisioned by us, or
  2. They're tagged with lifecycle retire_full

Here's a code snippet from the remove_from_provider Automate code:
remove_from_disk if @vm.miq_provision || @vm.tagged_with?(category, tag)

https://github.com/ManageIQ/manageiq-content/pull/684/files#diff-29237c366b070571a98c87b6d428eb43e568244e2db028b35b82bd440df650e4L39

Any VM's that do not meet the above criteria will be powered off and marked as retired. There's a built policy that prevents a retired VM from starting, or powers it off if it's powered on. (I don't remember the exact policy details.)

The VM's in the OVF Service were not getting removed from the provider because they were provisioned by a generic Service, so they don't have an miq_provision object. We don't normally automatically tag VMs with the lifecycle retire_full tag, but it seems like a reasonable way forward as long as we add a notification that we tagged the VM because we knew it was created by the OVF Service and we consider it "provisioned by us".

I saw that Lucy is generating an AuditEvent. It might help to add a notification that the lifecycle tag was added.

Let me know if you have any questions or would like to discuss it further.

@lfu
Copy link
Member Author

lfu commented Jan 11, 2021

@tinaafitz Thanks for the explanation.

AuditEvent would create a record in audit_events table and add a log message.
Notification would create a record in notifications table.

I don't think we'll need both of them. Do you prefer Notification over AuditEvent?

@tinaafitz
Copy link
Member

Hi @lfu,

I agree we don't need both notifications.

I prefer Notification over AuditEvent because we generate notifications for significant VM lifecycle event/actions/changes and this is significant.

Tag the VM provisioned by OVF service template to enable the retirement in the future.

https://github.ibm.com/IBMPrivateCloud/CP4MCM/issues/16312
@miq-bot
Copy link
Member

miq-bot commented Jan 11, 2021

Checked commit lfu@6d04930 with ruby 2.6.3, rubocop 0.82.0, haml-lint 0.35.0, and yamllint
2 files checked, 0 offenses detected
Everything looks fine. 👍

@agrare agrare merged commit 66ee8d0 into ManageIQ:master Jan 11, 2021
simaishi pushed a commit that referenced this pull request Jan 14, 2021
Support the retirement of VM provisioned by OVF service template

(cherry picked from commit 66ee8d0)
@simaishi
Copy link
Contributor

Kasparov backport details:

$ git log -1
commit eb218a96aad18694d83a004625da9f7aa44382e6
Author: Adam Grare <agrare@redhat.com>
Date:   Mon Jan 11 14:10:03 2021 -0500

    Merge pull request #684 from lfu/retire_ovf_vm_ibm_16312

    Support the retirement of VM provisioned by OVF service template

    (cherry picked from commit 66ee8d0768839a29e9c1afe5e86141b977c2adcb)

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.

None yet

6 participants