<s> import logging <EOL> from util import full_stack <EOL> from dbaas_nfsaas . provider import NfsaasProvider <EOL> from ... util . base import BaseStep <EOL> from ... . exceptions . error_codes import DBAAS_0009 <EOL> LOG = logging . getLogger ( __name__ ) <EOL> class CreateNfs ( BaseStep ) : <EOL> def __unicode__ ( self ) : <EOL> return "<STR_LIT>" <EOL> def do ( self , workflow_dict ) : <EOL> try : <EOL> workflow_dict [ '<STR_LIT>' ] = [ ] <EOL> for instance in workflow_dict [ '<STR_LIT>' ] : <EOL> host = instance . hostname <EOL> if instance . is_arbiter : <EOL> LOG . info ( "<STR_LIT>" ) <EOL> continue <EOL> LOG . info ( "<STR_LIT>" ) <EOL> disk = NfsaasProvider ( <EOL> ) . create_disk ( environment = workflow_dict [ '<STR_LIT>' ] , <EOL> plan = workflow_dict [ <EOL> '<STR_LIT>' ] , <EOL> host = host ) <EOL> if not disk : <EOL> return False <EOL> workflow_dict [ '<STR_LIT>' ] . append ( disk ) <EOL> return True <EOL> except Exception : <EOL> traceback = full_stack ( ) <EOL> workflow_dict [ '<STR_LIT>' ] [ '<STR_LIT>' ] . append ( DBAAS_0009 ) <EOL> workflow_dict [ '<STR_LIT>' ] [ '<STR_LIT>' ] . append ( traceback ) <EOL> return False <EOL> def undo ( self , workflow_dict ) : <EOL> try : <EOL> for host in workflow_dict [ '<STR_LIT>' ] : <EOL> LOG . info ( "<STR_LIT>" ) <EOL> disk = NfsaasProvider ( ) . destroy_disk ( <EOL> environment = workflow_dict [ '<STR_LIT>' ] , host = host ) <EOL> if not disk : <EOL> return False <EOL> return True <EOL> except Exception : <EOL> traceback = full_stack ( ) <EOL> workflow_dict [ '<STR_LIT>' ] [ '<STR_LIT>' ] . append ( DBAAS_0009 ) <EOL> workflow_dict [ '<STR_LIT>' ] [ '<STR_LIT>' ] . append ( traceback ) <EOL> return False </s>
