Пример #1
0
	def MountChunk(self, volume):
		addr = volume.parameters[3]
		port = int(volume.parameters[4])
		chkclient = self.chkpool.get(self.guid, addr, port)
		target = chkclient.AssembleChunk(volume)
		node = self.GetChunkNode(target.access_point, addr)
		if node != None:
			try:
				node.login()
			except Exception as ex:
				#If this node is already mounted
				if str(ex).find('session exists') > -1:
					logging.warn('chunk '+node.name+' is already mounted')
				else:
					raise ex
			dev = scandev.get_blockdev_by_targetname(node.name)
			if dev != None:
				return dev, node.name
		return None, None
Пример #2
0
import os
import libiscsi
import scandev

# check the following functions
# libiscsi.discover_sendtargets  | iscsi discovery
# node.login()                   | iscsi login
# node.logout()                  | iscsi logout 
# scandev.get_blockdev_by_targetname()  | get block device name

#discover nodes from ipaddress '192.168.0.12'
nodelist = libiscsi.discover_sendtargets('192.168.0.12')
if nodelist is not None :
	print nodelist[0].address
	print nodelist[0].name
else:
	print 'no node found!'

#login node 0
nodelist[0].login()

#get the locak blockdevicename of this target
print scandev.get_blockdev_by_targetname(nodelist[0].name)

#logout
nodelist[0].logout()
Пример #3
0
import os
import libiscsi
import scandev

# check the following functions
# libiscsi.discover_sendtargets  | iscsi discovery
# node.login()                   | iscsi login
# node.logout()                  | iscsi logout
# scandev.get_blockdev_by_targetname()  | get block device name

#discover nodes from ipaddress '192.168.0.12'
nodelist = libiscsi.discover_sendtargets('192.168.0.12')
if nodelist is not None:
    print nodelist[0].address
    print nodelist[0].name
else:
    print 'no node found!'

#login node 0
nodelist[0].login()

#get the locak blockdevicename of this target
print scandev.get_blockdev_by_targetname(nodelist[0].name)

#logout
nodelist[0].logout()