Skip to content

Instantly share code, notes, and snippets.

View cben's full-sized avatar

Beni Cherniavsky-Paskin cben

View GitHub Profile
@cben
cben / 1.regenerate secret token.patch
Last active September 24, 2017 16:32
Running manageiq from user's database dump
diff --git a/app/models/miq_database.rb b/app/models/miq_database.rb
index 2d5d51041e..4ad616df54 100644
--- a/app/models/miq_database.rb
+++ b/app/models/miq_database.rb
@@ -52,8 +52,8 @@ class MiqDatabase < ApplicationRecord
def self.seed
db = first || new
- db.session_secret_token ||= SecureRandom.hex(64)
- db.csrf_secret_token ||= SecureRandom.hex(64)
@cben
cben / evm.log-grepped-by-pid
Last active September 13, 2017 19:00
working EventCatcher log
[----] I, [2017-09-13T14:46:29.403981 #20812:66f7c6d0dc] INFO -- : MIQ(ManageIQ::Providers::Openshift::ContainerManager::EventCatcher.close_pg_sockets_inherited_from_parent) Closing socket: 24
[----] I, [2017-09-13T14:46:29.631900 #20812:66f7c6d0dc] INFO -- : MIQ(ManageIQ::Providers::Openshift::ContainerManager::EventCatcher::Runner#sync_config) ID [48], PID [20812], GUID [daa6df64-98b3-11e7-9f6f-02427af19f47], Zone [default], Active Roles [automate,database_operations,database_owner,ems_inventory,ems_operations,event,reporting,scheduler,smartstate,user_interface,web_services,websocket], Assigned Roles [automate,database_operations,database_owner,ems_inventory,ems_operations,event,reporting,scheduler,smartstate,user_interface,web_services,websocket], Configuration:
[----] I, [2017-09-13T14:46:29.632363 #20812:66f7c6d0dc] INFO -- : :count: 1
[----] I, [2017-09-13T14:46:29.632404 #20812:66f7c6d0dc] INFO -- : :gc_interval: 900
[----] I, [2017-09-13T14:46:29.632431 #20812:66f7c6d0dc] INFO -- : :heartbe
@cben
cben / rails s
Created September 12, 2017 00:41
manageiq container nodes view N+1
I, [2017-09-11T20:37:51.092320 #17410] INFO -- : Started GET "/api" for 127.0.0.1 at 2017-09-11 20:37:51 -0400
I, [2017-09-11T20:37:51.124681 #17410] INFO -- : Processing by Api::ApiController#index as JSON
D, [2017-09-11T20:37:51.125181 #17410] DEBUG -- : Cache read: a87f4cb5ff2aab1004537a8f96e936c1
D, [2017-09-11T20:37:51.125494 #17410] DEBUG -- : Cache read: a87f4cb5ff2aab1004537a8f96e936c1
D, [2017-09-11T20:37:51.125678 #17410] DEBUG -- : Cache read: a87f4cb5ff2aab1004537a8f96e936c1
D, [2017-09-11T20:37:51.126592 #17410] DEBUG -- : PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 3, in use: 2, waiting_in_queue: 0
D, [2017-09-11T20:37:51.127475 #17410] DEBUG -- : User Load (0.3ms) SELECT "users".* FROM "users" WHERE ("users"."id" BETWEEN $1 AND $2) AND "users"."userid" = $3 LIMIT $4 [["id", 0], ["id", 999999999999], ["userid", "admin"], ["LIMIT", 1]]
D, [2017-09-11T20:37:51.127858 #17410] DEBUG -- : User Inst Including Associations (0.1ms - 1rows)
D, [2017-09-11T20:37:5
@cben
cben / slowest
Created August 31, 2017 15:10
manageiq euwe 20 slowest tests
$ env SPEC_OPTS="--seed 14533 --profile 20" bin/rake test:vmdb
Top 20 slowest examples (490.06 seconds, 20.7% of total time):
ManageIQ::Providers::Openstack::InfraManager::Refresher will verify maintenance mode
72.58 seconds ./spec/models/manageiq/providers/openstack/infra_manager/refresher_rhos_juno_spec.rb:38
ManageIQ::Providers::Openstack::InfraManager::Refresher will perform a full refresh
51.78 seconds ./spec/models/manageiq/providers/openstack/infra_manager/refresher_rhos_juno_spec.rb:13
ManageIQ::Providers::Google::CloudManager::Refresher will perform a full refresh
29.12 seconds ./spec/models/manageiq/providers/google/cloud_manager/refresher_spec.rb:20
layouts/listnav/_availability_zone.html.haml link to parent cloud provider uses restful path
1) VmdbDatabase.report_client_connections will return an array of hashes and verify hash keys for client connections query
Failure/Error:
data = select(<<-SQL, "Client Connections").to_a
SELECT client_addr AS client_address
, datname AS database
, pid AS spid
, waiting AS is_waiting
, query
FROM pg_stat_activity
ORDER BY 1, 2
@cben
cben / image.json
Created August 23, 2017 18:50
a single image data from /oapi/v1/images
{
"metadata": {
"name": "sha256:08151bf2fc92355f236918bb16905921e6f66e1d03100fb9b18d60125db3df3a",
"selfLink": "/oapi/v1/images/sha256:08151bf2fc92355f236918bb16905921e6f66e1d03100fb9b18d60125db3df3a",
"uid": "628ed26d-8b08-11e6-ac14-525400cd2787",
"resourceVersion": "483",
"creationTimestamp": "2016-10-05T14:31:21Z"
},
"dockerImageReference": "centos/python-35-centos7@sha256:08151bf2fc92355f236918bb16905921e6f66e1d03100fb9b18d60125db3df3a",
"dockerImageMetadata": {
@cben
cben / Ladas.txt
Created August 23, 2017 18:42
first refresh adding many images queries count
@cben agrare queries done by the first refresh if you are interested
:rows_by_class:
Endpoint: 11
Authentication: 1
ContainerLabelTagMapping: 0
Vm: 0
ContainerProject: 0
ContainerQuota: 0
ContainerLimit: 0
@cben
cben / hits-sorted-by-stack.tsv
Last active September 5, 2017 13:41
locations where Timeout::Error struck in https://github.com/ManageIQ/manageiq/issues/9642, line numbers after this PR (but commented out the fix line to see where it used to fail)
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 5 columns, instead of 3 in line 8.
cleaned 1 failed 0 miq-benchmark.rb:025:in `realtime_block' -> miq-benchmark.rb:060:in `current_realtime'
cleaned 119 failed 0 miq-benchmark.rb:025:in `realtime_block' -> miq-benchmark.rb:060:in `current_realtime' -> miq-benchmark.rb:052:in `thread_unique_identifier'
cleaned 30 failed 0 miq-benchmark.rb:025:in `realtime_block' -> miq-benchmark.rb:060:in `current_realtime' -> miq-benchmark.rb:060:in `new'
cleaned 1 failed 0 miq-benchmark.rb:027:in `realtime_block'
cleaned 8 failed 0 miq-benchmark.rb:027:in `realtime_block' -> miq-benchmark.rb:056:in `in_realtime_block?'
cleaned 71 failed 0 miq-benchmark.rb:027:in `realtime_block' -> miq-benchmark.rb:056:in `in_realtime_block?' -> miq-benchmark.rb:052:in `thread_unique_identifier'
cleaned 0 failed 17 miq-benchmark.rb:033:in `realtime_block' -> miq-benchmark.rb:064:in `current_realtime='
cleaned 56 failed 0 miq-benchmark.rb:033:in `realtime_block' -> miq-benchmark.rb:064:in `current_realtime=' -> miq-benchmark.rb:052:in `thread_unique_identifier'
cleaned 1 faile
@cben
cben / 1.tag.policy.log
Last active August 20, 2017 17:24
Testing tag policies
Edit Tags, adding Location: London.
[----] I, [2017-08-20T20:12:52.937248 #27459:43a64b10d8] INFO -- : MIQ(policy-enforce_policy): Event: [request_assign_company_tag], To: [my-neighbour-pododo]
[----] I, [2017-08-20T20:12:53.000370 #27459:43a64b10d8] INFO -- : MIQ(policy-enforce_policy): Resolving policy [test]...
[----] I, [2017-08-20T20:12:53.091131 #27459:43a64b10d8] INFO -- : MIQ(action-invoke) Invoking action [Generate log message] for successful policy [test], event: [Tag Request], entity name: [my-neighbour-pododo], entity type: [»Pod (Kubernetes)«], sequence: [1], synchronous? [true]
[----] I, [2017-08-20T20:12:53.091477 #27459:43a64b10d8] INFO -- : MIQ(action-log): Policy success: policy: [test], event: [Tag Request], entity name: [my-neighbour-pododo], entity type: [»Pod (Kubernetes)«]
[----] I, [2017-08-20T20:12:53.091789 #27459:43a64b10d8] INFO -- : MIQ(action-invoke) Invoking action [Prevent current event from proceeding] for successful policy [test], event: [Tag Request], entity name: [my-
@cben
cben / 1.before.evm.log
Last active August 15, 2017 08:59
refresh graph logging in graphviz format
...
[----] I, [2017-08-14T20:22:50.754898 #9636:2ae4cddb50d8] INFO -- : MIQ(ManagerRefresh::SaveInventory.save_inventory) EMS: [scale-ocp-36-c03], id: [3] Saving EMS Inventory...Start
[----] I, [2017-08-15T11:34:07.680227 #9636:2ae4cddb50d8] INFO -- : MIQ(ManagerRefresh::SaveCollection::TopologicalSort.save_collections) Topological sorting of manager scale-ocp-36-c03 with ---nodes---:
InventoryCollection:<ContainerProject>
InventoryCollection:<CustomAttribute>
InventoryCollection:<CustomAttribute>
InventoryCollection:<ContainerQuota>, blacklist: [namespace]
InventoryCollection:<ContainerQuotaItem>
InventoryCollection:<ContainerLimit>, blacklist: [namespace]
InventoryCollection:<ContainerLimitItem>