Example #1
0
 def judge_ds(self, args, js):
     cd = crm()
     # data = cd.lsdata()
     data = cd.get_data_linstor()
     linstorlv = GetLinstor(data)
     disks = {}
     for d in linstorlv.get_data():
         disks.update({d[1]: d[5]})
     js.up_data('Disk', disks)
     if args.show == 'all' or args.show == None:
         print("	" + "{:<15}".format("Diskname") + "Path")
         print("	" + "{:<15}".format("---------------") + "---------------")
         for k in disks:
             print("	" + "{:<15}".format(k) + disks[k])
     else:
         if js.check_key('Disk', args.show):
             print(args.show, ":", js.get_data('Disk').get(args.show))
         else:
             print("Fail! Can't find " + args.show)
Example #2
0
 def map_data(self, js, crmdata, hg, dg):
     mapdata = {}
     hostiqn = []
     for h in js.get_data('HostGroup').get(hg):
         iqn = js.get_data('Host').get(h)
         hostiqn.append(iqn)
     mapdata.update({'host_iqn': hostiqn})
     disk = js.get_data('DiskGroup').get(dg)
     cd = crm()
     data = cd.get_data_linstor()
     linstorlv = GetLinstor(data)
     print("get linstor r lv data")
     # print(linstorlv.get_data())
     diskd = {}
     for d in linstorlv.get_data():
         for i in disk:
             if i in d:
                 diskd.update({d[1]: [d[4], d[5]]})
     mapdata.update({'disk': diskd})
     mapdata.update({'target': crmdata[2]})
     # print(mapdata)
     return mapdata