-
Notifications
You must be signed in to change notification settings - Fork 62
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
[wip]Upgrade Ovirt Cluster through Ansibel #304
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
class ManageIQ::Providers::Redhat::InfraManager::EmsCluster < ::EmsCluster | ||
def upgrade(options = {}) | ||
role_options = {:role_name => "oVirt.cluster-upgrade"} | ||
job = ManageIQ::Providers::AnsibleRoleWorkflow.create_job({}, extra_vars_for_upgrade(options), role_options) | ||
job.signal(:start) | ||
job.miq_task | ||
end | ||
|
||
private | ||
|
||
def extra_vars_for_upgrade(options = {}) | ||
connect_options = ext_management_system.apply_connection_options_defaults(options) | ||
|
||
url = URI::Generic.build( | ||
:scheme => connect_options[:scheme], | ||
:host => connect_options[:server], | ||
:port => connect_options[:port], | ||
:path => connect_options[:path] | ||
).to_s | ||
|
||
{ | ||
:engine_url => url, | ||
:engine_user => connect_options[:username], | ||
:engine_password => connect_options[:password], | ||
:cluster_name => name, | ||
:hostname => "localhost" | ||
} | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,9 @@ def initialize_infra_inventory_collections | |
# --- IC groups definitions --- | ||
|
||
def add_clusters_group | ||
add_collection(infra, :ems_clusters) | ||
add_collection(infra, :ems_clusters) do |builder| | ||
builder.add_properties(:model_class => ::EmsCluster) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @borod108 and with the nested definition ^, lets try
and then verify it stores the right :type into the DB |
||
end | ||
add_resource_pools | ||
end | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FactoryGirl.define do | ||
factory :ems_cluster_redhat, :class => "ManageIQ::Providers::Redhat::InfraManager::EmsCluster", :parent => :ems_cluster | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
describe ManageIQ::Providers::Redhat::InfraManager::EmsCluster do | ||
context "#upgrade" do | ||
before do | ||
@ems = FactoryGirl.create(:ems_redhat_with_authentication) | ||
@cluster = FactoryGirl.create(:ems_cluster_redhat, :ems_id => @ems.id) | ||
my_server = double("my_server", :guid => "guid1") | ||
allow(MiqServer).to receive(:my_server).and_return(my_server) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is a method name, it is used here to put a task into MiqQueue: https://github.com/ManageIQ/manageiq/blob/master/app/models/manageiq/providers/ansible_runner_workflow.rb#L72 |
||
end | ||
it "sends the right parameters to the upgrade" do | ||
env_vars = {} | ||
extra_args = {:engine_url => "https://#{@ems.address}/ovirt-engine/api", | ||
:engine_user => @ems.authentication_userid, | ||
:engine_password => @ems.authentication_password, | ||
:cluster_name => @cluster.name, | ||
:hostname => "localhost"} | ||
role_arg = {:role_name=>"oVirt.cluster-upgrade"} | ||
expect(ManageIQ::Providers::AnsibleRoleWorkflow).to receive(:create_job).with(env_vars, extra_args, role_arg).and_call_original | ||
@cluster.upgrade | ||
end | ||
end | ||
end |
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.
@borod108 lets try to define this as