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

Route VMware vCD logs into its own file #153

Merged
merged 1 commit into from
Dec 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .rubocop_local.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# GlobalVars:
# AllowedVariables:
GlobalVars:
AllowedVariables:
# Loggers
- $vcloud_log
8 changes: 4 additions & 4 deletions app/models/manageiq/providers/vmware/cloud_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,24 @@ def supported_catalog_types
def vm_start(vm, _options = {})
vm.start
rescue => err
_log.error "vm=[#{vm.name}, error: #{err}"
$vcloud_log.error("vm=[#{vm.name}, error: #{err}")
end

def vm_stop(vm, _options = {})
vm.stop
rescue => err
_log.error "vm=[#{vm.name}, error: #{err}"
$vcloud_log.error("vm=[#{vm.name}, error: #{err}")
end

def vm_suspend(vm, _options = {})
vm.suspend
rescue => err
_log.error "vm=[#{vm.name}], error: #{err}"
$vcloud_log.error("vm=[#{vm.name}], error: #{err}")
end

def vm_restart(vm, _options = {})
vm.restart
rescue => err
_log.error "vm=[#{vm.name}], error: #{err}"
$vcloud_log.error("vm=[#{vm.name}], error: #{err}")
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def initialize(options = {})
end

def start
_log.debug("Opening amqp connection to #{@options}")
$vcloud_log.debug("Opening amqp connection to #{@options}")
connection.start
@channel = connection.create_channel
initialize_queues(@channel)
Expand Down Expand Up @@ -76,7 +76,7 @@ def initialize_queues(channel)
begin
@queues[queue_name] = channel.queue(queue_name, :durable => true)
rescue Bunny::AccessRefused => err
_log.warn("Could not start listening to queue '#{queue_name}' due to: #{err}")
$vcloud_log.warn("Could not start listening to queue '#{queue_name}' due to: #{err}")
end
end
end
Expand All @@ -96,7 +96,7 @@ def listen_queues
end
end
rescue => e
_log.error("Exception receiving Rabbit (amqp)"\
$vcloud_log.error("Exception receiving Rabbit (amqp)"\
" event on #{queue_name} from #{@options[:hostname]}: #{e}")
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ def monitor_events
def stop_event_monitor
@event_monitor_handle.stop unless @event_monitor_handle.nil?
rescue StandardException => err
_log.warn("Event Monitor Stop errored because [#{err.message}]")
_log.warn("Error details: [#{err.details}]")
_log.log_backtrace(err)
$vcloud_log.warn("Event Monitor Stop errored because [#{err.message}]")
$vcloud_log.warn("Error details: [#{err.details}]")
$vcloud_log.log_backtrace(err)
ensure
reset_event_monitor_handle
end

def queue_event(event)
_log.info "Caught event [#{event.type}]"
$vcloud_log.info("Caught event [#{event.type}]")
event_hash = ManageIQ::Providers::Vmware::CloudManager::EventParser.event_to_hash(event, @cfg[:ems_id])
EmsEvent.add_queue('add', @cfg[:ems_id], event_hash)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def self.raw_create_stack(orchestration_manager, stack_name, template, options =
service.instantiate_template(create_options)
end
rescue => err
_log.error "stack=[#{stack_name}], error: #{err}"
$vcloud_log.error("stack=[#{stack_name}], error: #{err}")
raise MiqException::MiqOrchestrationProvisionError, err.to_s, err.backtrace
end

Expand All @@ -23,7 +23,7 @@ def raw_delete_stack
raw_stack.destroy
end
rescue => err
_log.error "stack=[#{name}], error: #{err}"
$vcloud_log.error("stack=[#{name}], error: #{err}")
raise MiqException::MiqOrchestrationDeleteError, err.to_s, err.backtrace
end

Expand All @@ -38,7 +38,7 @@ def raw_status
rescue MiqException::MiqOrchestrationStackNotExistError
raise
rescue => err
_log.error("stack=[#{name}], error: #{err}")
$vcloud_log.error("stack=[#{name}], error: #{err}")
raise MiqException::MiqOrchestrationStatusError, err.to_s, err.backtrace
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def initialize(ems, options = nil)
def ems_inv_to_hashes
log_header = "MIQ(#{self.class.name}.#{__method__}) Collecting data for EMS name: [#{@ems.name}] id: [#{@ems.id}]"

$log.info("#{log_header}...")
$vcloud_log.info("#{log_header}...")

get_ems
get_orgs
Expand All @@ -28,7 +28,7 @@ def ems_inv_to_hashes
get_vapp_templates
get_images

$log.info("#{log_header}...Complete")
$vcloud_log.info("#{log_header}...Complete")

@data
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def connection_rescue_block
yield
rescue => err
miq_exception = translate_exception(err)
_log.error("Error Class=#{err.class.name}, Message=#{err.message}")
$vcloud_log.error("Error Class=#{err.class.name}, Message=#{err.message}")
raise miq_exception
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ def initialize(ems, options = nil)
def ems_inv_to_hashes
log_header = "MIQ(#{self.class.name}.#{__method__}) Collecting data for EMS name: [#{@ems.name}] id: [#{@ems.id}]"

$log.info("#{log_header}...")
$vcloud_log.info("#{log_header}...")

get_networks
get_network_ports

$log.info("#{log_header}...Complete")
$vcloud_log.info("#{log_header}...Complete")

@data
end
Expand Down