<s> from novaclient import base <EOL> from novaclient . i18n import _ <EOL> from novaclient import utils <EOL> class HostServersMigrateResponse ( base . Resource ) : <EOL> pass <EOL> def _server_migrate ( cs , server ) : <EOL> success = True <EOL> error_message = "<STR_LIT>" <EOL> try : <EOL> cs . servers . migrate ( server [ '<STR_LIT>' ] ) <EOL> except Exception as e : <EOL> success = False <EOL> error_message = _ ( "<STR_LIT>" ) % e <EOL> return HostServersMigrateResponse ( base . Manager , <EOL> { "<STR_LIT>" : server [ '<STR_LIT>' ] , <EOL> "<STR_LIT>" : success , <EOL> "<STR_LIT>" : error_message } ) <EOL> @ utils . arg ( '<STR_LIT:host>' , metavar = '<STR_LIT>' , help = '<STR_LIT>' ) <EOL> def do_host_servers_migrate ( cs , args ) : <EOL> """<STR_LIT>""" <EOL> hypervisors = cs . hypervisors . search ( args . host , servers = True ) <EOL> response = [ ] <EOL> for hyper in hypervisors : <EOL> if hasattr ( hyper , '<STR_LIT>' ) : <EOL> for server in hyper . servers : <EOL> response . append ( _server_migrate ( cs , server ) ) <EOL> utils . print_list ( response , <EOL> [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) </s>
