-
Notifications
You must be signed in to change notification settings - Fork 70
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
Add method vm_move_into_folder. #285
Conversation
@lfu you'll need to update the refresh parsers to set the type as well |
ee5f597
to
2b78398
Compare
@@ -0,0 +1,13 @@ | |||
class ManageIQ::Providers::Vmware::InfraManager::EmsFolder < EmsFolder |
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.
@agrare Are we going to need a data migration for this new class? This will seriously break refresh if we don't, I think.
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.
I think so. Working on it.
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.
@Fryguy I think the existing folders will be found and have their type updated on the first refresh after upgrade without being destroyed but let me confirm that.
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.
Ah never mind, forgot we .except
the :type
in save_inventory_with_findkey
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.
I have to delete the existing folders then the refresher would add them back in with type populated. Seems the refresher does not update the existing ones.
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.
639a52e
to
0a48372
Compare
0a48372
to
7ec9aa3
Compare
@lfu there are a few methods in the base EmsFolder which are VMware only, can you move those into here? https://github.com/ManageIQ/manageiq/blob/master/app/models/ems_folder.rb#L25-L33 and https://github.com/ManageIQ/manageiq/blob/master/app/models/ems_folder.rb#L121-L151 |
@@ -763,8 +763,7 @@ def assert_specific_vm | |||
:ems_ref_obj => VimString.new("group-d1", :Folder, :ManagedObjectReference), | |||
:uid_ems => "group-d1", | |||
:name => "Datacenters", | |||
:type => nil, | |||
|
|||
:type => "ManageIQ::Providers::Vmware::InfraManager::EmsFolder", |
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.
Need to update to ...::InfraManager::Folder
@@ -773,8 +772,7 @@ def assert_specific_vm | |||
:ems_ref_obj => VimString.new("group-v11341", :Folder, :ManagedObjectReference), | |||
:uid_ems => "group-v11341", | |||
:name => "JFitzgerald", | |||
:type => nil, | |||
|
|||
:type => "ManageIQ::Providers::Vmware::InfraManager::EmsFolder", |
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.
Same
[EmsFolder, "Datacenters", {:hidden => true}] => { | ||
[Datacenter, "Dev"] => { | ||
[EmsFolder, "host", {:hidden => true}] => { | ||
[ManageIQ::Providers::Vmware::InfraManager::EmsFolder, "Datacenters", {:hidden => true}] => { |
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.
Same on these
@@ -258,7 +258,7 @@ | |||
|
|||
it "will handle create events properly" do | |||
mor = "group-v123" | |||
klass = "EmsFolder" | |||
klass = "ManageIQ::Providers::Vmware::InfraManager::EmsFolder" |
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.
Same here
@lfu couple of small things then this LGTM |
7ec9aa3
to
c8c60e9
Compare
Travis would fail due to the factory changes in ManageIQ/manageiq#17519. |
79023fb
to
49396d7
Compare
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 passes for me locally with ManageIQ/manageiq#17519 applied
49396d7
to
2ad3dc5
Compare
Checked commit lfu@2ad3dc5 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
@@ -249,6 +249,10 @@ def vm_relocate(vm, options = {}) | |||
invoke_vim_ws(:relocateVM, vm, options[:user_event], options[:host], options[:pool], options[:datastore], options[:disk_move_type], options[:transform], options[:priority], options[:disk]) | |||
end | |||
|
|||
def vm_move_into_folder(vm, options = {}) | |||
invoke_vim_ws(:moveIntoFolder, options[:folder], options[:user_event], vm.ems_ref_obj) |
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.
Is this right? :moveIntoFolder
is defined on MiqVimFolder
and takes just the managed object ems_ref_obj. The method on MiqVim
is :moveIntoFolder_Task
and takes a folder ref and a vm ref.
Can you do a live test of this end to end to make sure it works?
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.
@agrare This has been end-to-end tested and it went well.
invoke_vim_ws
would convert options[:folder]
to MiqVimFolder
and calls moveIntoFolder
on it.
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.
Oh sorry you're completely right
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.
👍 LGTM
handle volume snapshot status changes
Add method vm_move_into_folder to move VM to a new folder.
Part of ManageIQ/manageiq#17519.
https://bugzilla.redhat.com/show_bug.cgi?id=1090957
@miq-bot add_label gaprindashvili/no, enhancement