Revision 39a6388d snf-cyclades-app/synnefo/logic/management/commands/backend-update-status.py
b/snf-cyclades-app/synnefo/logic/management/commands/backend-update-status.py | ||
---|---|---|
48 | 48 |
help="Update statistics of only this backend"), |
49 | 49 |
make_option('--older-than', dest='older_than', metavar="MINUTES", |
50 | 50 |
help="Update only backends that have not been updated for\ |
51 |
MINUTES. Set to 0 to force update.") |
|
51 |
MINUTES. Set to 0 to force update."), |
|
52 |
make_option('--include-drained', dest='drained', |
|
53 |
default=False, |
|
54 |
action='store_true', |
|
55 |
help="Also update statistics of drained backends") |
|
52 | 56 |
) |
53 | 57 |
|
54 | 58 |
def handle(self, **options): |
... | ... | |
62 | 66 |
except Backend.DoesNotExist: |
63 | 67 |
raise CommandError("Backend not found in DB") |
64 | 68 |
else: |
65 |
# XXX:filter drained ? |
|
66 |
backends = Backend.objects.all() |
|
69 |
backends = Backend.objects.filter(offline=False) |
|
70 |
|
|
71 |
if not options['drained']: |
|
72 |
backends = backends.filter(drained=False) |
|
67 | 73 |
|
68 | 74 |
now = datetime.datetime.now() |
69 | 75 |
if options['older_than'] is not None: |
Also available in: Unified diff