-
Notifications
You must be signed in to change notification settings - Fork 900
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
memory parameter should be false if missing #3707
Conversation
@gmcculloug @Fryguy |
@@ -393,7 +393,7 @@ def self.task_arguments(options) | |||
when "remove_snapshot", "revert_to_snapshot" then | |||
[options[:snap_selected]] | |||
when "create_snapshot" then | |||
[options[:name], options[:description], options[:memory]] | |||
[options[:name], options[:description], options.fetch(:memory, false)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this issue is specific to VMware, why is the solution to modify base class VmOrTemplate
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only problem with this (which I guess is my problem with .fetch
in general), is that it only handles keys that don't exist.
{}.fetch(:a, false)
# => false
{:a => nil}.fetch(:a, false)
# => nil
To be safe, this might be better written as !!options[:memory]
if all you want is a literal boolean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on further discussions with Greg M we agreed to expose the memory parameter via the service model apis for vmware. This way the method api will enforce that the memory value can only be true|false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach fixes the original issue and adds support for passing the memory flag from automate. Also we want to move the snapshot methods out of the base automate service model and into the VMware sub-classed model where it belongs since these methods are currently not supported on other providers.
Sets the default memory value to be false unless specified by the automate method. Added specs to validate the snapshot parameters https://bugzilla.redhat.com/show_bug.cgi?id=1247664
e87970c
to
5df0c20
Compare
Checked commits mkanoor@978c112 .. mkanoor@6dac115 with rubocop 0.32.1 and haml-lint 0.13.0 lib/miq_automation_engine/service_models/miq_ae_service_manageiq-providers-vmware-infra_manager-vm.rb
|
@gmcculloug @Fryguy @chessbyte |
@Fryguy @chessbyte @gmcculloug |
memory parameter should be false if missing
The snapshot code in automate was moved from VmOrTemplate to VMware specific class by PR ManageIQ#3707 when VMware was the only class that supports snapshot. But snapshot support has been added to RHEVM and Openstack as of version Euwe. The snapshot code in automate should be available at Vm level. https://bugzilla.redhat.com/show_bug.cgi?id=1395175
The VMWare snapshot API takes 3 parameters name, description and memory.
memory cannot be nil if not specified, it should be false for the VIM api to work properly.
The Automate Service model now exposes the memory parameter and defaults it to false if not
specified.
https://bugzilla.redhat.com/show_bug.cgi?id=1247664