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

Fix Provisioning of disconnected VolumeTemplate #173

Merged
merged 1 commit into from
Dec 13, 2017

Conversation

aufi
Copy link
Member

@aufi aufi commented Dec 5, 2017

Since provisioning from OpenStack Volumes was enabled, situation when original
Volume template can be disconnected from EMS by refresher can happen and it
doesn't look to be possible fix it on OpenStack side.

This PR allows EMS lookup fallback to options[:src_ems_id] when getting EMS
from source object fails.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1518381

Links

Steps for Testing/QA

Vm provision process from OpenStack Volume should pass even refresh of given provider runs faster than provisioning process.

rescue NoMethodError => ex
_log.debug("Unable to find Provison Source ExtmanagementSystem: #{ex}")
_log.debug("Trying use attribute src_ems_id=#{options[:src_ems_id].try(:first)} instead.")
vm_model_class.find_by(:ems_id => options[:src_ems_id].try(:first), :ems_ref => ems_ref)
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we can just use this call right away? Or is there a case when options[:src_ems_id] is nil?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not aware of such case, but I'd prefer keep original method using source to feel safe..

Copy link
Contributor

Choose a reason for hiding this comment

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

right, it bugs me a bit that this will basically fail everytime for volume_template, so maybe we should not use it?

@@ -1,4 +1,12 @@
module ManageIQ::Providers::Openstack::CloudManager::Provision::Cloning
def find_destination_in_vmdb(ems_ref)
vm_model_class.find_by(:ems_id => source.ext_management_system.id, :ems_ref => ems_ref)
Copy link
Contributor

Choose a reason for hiding this comment

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

if we will keep this ,maybe we can just call super

Copy link
Member Author

Choose a reason for hiding this comment

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

Make sense, thanks, will update it.

@Ladas
Copy link
Contributor

Ladas commented Dec 5, 2017

@aufi also, can you add todo, that this will not be needed when we do soft delete of VmOrTemplate without removing the vm_or_template foreign_key?

Since provisioning from OpenStack Volumes was enabled, situation when original
Volume template can be disconnected from EMS by refresher can happen and it
doesn't look to be possible fix it on OpenStack side.

This PR allows EMS lookup fallback to options[:src_ems_id] when getting EMS
from source object fails.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1518381
@aufi aufi force-pushed the fix_disconnected_volume_template branch from 741f9bf to 1a8b0aa Compare December 5, 2017 15:58
@miq-bot
Copy link
Member

miq-bot commented Dec 5, 2017

Checked commit aufi@1a8b0aa with ruby 2.3.3, rubocop 0.47.1, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 0 offenses detected
Everything looks fine. 🍪

Copy link
Contributor

@Ladas Ladas left a comment

Choose a reason for hiding this comment

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

Looks great. 👍

@aufi
Copy link
Member Author

aufi commented Dec 6, 2017

Tested locally and should be working (kind of proof: checked timestamps - VolumeTemplate was disconnected from EMS approx 20 seconds before last update of provisioned Vm and provision succeed).

@miq-bot rm_label wip

@miq-bot miq-bot changed the title [WIP] Fix Provisioning of disconnected VolumeTemplate Fix Provisioning of disconnected VolumeTemplate Dec 6, 2017
@miq-bot miq-bot removed the wip label Dec 6, 2017
@miq-bot miq-bot removed the wip label Dec 6, 2017
@aufi aufi removed the wip label Dec 6, 2017
@aufi aufi requested a review from mansam December 12, 2017 11:18
Copy link
Contributor

@mansam mansam left a comment

Choose a reason for hiding this comment

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

Looks good!

@mansam mansam merged commit e14333a into ManageIQ:master Dec 13, 2017
@aufi aufi added this to the Sprint 76 Ending Jan 1, 2018 milestone Dec 14, 2017
simaishi pushed a commit that referenced this pull request Dec 14, 2017
Fix Provisioning of disconnected VolumeTemplate
(cherry picked from commit e14333a)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1526062
@simaishi
Copy link
Contributor

Gaprindashvili backport details:

$ git log -1
commit 4bdd3c5fc4de6e9c87be41ff25ffe3dc9fdcf3be
Author: Samuel Lucidi <[email protected]>
Date:   Wed Dec 13 13:44:07 2017 -0500

    Merge pull request #173 from aufi/fix_disconnected_volume_template
    
    Fix Provisioning of disconnected VolumeTemplate
    (cherry picked from commit e14333a5777fdaccd9c93988dae1ef8a62168e53)
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1526062

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.

5 participants