-
Notifications
You must be signed in to change notification settings - Fork 896
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
Enable VM reconfigure disks for supported rhevm version #11971
Enable VM reconfigure disks for supported rhevm version #11971
Conversation
@miq-bot add_label providers/rhevm |
@miq-bot add_label euwe/yes |
@borod108 please review |
<pr_mergeability_checker />This pull request is not mergeable. Please rebase and repush. |
16fd8ee
to
13ffb7f
Compare
<pr_mergeability_checker />This pull request is not mergeable. Please rebase and repush. |
20f08f4
to
58ab4b1
Compare
<pr_mergeability_checker />This pull request is not mergeable. Please rebase and repush. |
58ab4b1
to
513c749
Compare
@masayag looks good to me. |
@@ -892,6 +892,7 @@ def reconfigure | |||
@force_no_grid_xml = true | |||
@view, @pages = get_view(Vm, :view_suffix => "VmReconfigureRequest", :where_clause => ["vms.id IN (?)", @reconfigure_items]) # Get the records (into a view) and the paginator | |||
get_reconfig_limits | |||
@supports_reconfigure_disks = supports_reconfigure_disks? |
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.
Dont know much about the UI, but cant we do this without a instance variable? Why no call the method directly?
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.
Done.
@@ -9,6 +9,8 @@ class ManageIQ::Providers::Vmware::InfraManager::Vm < ManageIQ::Providers::Infra | |||
unsupported_reason_add(:clone, _('Clone operation is not supported')) if blank? || orphaned? || archived? | |||
end | |||
|
|||
supports :reconfigure_disks |
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.
there should be a validate_reconfigure_disks
somewhere in the code if this is not a new feature
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 haven't find any. Before adding support for reconfigure_disks by rhevm, only vmware supported that feature and the dialog was the responsible to block any other provider from doing so. I didn't find any previous validation of it in code.
supports :reconfigure_disks do | ||
if storage.blank? | ||
unsupported_reason_add(:reconfigure_disks, _('storage is missing')) | ||
elsif ext_management_system.blank? |
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.
there is supports :control
maybe you can use this? Its checking similar stuff
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.
The 'supports :control' cover more extensive cases than required. However, I'll have to share some of this logic with with #10505 (add quick_stats)
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.
Fine, then leave it just like this. I actually prefer having all checks inside this block/
@@ -6,6 +6,16 @@ class ManageIQ::Providers::Redhat::InfraManager::Vm < ManageIQ::Providers::Infra | |||
|
|||
supports_not :migrate, :reason => _("Migrate operation is not supported.") | |||
|
|||
supports :reconfigure_disks do |
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.
can you move that to app/models/vm.rb
@masayag is reconfigure_disks something that is supported by vmware too? |
@miq-bot add_label ui @AparnaKarve could you have a look at the UI part? |
@durandom Cannot apply the following label because they are not recognized: providers/vmware |
I'm fine with the |
@durandom reconfigure_disks is supported by both vmware and rhevm. It enables the UI to display the 'Disks' section by the result of 'supports_reconfigure_disks?' which returns 'true' for vmware due to change in app/models/manageiq/providers/vmware/infra_manager/vm.rb |
513c749
to
281258a
Compare
let(:rec_ids) { [vm.id] } | ||
let(:supports_reconfigure_disks) { true } | ||
before(:each) do | ||
allow_any_instance_of(ManageIQ::Providers::Redhat::InfraManager::Vm) |
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 you can also just mock the ems
that is attached to vm
allow(vm.ext_management_system).to receive..
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.
The test was updated to reflect the removal of the instance variable from previous patch which stored the value of the tested method.
let(:vm) { FactoryGirl.create(:vm_redhat, :storage => storage) } | ||
|
||
before(:each) do | ||
allow_any_instance_of(ManageIQ::Providers::Redhat::InfraManager) |
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, only mock the ems attached to vm
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.
Fixed, looks much better.
@masayag looks like this needs a rebase now ... assign back to me after you've rebased. |
<pr_mergeability_checker />This pull request is not mergeable. Please rebase and repush. |
531be84
to
5c6f0d6
Compare
@miq-bot assign @blomquisg |
5c6f0d6
to
7e4b318
Compare
close/reopen to re-kick tests ... brakeman failure looks like a failure to cache data in the tests |
<pr_mergeability_checker />This pull request is not mergeable. Please rebase and repush. |
The VM reconfigure disks is supported only by API v4 of version which was introduced since rhevm 4.0. The functionality will not be available for lower levels in the 'VM reconfigure' dialog. Also the feature requires the vm to have a store type associated with it, so it can be used as a target storage for the new disks. http://bugzilla.redhat.com/1373916
7e4b318
to
30aafd4
Compare
Checked commit masayag@30aafd4 with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1 |
Euwe Backport conflict: $ git cherry-pick -e -x -m 1 3a72731
error: could not apply 3a72731... Merge pull request #11971 from masayag/enable_vm_reconfigure_disk_for_supported_rhevm
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
$ git status
On branch euwe
Your branch is up-to-date with 'upstream/euwe'.
You are currently cherry-picking commit 3a72731.
(fix conflicts and run "git cherry-pick --continue")
(use "git cherry-pick --abort" to cancel the cherry-pick operation)
Changes to be committed:
modified: app/controllers/application_controller/ci_processing.rb
modified: app/models/manageiq/providers/redhat/infra_manager/vm.rb
modified: app/views/vm_common/_reconfigure.html.haml
modified: spec/controllers/application_controller/ci_processing_spec.rb
modified: spec/models/manageiq/providers/redhat/infra_manager/vm_spec.rb
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: app/models/manageiq/providers/redhat/infra_manager/api_integration.rb
both modified: app/models/manageiq/providers/vmware/infra_manager/vm.rb
both modified: app/models/mixins/supports_feature_mixin.rb
$ git diff diff --cc app/models/manageiq/providers/redhat/infra_manager/api_integration.rb
index 496b966,18bca2d..0000000
--- a/app/models/manageiq/providers/redhat/infra_manager/api_integration.rb
+++ b/app/models/manageiq/providers/redhat/infra_manager/api_integration.rb
@@@ -211,7 -218,12 +211,16 @@@ module ManageIQ::Providers::Redhat::Inf
end
def api4_supported_features
++<<<<<<< HEAD
+ [:quick_stats, :snapshots]
++=======
+ [
+ :migrate,
+ :quick_stats,
+ :reconfigure_disks,
+ :snapshots
+ ]
++>>>>>>> 3a72731... Merge pull request #11971 from masayag/enable_vm_reconfigure_disk_for_supported_rhevm
end
def api_features
diff --cc app/models/manageiq/providers/vmware/infra_manager/vm.rb
index 3a7a0b1,d3959d8..0000000
--- a/app/models/manageiq/providers/vmware/infra_manager/vm.rb
+++ b/app/models/manageiq/providers/vmware/infra_manager/vm.rb
@@@ -5,6 -5,12 +5,15 @@@ class ManageIQ::Providers::Vmware::Infr
include_concern 'RemoteConsole'
include_concern 'Reconfigure'
++<<<<<<< HEAD
++=======
+ supports :clone do
+ unsupported_reason_add(:clone, _('Clone operation is not supported')) if blank? || orphaned? || archived?
+ end
+
+ supports :reconfigure_disks
+
++>>>>>>> 3a72731... Merge pull request #11971 from masayag/enable_vm_reconfigure_disk_for_supported_rhevm
def add_miq_alarm
raise "VM has no EMS, unable to add alarm" unless ext_management_system
ext_management_system.vm_add_miq_alarm(self)
diff --cc app/models/mixins/supports_feature_mixin.rb
index 64c8bf2,6fae596..0000000
--- a/app/models/mixins/supports_feature_mixin.rb
+++ b/app/models/mixins/supports_feature_mixin.rb
@@@ -86,6 -89,8 +86,11 @@@ module SupportsFeatureMixi
:quick_stats => 'Quick Stats',
:reboot_guest => 'Reboot Guest Operation',
:reconfigure => 'Reconfiguration',
++<<<<<<< HEAD
++=======
+ :reconfigure_disks => 'Reconfigure Virtual Machines Disks',
+ :refresh_network_interfaces => 'Refresh Network Interfaces for a Host',
++>>>>>>> 3a72731... Merge pull request #11971 from masayag/enable_vm_reconfigure_disk_for_supported_rhevm
:refresh_new_target => 'Refresh non-existing record',
:regions => 'Regions of a Provider',
:remove_host => 'Remove Host', |
…_supported_rhevm Enable VM reconfigure disks for supported rhevm version (cherry picked from commit 3a72731) https://bugzilla.redhat.com/show_bug.cgi?id=1391711
Resolved conflicts. $ git log -1
commit 52942b490b9b72979e3ed43735fa8a17385598d2
Author: Greg Blomquist <blomquisg@gmail.com>
Date: Thu Nov 3 15:46:14 2016 -0400
Merge pull request #11971 from masayag/enable_vm_reconfigure_disk_for_supported_rhevm
Enable VM reconfigure disks for supported rhevm version
(cherry picked from commit 3a72731ae15df71f2d066d1638fc7ffd969d3b3b)
https://bugzilla.redhat.com/show_bug.cgi?id=1391711 |
The VM reconfigure disks is supported only by v4 of the API
which was introduced in RHEVM 4.0. The functionality will not
be available for an earlier versions in the 'VM reconfigure' dialog.
Also the feature requires the vm to have a store type associated
with it, so it can be used as a target storage for the new disks.
http://bugzilla.redhat.com/1373916