#NEWLINE# @ classmethod #NEWLINE# def from_context( cls , context ) : #NEWLINE# #INDENT# vmax_ip = context . cloud_config . storage . vmax_ip #NEWLINE# vmax_port = context . cloud_config . storage . vmax_port #NEWLINE# vmax_user = context . cloud_config . storage . vmax_user #NEWLINE# vmax_password = context . cloud_config . storage . vmax_password #NEWLINE# vmax_port_groups = context . cloud_config . storage . vmax_port_groups #NEWLINE# vmax_fast_policy = context . cloud_config . storage . vmax_fast_policy #NEWLINE# vmax_pool_name = context . cloud_config . storage . vmax_pool_name #NEWLINE# vmax_iscsi_my_ip = context . cloud_config . storage . iscsi_my_ip #NEWLINE# vmax_initiator_name = context . cloud_config . storage . initiator_name #NEWLINE# volume_name_template = context . cloud_config . storage . volume_name_template #NEWLINE# backend_timeout = context . cloud_config . migrate . storage_backend_timeout #NEWLINE# vmax_config_opts = [ opt for opt in locals ( ) . keys ( ) if opt . startswith ( 'vmax_' ) ] #NEWLINE# missing_opts = [ opt for opt in vmax_config_opts if ( opt is None ) ] #NEWLINE# if any ( missing_opts ) : #NEWLINE# #INDENT# msg = 'Invalid configuration specified for EMC storage backend, following options must be specified: {}' #NEWLINE# msg = msg . format ( ', ' . join ( missing_opts ) ) #NEWLINE# LOG . error ( msg ) #NEWLINE# raise exception . InvalidConfigException ( msg ) #NEWLINE# #UNINDENT# cinder = context . resources [ utils . STORAGE_RESOURCE ] #NEWLINE# vmax_connector = EMCConnector ( vmax_ip , vmax_port , vmax_user , vmax_password , vmax_port_groups , vmax_fast_policy , vmax_pool_name , backend_timeout , volume_name_template , vmax_initiator_name ) #NEWLINE# num_retries = context . cloud_config . migrate . retry #NEWLINE# sudo_pass = context . cloud_config . migrate . local_sudo_password #NEWLINE# timeout = context . cloud_config . migrate . storage_backend_timeout #NEWLINE# iscsi_connector = iscsi . ISCSIConnector ( num_retries = vmax_user , local_sudo_password = sudo_pass , storage_backend_timeout = timeout ) #NEWLINE# db = cinder_db . CinderDBBroker ( cinder . mysql_connector ) #NEWLINE# return cls ( vmax_connector , db , iscsi_connector , vmax_iscsi_my_ip )