-
Notifications
You must be signed in to change notification settings - Fork 899
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
OpenStack Nova enable/disable service #6996
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 |
---|---|---|
|
@@ -246,12 +246,39 @@ def save_networks_inventory(hardware, hashes, mode = :refresh) | |
def save_system_services_inventory(parent, hashes, mode = :refresh) | ||
return if hashes.nil? | ||
|
||
deletes = case mode | ||
when :refresh then nil | ||
when :scan then :use_association | ||
end | ||
####### | ||
# tripleo specific | ||
####### | ||
|
||
# if parent is OpenStack Cloud | ||
# and if parent have Infra provider | ||
if parent.kind_of?(ManageIQ::Providers::Openstack::CloudManager) | ||
infra_ems = parent.provider \ | ||
&& parent.provider.kind_of?(ManageIQ::Providers::Openstack::Provider) \ | ||
&& parent.provider.infra_ems | ||
if infra_ems | ||
# for each host | ||
infra_ems.hosts.map do |host| | ||
# select hashes with that hostname | ||
hashes_for_host = hashes.select do |hash| | ||
hash[:host] == host.hypervisor_hostname | ||
# and put host instead of hostname there | ||
end.map do |hash| | ||
hash[:host] = host | ||
hash | ||
end | ||
# save system_services for one host | ||
save_inventory_multi(host.system_services, hashes_for_host, [], [:name]) | ||
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. Hm, it's bad it's so hard to access the one table from multiple places. Maybe we should bring new table cloud_services, which would optionally belong to host and system_service? What do you think? It could clean the code a bit. 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. Solved by using new table for CloudService approach - see #7996 |
||
end | ||
end | ||
else | ||
deletes = case mode | ||
when :refresh then nil | ||
when :scan then :use_association | ||
end | ||
|
||
save_inventory_multi(parent.system_services, hashes, deletes, [:typename, :name]) | ||
save_inventory_multi(parent.system_services, hashes, deletes, [:typename, :name]) | ||
end | ||
end | ||
|
||
def save_guest_applications_inventory(parent, hashes) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,7 @@ def ems_inv_to_hashes | |
get_volumes | ||
get_snapshots | ||
get_object_store | ||
get_services | ||
|
||
$fog_log.info("#{log_header}...Complete") | ||
|
||
|
@@ -456,5 +457,63 @@ def clean_up_extra_flavor_keys | |
def add_instance_disk(disks, size, location, name) | ||
super(disks, size, location, name, "openstack") | ||
end | ||
|
||
def get_services | ||
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. @Ladas, I thought you were already picking up the services off the hosts and displaying them in the UI. Is this different? 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. @blomquisg yeah the API call for get_services gets only subset of the services, with the OpenStack enabled/disabled info |
||
# TODO(pblaho): use handled_list(:services) after fog with https://github.com/fog/fog/pull/3838 is released | ||
# services = @compute_service.handled_list(:services) | ||
services = @compute_service.services | ||
process_collection(services, :system_services) { |service| parse_service(service) } | ||
end | ||
|
||
def parse_service(service) | ||
# <Fog::Compute::OpenStack::Service | ||
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. delete these large comments please |
||
# id=1, | ||
# binary="nova-scheduler", | ||
# host="overcloud-controller-0.localdomain", | ||
# state="up", | ||
# status="enabled", | ||
# updated_at="2016-02-10T14:32:32.000000", | ||
# zone="internal", | ||
# disabled_reason=nil | ||
# > | ||
|
||
# <SystemService:0x0056064ec2e7f0 | ||
# id: 58, | ||
# name: "openstack-nova-compute", | ||
# svc_type: nil, | ||
# typename: "linux_systemd", | ||
# start: nil, | ||
# image_path: nil, | ||
# display_name: nil, | ||
# depend_on_service: nil, | ||
# depend_on_group: nil, | ||
# object_name: nil, | ||
# description: "OpenStack Nova Compute Server", | ||
# vm_or_template_id: nil, | ||
# enable_run_levels: nil, | ||
# disable_run_levels: nil, | ||
# host_id: 3, | ||
# running: true, | ||
# dependencies: {}, | ||
# systemd_load: "loaded", | ||
# systemd_active: "active", | ||
# systemd_sub: "running", | ||
# host_service_group_id: 1, | ||
# scheduling_status: nil> | ||
|
||
uid = service.id | ||
|
||
new_result = { | ||
# TODO(pblaho): solve the issue with openstack- prefix | ||
# maybe remove storing that prefix at all | ||
# prefix is used only at RH systems with systemd for openstack services | ||
:name => "openstack-#{service.binary}", | ||
# hostname without domain[s] | ||
:host => service.host.split('.').first, | ||
:scheduling_status => service.status, | ||
} | ||
|
||
return uid, new_result | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddSchedulingStatusToSystemServices < ActiveRecord::Migration | ||
def change | ||
add_column :system_services, :scheduling_status, :string | ||
end | ||
end | ||
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. @petrblaho Can you please pull this migration out into a separate PR so that it can be merged independent of the rest of the changes in this PR? We are approaching the deadline for schema changes for the darga branch, and I don't want the rest of the requested fixes in this PR to hold that up. |
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.
For the pluggable providers, we are trying not to add any more specific providers into the generic code. So there should not be a condition about Openstack, can it be rewritten without that?