@@ -221,6 +221,36 @@ def main(
221221 for node in cml_topology_dict ["nodes" ]
222222 if node ["node_definition" ] == "cat-sdwan-manager"
223223 )
224+
225+ # Check if manager node definition uses virtio disk driver and convert old sdb naming to vdb
226+ node_definitions = cml .definitions .node_definitions ()
227+ manager_node_def = next (
228+ (
229+ nd
230+ for nd in node_definitions
231+ if nd ["id" ] == manager_node ["node_definition" ]
232+ ),
233+ None ,
234+ )
235+ if (
236+ manager_node_def
237+ and manager_node_def .get ("sim" , {})
238+ .get ("linux_native" , {})
239+ .get ("disk_driver" )
240+ == "virtio"
241+ ):
242+ # Replace old sdb references with vdb for virtio disk driver compatibility
243+ if "/dev/sdb" in manager_node ["configuration" ]:
244+ log .info (
245+ "Converting legacy disk naming (sdb) to virtio naming (vdb) in manager configuration..."
246+ )
247+ manager_node ["configuration" ] = manager_node ["configuration" ].replace (
248+ '"/dev/sdb"' , '"/dev/vdb"'
249+ )
250+ manager_node ["configuration" ] = manager_node ["configuration" ].replace (
251+ "[ sdb," , "[ vdb,"
252+ )
253+
224254 existing_manager_passwords = re .findall (
225255 r"<user>[\s\S]+?<password>(\S+)</password>" , manager_node ["configuration" ]
226256 )
@@ -337,7 +367,7 @@ def main(
337367 elif node .node_definition == "cat8000v" and node .is_booted () is False :
338368 # To workaround CML problem, after config export for this node
339369 # we need to add 'no shutdown' under all interfaces
340- node .config = re .sub (
370+ node .configuration = re .sub (
341371 r"(interface\sGigabitEthernet\d\n)" ,
342372 r"\1 no shutdown\n" ,
343373 node .configuration ,
@@ -526,7 +556,7 @@ def main(
526556 uuid = uuid_search .group (1 )
527557 token = uuid_to_token [uuid ]
528558 # Update node config with new otp token
529- node .config = re .sub (
559+ node .configuration = re .sub (
530560 r"(vinitparam:[\w\W]+?otp\s:)\s(\w+)" ,
531561 rf"\1 { token } " ,
532562 node .configuration ,
0 commit comments