@@ -1183,6 +1183,77 @@ def set_node_preferred_interface(session, args):
1183
1183
raise XenAPIPlugin .Failure ('-1' , [str (e )])
1184
1184
return str (True )
1185
1185
1186
+ def list_network_path (session , args ):
1187
+ group_name = args ["groupName" ]
1188
+
1189
+ linstor = LinstorVolumeManager (
1190
+ get_controller_uri (),
1191
+ group_name ,
1192
+ logger = util .SMlog
1193
+ )
1194
+ try :
1195
+ return str (linstor .list_node_path ())
1196
+ except Exception as e :
1197
+ raise XenAPIPlugin .Failure ('-1' , [str (e )])
1198
+
1199
+ def get_network_path (session , args ):
1200
+ group_name = args ["groupName" ]
1201
+ node1 = args ["node1" ]
1202
+ node2 = args ["node2" ]
1203
+
1204
+ linstor = LinstorVolumeManager (
1205
+ get_controller_uri (),
1206
+ group_name ,
1207
+ logger = util .SMlog
1208
+ )
1209
+ try :
1210
+ return str (linstor .get_node_path (node1 , node2 ))
1211
+ except Exception as e :
1212
+ raise XenAPIPlugin .Failure ('-1' , [str (e )])
1213
+
1214
+ def set_network_path (session , args ):
1215
+ group_name = args ["groupName" ]
1216
+ hostname1 = args ["node1" ]
1217
+ hostname2 = args ["node2" ]
1218
+ network_name = args ["network" ]
1219
+
1220
+ linstor = LinstorVolumeManager (
1221
+ get_controller_uri (),
1222
+ group_name ,
1223
+ logger = util .SMlog
1224
+ )
1225
+ ret_list = []
1226
+ try :
1227
+ list_resp = linstor .set_node_path (hostname1 , hostname2 , network_name )
1228
+ for resp in list_resp :
1229
+ if (resp .is_error ()):
1230
+ raise XenAPIPlugin .Failure ('-1' , [str (resp )])
1231
+ ret_list .append (str (resp ))
1232
+
1233
+ except Exception as e :
1234
+ raise XenAPIPlugin .Failure ('-1' , [str (e )])
1235
+ return str (ret_list )
1236
+
1237
+ def destroy_network_path (session , args ):
1238
+ group_name = args ["groupName" ]
1239
+ hostname1 = args ["node1" ]
1240
+ hostname2 = args ["node2" ]
1241
+
1242
+ linstor = LinstorVolumeManager (
1243
+ get_controller_uri (),
1244
+ group_name ,
1245
+ logger = util .SMlog
1246
+ )
1247
+ ret_list = []
1248
+ try :
1249
+ list_resp = linstor .destroy_node_path (hostname1 , hostname2 )
1250
+ for resp in list_resp :
1251
+ if (resp .is_error ()):
1252
+ raise XenAPIPlugin .Failure ('-1' , [str (resp )])
1253
+ ret_list .append (str (resp ))
1254
+ except Exception as e :
1255
+ raise XenAPIPlugin .Failure ('-1' , [str (e )])
1256
+ return str (ret_list )
1186
1257
1187
1258
if __name__ == '__main__' :
1188
1259
XenAPIPlugin .dispatch ({
@@ -1238,5 +1309,10 @@ if __name__ == '__main__':
1238
1309
'modifyNodeInterface' : modify_node_interface ,
1239
1310
'listNodeInterfaces' : list_node_interfaces ,
1240
1311
'getNodePreferredInterface' : get_node_preferred_interface ,
1241
- 'setNodePreferredInterface' : set_node_preferred_interface
1312
+ 'setNodePreferredInterface' : set_node_preferred_interface ,
1313
+
1314
+ 'listNetworkPath' : list_network_path ,
1315
+ 'getNetworkPath' : get_network_path ,
1316
+ 'setNetworkPath' : set_network_path ,
1317
+ 'destroyNetworkPath' : destroy_network_path
1242
1318
})
0 commit comments