@@ -83,9 +83,6 @@ def debug(self, live, config):
83
83
pprint .pprint (config )
84
84
print ()
85
85
86
- def before_add (self , client , config , live , render_ctx : dict ):
87
- pass
88
-
89
86
@contextmanager
90
87
def render (self , client , render_ctx : dict ):
91
88
live = self .get_live (client , render_ctx )
@@ -99,8 +96,6 @@ def render(self, client, render_ctx: dict):
99
96
100
97
self .debug (live , config )
101
98
102
- self .before_add (client , config , live , render_ctx )
103
-
104
99
for item in add_keys :
105
100
self .add (client , config [item ], render_ctx )
106
101
@@ -124,18 +119,6 @@ def config_key(self, config_item, render_ctx):
124
119
def get_live (self , client , render_ctx ):
125
120
return {subsys ['nqn' ]: subsys for subsys in rpc .nvmf .nvmf_get_subsystems (client )}
126
121
127
- def before_add (self , client , config , live , render_ctx : dict ):
128
- # If we have just toggled HA MASTER then the subsystem will
129
- # currently have a bunch of NULL bdevs attached. We need to
130
- # remove them so that the real BDEVs can be attached.
131
- if render_ctx ['failover.status' ] == 'MASTER' :
132
- for nqn , subsys in live .items ():
133
- if nqn == NVMET_DISCOVERY_NQN :
134
- continue
135
- for namespace in subsys ['namespaces' ]:
136
- if namespace ['name' ].startswith ('NULL:' ):
137
- rpc .nvmf .nvmf_subsystem_remove_ns (client , nqn = nqn , nsid = namespace ['nsid' ])
138
-
139
122
def add (self , client , config_item , render_ctx ):
140
123
141
124
kwargs = {
@@ -449,9 +432,8 @@ class NvmetBdevConfig(NvmetConfig):
449
432
450
433
def config_key (self , config_item , render_ctx ):
451
434
if subsys_visible (config_item ['subsys' ], render_ctx ):
452
- if render_ctx ['failover.status' ] == 'BACKUP' :
453
- return f"NULL:{ config_item ['device_path' ]} "
454
- return f"{ config_item ['device_type' ]} :{ config_item ['device_path' ]} "
435
+ if render_ctx ['failover.status' ] != 'BACKUP' :
436
+ return f"{ config_item ['device_type' ]} :{ config_item ['device_path' ]} "
455
437
456
438
def live_key (self , live_item ):
457
439
match live_item ['product_name' ]:
@@ -474,8 +456,9 @@ def get_live(self, client, render_ctx):
474
456
return result
475
457
476
458
def bdev_name (self , config_item , render_ctx ):
459
+ # Skip is we're the BACKUP in a HA
477
460
if render_ctx ['failover.status' ] == 'BACKUP' :
478
- return f"NULL: { config_item [ 'device_path' ] } "
461
+ return
479
462
480
463
match config_item ['device_type' ]:
481
464
case NAMESPACE_DEVICE_TYPE .ZVOL .api :
0 commit comments