def main(): global dm_maps, context # Udev context for querying context = pyudev.Context() # Cache the device mapper maps dm_maps = dm.maps() # Loop through the device mapper maps for map in dm_maps: print map.name.strip() get_deps(map.deps, 1) # Delimiter line print "-"*80
guid = msg.Guid() guid.a = 10 guid.b = 22 guid.c = 30 guid.d = 40 MI = {} req = getattr(clmsg, 'NewVolume_Request', None) res = getattr(clmsg, 'NewVolume_Response', type(None)) MI['NewVolume'] = (req, res) req = getattr(clmsg, 'DeleteVolume_Request', None) res = getattr(clmsg, 'DeleteVolume_Response', type(None)) MI['DeleteVolume'] = (req, res) print MI stub = rpc.RpcStub(guid, socket, Client, MI) arg = clmsg.NewVolume_Request() arg.volume_name = 'ssVolume2' arg.volume_size = 10240 arg.volume_type = '' arg.volume_type = 'striped' arg.striped_size = 0 ret = stub.callMethod('NewVolume', arg) maps = dm.maps() if len(maps) is not 0: print 'The new device is :' + maps[0].name else: print 'Client_CLI_test: call method failed' arg = clmsg.DeleteVolume_Request() arg.volume_name = 'ssVolume2' ret = stub.callMethod('DeleteVolume', arg)
def GetVolumeMap(self, name): mps = dm.maps() for mp in mps: if name == mp.name: return mp return None
guid=msg.Guid() guid.a=10 guid.b=22 guid.c=30 guid.d=40 MI = {} req = getattr(clmsg, 'NewVolume_Request', None) res = getattr(clmsg, 'NewVolume_Response', type(None)) MI['NewVolume'] = (req, res) req = getattr(clmsg, 'DeleteVolume_Request', None) res = getattr(clmsg, 'DeleteVolume_Response', type(None)) MI['DeleteVolume'] = (req, res) print MI stub=rpc.RpcStub(guid, socket, Client, MI) arg = clmsg.NewVolume_Request() arg.volume_name = 'ssVolume2' arg.volume_size = 10240 arg.volume_type = '' arg.volume_type = 'striped' arg.striped_size = 0 ret = stub.callMethod('NewVolume', arg) maps = dm.maps() if len(maps) is not 0: print 'The new device is :' + maps[0].name else: print 'Client_CLI_test: call method failed' arg = clmsg.DeleteVolume_Request() arg.volume_name = 'ssVolume2' ret = stub.callMethod('DeleteVolume', arg)