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

v2v: Extend 'VM Transform' dialog to select VMs by tag #200

Merged
merged 8 commits into from
Oct 30, 2017

Conversation

smelamud
Copy link
Contributor

@smelamud smelamud commented Oct 24, 2017

Added tag category and tag name fields to the 'VM Transform' dialog to
be able to select VMs for V2V by tag. Hide these fields if the dialog is
open from VM details view. Hide VM name input field if the dialog is
open from VM list view. Start several V2V requests if several VMs are
selected by tag.

Depends on ManageIQ/manageiq-providers-ovirt#115
Depends on ManageIQ/manageiq-ui-classic#2501

Added tag category and tag name fields to the 'VM Transform' dialog to
be able to select VMs for V2V by tag. Hide these fields if the dialog is
open from VM details view. Hide VM name input field if the dialog is
open from VM list view. Start several V2V requests if several VMs are
selected by tag.
@smelamud
Copy link
Contributor Author

@miq-bot assign gmcculloug

@smelamud
Copy link
Contributor Author

smelamud commented Oct 25, 2017

False positive from miq-bot: find_by method does not exist in this class, find_by_name is used correctly.

@gmcculloug
Copy link
Member

@smelamud This PR is missing specs.

@@ -14,16 +14,36 @@ def initialize(handle = $evm)
end

def main
validate_root_args %w(vm dialog_name dialog_provider dialog_cluster dialog_storage dialog_sparse)
validate_root_args(%w(vm dialog_provider dialog_cluster dialog_storage dialog_sparse))
if !@handle.root['dialog_tag_category'].empty? && !@handle.root['dialog_tag_name'].empty?
Copy link
Member

Choose a reason for hiding this comment

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

@smelamud Can we use @handle.root['dialog_tag_category'].present? && @handle.root['dialog_tag_name'].present?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tinaafitz Done.

validate_root_args(%w(vm dialog_provider dialog_cluster dialog_storage dialog_sparse))
if !@handle.root['dialog_tag_category'].empty? && !@handle.root['dialog_tag_name'].empty?
tag = "/#{@handle.root['dialog_tag_category']}/#{@handle.root['dialog_tag_name']}"
tagged_vms = @handle.vmdb(:vm).find_tagged_with(:all => tag, :ns => '/managed')
Copy link
Member

Choose a reason for hiding this comment

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

@smelamud Can we use the following to limit finding tagged VMWare VMs? $evm.vmdb('ManageIQ_Providers_Vmware_InfraManager_Vm').find_tagged_with(:all => tag, :ns => '/managed')

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tinaafitz It is limited to VMWare VMs only now. In future it may support other providers.

Copy link
Member

Choose a reason for hiding this comment

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

@smelamud I know the feature is limited to VMWare, but the vmdb find is not limited. Any Cloud/Infrastructure VM that contains that tag would be included here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tinaafitz Done.

'Vm::vm' => @handle.root['vm'].id,
'name' => @handle.root['dialog_name'],
'Vm::vm' => vm.id,
'name' => target_name.empty? ? vm.name : target_name,
Copy link
Member

Choose a reason for hiding this comment

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

Can you use present? in place of empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tinaafitz Done.

@@ -0,0 +1,43 @@
module ManageIQ
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a spec test for this method?

@@ -0,0 +1,47 @@
module ManageIQ
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a test for this method?

@@ -0,0 +1,32 @@
module ManageIQ
Copy link
Member

Choose a reason for hiding this comment

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

Test needed here as well.

@smelamud
Copy link
Contributor Author

@gmcculloug @tinaafitz Can I add specs in another pull request? I'm working on them currently, but cannot guarantee to get them ready by evening.

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.

@smelamud Changes look good.
@gmcculloug Please review.

@smelamud
Copy link
Contributor Author

@gmcculloug @tinaafitz Added specs.

@miq-bot
Copy link
Member

miq-bot commented Oct 26, 2017

Checked commits smelamud/manageiq-content@ee53f81~...51ceff7 with ruby 2.3.3, rubocop 0.47.1, and haml-lint 0.20.0
8 files checked, 2 offenses detected

content/automate/ManageIQ/Infrastructure/VM/Transform/Import.class/methods/list_tag_names.rb

spec/content/automate/ManageIQ/Infrastructure/VM/Transform/Import.class/methods/list_tag_names_spec.rb

@jelkosz
Copy link
Contributor

jelkosz commented Oct 30, 2017

This warning are false.

@gmcculloug
Copy link
Member

To clarify, the warnings are false because the Classification model exposes a find_by_name method which is not the default active record method. So the warning can be safely ignored.

@gmcculloug gmcculloug merged commit 5ff07dd into ManageIQ:master Oct 30, 2017
@gmcculloug gmcculloug added this to the Sprint 72 Ending Oct 30, 2017 milestone Oct 30, 2017
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