File tree Expand file tree Collapse file tree 3 files changed +51
-6
lines changed
app/models/manageiq/providers/ibm_power_hmc/infra_manager
spec/models/manageiq/providers/ibm_power_hmc/infra_manager Expand file tree Collapse file tree 3 files changed +51
-6
lines changed Original file line number Diff line number Diff line change 1
1
class ManageIQ ::Providers ::IbmPowerHmc ::InfraManager ::EventTargetParser
2
2
attr_reader :ems_event
3
3
4
+ NO_UUID_VALUE = "88888888-8888-8888-8888-888888888888" # Returned when no UUID assigned to LPAR
5
+
4
6
def initialize ( ems_event )
5
7
@ems_event = ems_event
6
8
end
@@ -25,6 +27,7 @@ def parse
25
27
)
26
28
new_targets = [ ]
27
29
30
+ ems = ems_event . ext_management_system
28
31
raw_event = ems_event . full_data
29
32
30
33
case ems_event . event_type
@@ -39,7 +42,12 @@ def parse
39
42
# have changed (e.g. RMCState, PartitionName, PartitionState etc...)
40
43
# This may be used to perform quick property REST API calls to the HMC
41
44
# instead of querying the full LPAR data.
42
- new_targets << { :assoc => :vms , :ems_ref => elems [ :uuid ] }
45
+ if elems [ :uuid ] == NO_UUID_VALUE
46
+ $ibm_power_hmc_log. info ( "#{ self . class } ##{ __method__ } #{ elems [ :type ] } Missing LPAR UUID. Escalating to full refresh for EMS: [#{ ems . name } ], id: [#{ ems . id } ]." )
47
+ target_collection << ems
48
+ else
49
+ new_targets << { :assoc => :vms , :ems_ref => elems [ :uuid ] }
50
+ end
43
51
when "VirtualSwitch" , "VirtualNetwork"
44
52
if elems . key? ( :manager_uuid )
45
53
new_targets << { :assoc => :hosts , :ems_ref => elems [ :manager_uuid ] }
Original file line number Diff line number Diff line change 12
12
[ [ :hosts , { :ems_ref => '977848c8-3bed-360a-c9d2-ae4b7e46b5d1' } ] ]
13
13
)
14
14
end
15
- it "LogicalPartition" do
16
- assert_event_triggers_target (
17
- "test_data/logical_partition_long_url.xml" ,
18
- [ [ :vms , { :ems_ref => '74CC38E2-C6DD-4B03-A0C6-088F7882EF0E' } ] ]
19
- )
15
+ context "LogicalPartition" do
16
+ it "targets the logical partition" do
17
+ assert_event_triggers_target (
18
+ "test_data/logical_partition_long_url.xml" ,
19
+ [ [ :vms , { :ems_ref => '74CC38E2-C6DD-4B03-A0C6-088F7882EF0E' } ] ]
20
+ )
21
+ end
22
+
23
+ context "with a missing LPAR UUID" do
24
+ it "targets the whole EMS" do
25
+ ems_event = create_ems_event ( "test_data/logical_partition_invalid_uuid.xml" )
26
+ parsed_targets = described_class . new ( ems_event ) . parse
27
+
28
+ expect ( parsed_targets ) . to eq ( [ @ems ] )
29
+ end
30
+ end
20
31
end
21
32
it "VirtualIOServer" do
22
33
assert_event_triggers_target (
Original file line number Diff line number Diff line change
1
+ <feed >
2
+ <entry >
3
+ <id >1afb3833-8a85-369f-977a-bb8741b1a15a</id >
4
+ <title >Event</title >
5
+ <published >2022-02-02T15:05:12.772Z</published >
6
+ <link rel =" SELF" href =" https://te.st:12443/rest/api/uom/Event/1afb3833-8a85-369f-977a-bb8741b1a15a" />
7
+ <author >
8
+ <name >IBM Power Systems Management Console</name >
9
+ </author >
10
+ <etag : etag xmlns : etag =" http://www.ibm.com/xmlns/systems/power/firmware/uom/mc/2012_10/" xmlns =" http://www.ibm.com/xmlns/systems/power/firmware/uom/mc/2012_10/" >-83524495</etag : etag >
11
+ <content type =" application/vnd.ibm.powervm.uom+xml; type=Event" >
12
+ <Event : Event xmlns : Event =" http://www.ibm.com/xmlns/systems/power/firmware/uom/mc/2012_10/" xmlns =" http://www.ibm.com/xmlns/systems/power/firmware/uom/mc/2012_10/" xmlns : ns2 =" http://www.w3.org/XML/1998/namespace/k2" schemaVersion =" V1_6_0" >
13
+ <Metadata >
14
+ <Atom >
15
+ <AtomID >1afb3833-8a85-369f-977a-bb8741b1a15a</AtomID >
16
+ <AtomCreated >1639561179310</AtomCreated >
17
+ </Atom >
18
+ </Metadata >
19
+ <EventType kb =" ROR" kxe =" false" >ADD_URI</EventType >
20
+ <EventID kb =" ROR" kxe =" false" >1639561179310</EventID >
21
+ <EventData kxe =" false" kb =" ROR" >https://te.st:12443/rest/api/uom/ManagedSystem/e4acf909-6d0b-3c03-b75a-4d8495e5fc49/LogicalPartition/88888888-8888-8888-8888-888888888888</EventData >
22
+ <EventDetail kxe =" false" kb =" ROR" >Other</EventDetail >
23
+ </Event : Event >
24
+ </content >
25
+ </entry >
26
+ </feed >
You can’t perform that action at this time.
0 commit comments