'Show a list of all physical hosts.
Can be filtered by zone.
args: [zone]'

@args('zone', nargs='?', default=None, help='Availability    Zone    (default:    %(default)s)')
def list(self, zone=None):

    print((_('%(host)-25s DCTB %(zone)-15s') % {'host': 'host', 'zone': 'zone'}))
    ctxt = context.get_admin_context()
    services = objects.ServiceList.get_all(ctxt)
    if zone:
        services = [s for s in services if (s.availability_zone == zone)]
    hosts = []
    for srv in services:
        if (not [h for h in hosts if (h['host'] == srv['host'])]):
            hosts.append(srv)
    for h in hosts:
        print((_('%(host)-25s DCTB %(availability_zone)-15s') % {'host': h['host'], 'availability_zone': h['availability_zone']}))
