#NEWLINE# def do_agent_iscsi_deploy( task , agent_client ) : #NEWLINE# #INDENT# "Method invoked when deployed with the agent ramdisk.\n\n    This method is invoked by drivers for doing iSCSI deploy\n    using agent ramdisk.  This method assumes that the agent\n    is booted up on the node and is heartbeating.\n\n    :param task: a TaskManager object containing the node.\n    :param agent_client: an instance of agent_client.AgentClient\n        which will be used during iscsi deploy (for exposing node's\n        target disk via iSCSI, for install boot loader, etc).\n    :returns: a dictionary containing the following keys:\n        For partition image:\n            'root uuid': UUID of root partition\n            'efi system partition uuid': UUID of the uefi system partition\n                                         (if boot mode is uefi).\n            NOTE: If key exists but value is None, it means partition doesn't\n                  exist.\n        For whole disk image:\n            'disk identifier': ID of the disk to which image was deployed.\n    :raises: InstanceDeployFailure, if it encounters some error\n        during the deploy.\n    " #NEWLINE# node = task . node #NEWLINE# iscsi_options = build_deploy_ramdisk_options ( node ) #NEWLINE# i_info = deploy_utils . parse_instance_info ( node ) #NEWLINE# wipe_disk_metadata = ( not i_info [ 'preserve_ephemeral' ] ) #NEWLINE# iqn = iscsi_options [ 'iscsi_target_iqn' ] #NEWLINE# portal_port = iscsi_options [ 'iscsi_portal_port' ] #NEWLINE# result = agent_client . start_iscsi_target ( node , iqn , portal_port , wipe_disk_metadata = wipe_disk_metadata ) #NEWLINE# if ( result [ 'command_status' ] == 'FAILED' ) : #NEWLINE# #INDENT# msg = ( _ ( 'Failed to start the iSCSI target to deploy the node %(node)s. Error: %(error)s' ) % { #NEWLINE# #INDENT# 'node' : node . uuid , #NEWLINE# 'error' : result [ 'command_error' ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# deploy_utils . set_failed_state ( task , msg ) #NEWLINE# raise exception . InstanceDeployFailure ( reason = msg ) #NEWLINE# #UNINDENT# address = parse . urlparse ( node . driver_internal_info [ 'agent_url' ] ) #NEWLINE# address = address . hostname #NEWLINE# iscsi_params = { #NEWLINE# #INDENT# 'error' : result [ 'command_error' ] , #NEWLINE# 'iqn' : iqn , #NEWLINE# 'key' : iscsi_options [ 'deployment_key' ] , #NEWLINE# 'address' : address , #NEWLINE# #UNINDENT# } #NEWLINE# uuid_dict_returned = continue_deploy ( task , ** iscsi_params ) #NEWLINE# root_uuid_or_disk_id = uuid_dict_returned . get ( 'root uuid' , uuid_dict_returned . get ( 'disk identifier' ) ) #NEWLINE# driver_internal_info = node . driver_internal_info #NEWLINE# driver_internal_info [ 'root_uuid_or_disk_id' ] = root_uuid_or_disk_id #NEWLINE# node . driver_internal_info = driver_internal_info #NEWLINE# node . save ( ) #NEWLINE# return uuid_dict_returned