@utils.arg('host', metavar='<host>', help=_('Name of host.'))
@utils.arg('action', metavar='<action>', choices=['set', 'delete'], help=_("Actions: 'set' or 'delete'"))
@utils.arg('metadata', metavar='<key=value>', nargs='+', action='append', default=[], help=_('Metadata to set or delete (only key is necessary on delete)'))
def do_host_meta(cs, args):
 hypervisors = cs.hypervisors.search(args.host, servers=True)
 for hyper in hypervisors:
  metadata = _extract_metadata(args)
  if hasattr(hyper, 'servers'):
   for server in hyper.servers:
    if (args.action == 'set'):
     cs.servers.set_meta(server['uuid'], metadata)
    elif (args.action == 'delete'):
     cs.servers.delete_meta(server['uuid'], metadata.keys())

@ utils . arg ( 'host' , metavar = '<host>' , help = _ ( 'Name of host.' ) ) @ utils . arg ( 'action' , metavar = '<action>' , choices = [ 'set' , 'delete' ] , help = _ ( "Actions: 'set' or 'delete'" ) ) @ utils . arg ( 'metadata' , metavar = '<key=value>' , nargs = '+' , action = 'append' , default = [ ] , help = _ ( 'Metadata to set or delete (only key is necessary on delete)' ) ) def do_host_meta ( cs , args ) : hypervisors = cs . hypervisors . search ( args . host , servers = True ) for hyper in hypervisors : metadata = _extract_metadata ( args ) if hasattr ( hyper , 'servers' ) : for server in hyper . servers : if ( args . action == 'set' ) : cs . servers . set_meta ( server [ 'uuid' ] , metadata ) elif ( args . action == 'delete' ) : cs . servers . delete_meta ( server [ 'uuid' ] , metadata . keys ( ) )
set or delete metadata on all instances of a host .