'Delete an empty cell by the given uuid.
If the cell is not found by uuid or it is not empty (it has host or
instance mappings) this command will return a non-zero exit code.
Returns 0 if the empty cell is found and deleted successfully.'

@args('--cell_uuid', metavar='<cell_uuid>', dest='cell_uuid', required=True, help=_('The    uuid    of    the    cell    to    delete.'))
def delete_cell(self, cell_uuid):

    ctxt = context.get_admin_context()
    try:
        cell_mapping = objects.CellMapping.get_by_uuid(ctxt, cell_uuid)
    except exception.CellMappingNotFound:
        print((_('Cell    with    uuid    %s    was    not    found.') % cell_uuid))
        return 1
    host_mappings = objects.HostMappingList.get_by_cell_id(ctxt, cell_mapping.id)
    if host_mappings:
        print((_('There    are    existing    hosts    mapped    to    cell    with    uuid    %s.') % cell_uuid))
        return 2
    instance_mappings = objects.InstanceMappingList.get_by_cell_id(ctxt, cell_mapping.id)
    if instance_mappings:
        print((_('There    are    existing    instances    mapped    to    cell    with    uuid    %s.') % cell_uuid))
        return 3
    cell_mapping.destroy()
    return 0
