Revision 8c911970
b/snf-cyclades-app/synnefo/logic/management/commands/backend-add.py | ||
---|---|---|
29 | 29 |
# |
30 | 30 |
import sys |
31 | 31 |
from optparse import make_option |
32 |
from django.core.management.base import BaseCommand, CommandError |
|
32 |
from django.core.management.base import CommandError |
|
33 |
from snf_django.management.commands import SynnefoCommand |
|
33 | 34 |
|
34 | 35 |
from synnefo.db.models import Backend, Network |
35 | 36 |
from django.db.utils import IntegrityError |
... | ... | |
41 | 42 |
HYPERVISORS = [h[0] for h in Backend.HYPERVISORS] |
42 | 43 |
|
43 | 44 |
|
44 |
class Command(BaseCommand):
|
|
45 |
class Command(SynnefoCommand):
|
|
45 | 46 |
can_import_settings = True |
46 | 47 |
|
47 | 48 |
help = 'Create a new backend.' |
48 |
option_list = BaseCommand.option_list + (
|
|
49 |
option_list = SynnefoCommand.option_list + (
|
|
49 | 50 |
make_option('--clustername', dest='clustername'), |
50 | 51 |
make_option('--port', dest='port', default=5080), |
51 | 52 |
make_option('--user', dest='username'), |
b/snf-cyclades-app/synnefo/logic/management/commands/backend-modify.py | ||
---|---|---|
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 |
from django.core.management.base import BaseCommand, CommandError |
|
35 |
from django.core.management.base import CommandError |
|
36 |
from snf_django.management.commands import SynnefoCommand |
|
36 | 37 |
from synnefo.db.models import Backend |
37 | 38 |
from snf_django.management.utils import parse_bool |
38 | 39 |
from synnefo.management.common import (get_backend, check_backend_credentials) |
... | ... | |
40 | 41 |
HYPERVISORS = [h[0] for h in Backend.HYPERVISORS] |
41 | 42 |
|
42 | 43 |
|
43 |
class Command(BaseCommand):
|
|
44 |
class Command(SynnefoCommand):
|
|
44 | 45 |
output_transaction = True |
45 | 46 |
args = "<backend ID>" |
46 | 47 |
help = "Modify a backend" |
47 | 48 |
|
48 |
option_list = BaseCommand.option_list + (
|
|
49 |
option_list = SynnefoCommand.option_list + (
|
|
49 | 50 |
make_option('--clustername', |
50 | 51 |
dest='clustername', |
51 | 52 |
help="Set backend's clustername"), |
b/snf-cyclades-app/synnefo/logic/management/commands/backend-remove.py | ||
---|---|---|
28 | 28 |
# policies, either expressed or implied, of GRNET S.A. |
29 | 29 |
# |
30 | 30 |
|
31 |
from django.core.management.base import BaseCommand, CommandError |
|
31 |
from django.core.management.base import CommandError |
|
32 |
from snf_django.management.commands import SynnefoCommand |
|
32 | 33 |
from synnefo.management.common import get_backend |
33 | 34 |
from synnefo.logic import backend as backend_mod |
34 | 35 |
from synnefo.db.models import Backend |
... | ... | |
42 | 43 |
non-deleted instances.""" |
43 | 44 |
|
44 | 45 |
|
45 |
class Command(BaseCommand):
|
|
46 |
class Command(SynnefoCommand):
|
|
46 | 47 |
help = HELP_MSG |
47 | 48 |
|
48 | 49 |
def handle(self, *args, **options): |
b/snf-cyclades-app/synnefo/logic/management/commands/backend-update-status.py | ||
---|---|---|
27 | 27 |
# those of the authors and should not be interpreted as representing official |
28 | 28 |
# policies, either expressed or implied, of GRNET S.A. |
29 | 29 |
# |
30 |
from django.core.management.base import BaseCommand
|
|
30 |
from snf_django.management.commands import SynnefoCommand
|
|
31 | 31 |
|
32 | 32 |
from synnefo.db.models import Backend |
33 | 33 |
from synnefo.logic import backend as backend_mod |
... | ... | |
41 | 41 |
""" |
42 | 42 |
|
43 | 43 |
|
44 |
class Command(BaseCommand):
|
|
44 |
class Command(SynnefoCommand):
|
|
45 | 45 |
help = HELP_MSG |
46 | 46 |
|
47 | 47 |
def handle(self, **options): |
b/snf-cyclades-app/synnefo/logic/management/commands/flavor-create.py | ||
---|---|---|
34 | 34 |
from itertools import product |
35 | 35 |
from optparse import make_option |
36 | 36 |
|
37 |
from django.core.management.base import BaseCommand, CommandError |
|
37 |
from django.core.management.base import CommandError |
|
38 |
from snf_django.management.commands import SynnefoCommand |
|
38 | 39 |
|
39 | 40 |
from synnefo.db.models import Flavor |
40 | 41 |
|
41 | 42 |
|
42 |
class Command(BaseCommand):
|
|
43 |
class Command(SynnefoCommand):
|
|
43 | 44 |
output_transaction = True |
44 | 45 |
|
45 |
option_list = BaseCommand.option_list + (
|
|
46 |
option_list = SynnefoCommand.option_list + (
|
|
46 | 47 |
make_option("-n", "--dry-run", dest="dry_run", action="store_true"), |
47 | 48 |
) |
48 | 49 |
args = "<cpu>[,<cpu>,...] " \ |
b/snf-cyclades-app/synnefo/logic/management/commands/flavor-modify.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError |
|
36 |
from django.core.management.base import CommandError |
|
37 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 38 |
from synnefo.management.common import get_flavor |
38 | 39 |
from snf_django.management.utils import parse_bool |
39 | 40 |
|
... | ... | |
42 | 43 |
log = getLogger(__name__) |
43 | 44 |
|
44 | 45 |
|
45 |
class Command(BaseCommand):
|
|
46 |
class Command(SynnefoCommand):
|
|
46 | 47 |
args = "<flavor id>" |
47 | 48 |
help = "Modify a flavor" |
48 | 49 |
|
49 |
option_list = BaseCommand.option_list + (
|
|
50 |
option_list = SynnefoCommand.option_list + (
|
|
50 | 51 |
make_option( |
51 | 52 |
"--deleted", |
52 | 53 |
dest="deleted", |
b/snf-cyclades-app/synnefo/logic/management/commands/floating-ip-attach.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError |
|
36 |
from django.core.management.base import CommandError |
|
37 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 38 |
from synnefo.management import common |
38 | 39 |
from synnefo.logic import servers |
39 | 40 |
|
40 | 41 |
|
41 |
class Command(BaseCommand):
|
|
42 |
class Command(SynnefoCommand):
|
|
42 | 43 |
help = "Attach a floating IP to a VM or router" |
43 | 44 |
|
44 |
option_list = BaseCommand.option_list + (
|
|
45 |
option_list = SynnefoCommand.option_list + (
|
|
45 | 46 |
make_option( |
46 | 47 |
'--machine', |
47 | 48 |
dest='machine', |
b/snf-cyclades-app/synnefo/logic/management/commands/floating-ip-create.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError |
|
36 |
from django.core.management.base import CommandError |
|
37 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 38 |
from synnefo.management.common import convert_api_faults |
38 | 39 |
from synnefo.logic import ips |
39 | 40 |
from synnefo.api import util |
40 | 41 |
|
41 | 42 |
|
42 |
class Command(BaseCommand):
|
|
43 |
class Command(SynnefoCommand):
|
|
43 | 44 |
help = "Allocate a new floating IP" |
44 | 45 |
|
45 |
option_list = BaseCommand.option_list + (
|
|
46 |
option_list = SynnefoCommand.option_list + (
|
|
46 | 47 |
make_option( |
47 | 48 |
'--network', |
48 | 49 |
dest='network_id', |
b/snf-cyclades-app/synnefo/logic/management/commands/floating-ip-detach.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
#from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError |
|
36 |
from django.core.management.base import CommandError |
|
37 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 38 |
from synnefo.management import common |
38 | 39 |
from synnefo.logic import servers |
39 | 40 |
|
40 | 41 |
|
41 |
class Command(BaseCommand):
|
|
42 |
class Command(SynnefoCommand):
|
|
42 | 43 |
help = "Detach a floating IP from a VM or router" |
43 | 44 |
|
44 | 45 |
@common.convert_api_faults |
b/snf-cyclades-app/synnefo/logic/management/commands/network-create.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError |
|
36 |
from django.core.management.base import CommandError |
|
37 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 38 |
from synnefo.management.common import convert_api_faults |
38 | 39 |
from snf_django.management.utils import parse_bool |
39 | 40 |
|
... | ... | |
46 | 47 |
NETWORK_FLAVORS = Network.FLAVORS.keys() |
47 | 48 |
|
48 | 49 |
|
49 |
class Command(BaseCommand):
|
|
50 |
class Command(SynnefoCommand):
|
|
50 | 51 |
can_import_settings = True |
51 | 52 |
output_transaction = True |
52 | 53 |
|
53 | 54 |
help = "Create a new network" |
54 | 55 |
|
55 |
option_list = BaseCommand.option_list + (
|
|
56 |
option_list = SynnefoCommand.option_list + (
|
|
56 | 57 |
make_option( |
57 | 58 |
'--name', |
58 | 59 |
dest='name', |
b/snf-cyclades-app/synnefo/logic/management/commands/network-inspect.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError |
|
36 |
from django.core.management.base import CommandError |
|
37 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 38 |
from synnefo.management import pprint, common |
38 | 39 |
|
39 | 40 |
|
40 |
class Command(BaseCommand):
|
|
41 |
class Command(SynnefoCommand):
|
|
41 | 42 |
help = "Inspect a network on DB and Ganeti." |
42 | 43 |
args = "<Network ID>" |
43 | 44 |
|
44 |
option_list = BaseCommand.option_list + (
|
|
45 |
option_list = SynnefoCommand.option_list + (
|
|
45 | 46 |
make_option( |
46 | 47 |
'--displayname', |
47 | 48 |
action='store_true', |
b/snf-cyclades-app/synnefo/logic/management/commands/network-modify.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError |
|
36 |
from django.core.management.base import CommandError |
|
37 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 38 |
|
38 | 39 |
from synnefo.db.models import Backend |
39 | 40 |
from synnefo.management.common import (get_network, get_backend) |
... | ... | |
42 | 43 |
from django.db import transaction |
43 | 44 |
|
44 | 45 |
|
45 |
class Command(BaseCommand):
|
|
46 |
class Command(SynnefoCommand):
|
|
46 | 47 |
args = "<Network ID>" |
47 | 48 |
help = "Modify a network." |
48 | 49 |
|
49 |
option_list = BaseCommand.option_list + (
|
|
50 |
option_list = SynnefoCommand.option_list + (
|
|
50 | 51 |
make_option( |
51 | 52 |
'--name', |
52 | 53 |
dest='name', |
b/snf-cyclades-app/synnefo/logic/management/commands/pool-create.py | ||
---|---|---|
31 | 31 |
# interpreted as representing official policies, either expressed |
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 |
from django.core.management.base import BaseCommand, CommandError |
|
34 |
from django.core.management.base import CommandError |
|
35 |
from snf_django.management.commands import SynnefoCommand |
|
35 | 36 |
from optparse import make_option |
36 | 37 |
from synnefo.db.utils import validate_mac |
37 | 38 |
from synnefo.management.common import pool_table_from_type |
... | ... | |
39 | 40 |
POOL_CHOICES = ['bridge', 'mac-prefix'] |
40 | 41 |
|
41 | 42 |
|
42 |
class Command(BaseCommand):
|
|
43 |
class Command(SynnefoCommand):
|
|
43 | 44 |
help = "Create a new pool of resources." |
44 | 45 |
output_transaction = True |
45 |
option_list = BaseCommand.option_list + (
|
|
46 |
option_list = SynnefoCommand.option_list + (
|
|
46 | 47 |
make_option("--type", dest="type", |
47 | 48 |
choices=POOL_CHOICES, |
48 | 49 |
help="Type of pool. Choices:" |
b/snf-cyclades-app/synnefo/logic/management/commands/pool-list.py | ||
---|---|---|
31 | 31 |
# interpreted as representing official policies, either expressed |
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 |
from django.core.management.base import BaseCommand
|
|
34 |
from snf_django.management.commands import SynnefoCommand
|
|
35 | 35 |
from optparse import make_option |
36 | 36 |
from synnefo.management.common import pool_table_from_type |
37 | 37 |
|
38 | 38 |
POOL_CHOICES = ['bridge', 'mac-prefix'] |
39 | 39 |
|
40 | 40 |
|
41 |
class Command(BaseCommand):
|
|
41 |
class Command(SynnefoCommand):
|
|
42 | 42 |
help = "List available pools" |
43 | 43 |
output_transaction = True |
44 |
option_list = BaseCommand.option_list + (
|
|
44 |
option_list = SynnefoCommand.option_list + (
|
|
45 | 45 |
make_option('--type', dest='type', |
46 | 46 |
choices=POOL_CHOICES, |
47 | 47 |
help="Type of pool" |
b/snf-cyclades-app/synnefo/logic/management/commands/pool-modify.py | ||
---|---|---|
31 | 31 |
# interpreted as representing official policies, either expressed |
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 |
from django.core.management.base import BaseCommand, CommandError |
|
34 |
from django.core.management.base import CommandError |
|
35 |
from snf_django.management.commands import SynnefoCommand |
|
35 | 36 |
from optparse import make_option |
36 | 37 |
from synnefo.management.common import pool_table_from_type |
37 | 38 |
|
38 | 39 |
POOL_CHOICES = ['bridge', 'mac-prefix'] |
39 | 40 |
|
40 | 41 |
|
41 |
class Command(BaseCommand):
|
|
42 |
class Command(SynnefoCommand):
|
|
42 | 43 |
args = "<pool ID>" |
43 | 44 |
help = "Modify a pool" |
44 | 45 |
output_transaction = True |
45 |
option_list = BaseCommand.option_list + (
|
|
46 |
option_list = SynnefoCommand.option_list + (
|
|
46 | 47 |
make_option('--type', dest='type', |
47 | 48 |
choices=POOL_CHOICES, |
48 | 49 |
help="Type of pool" |
b/snf-cyclades-app/synnefo/logic/management/commands/pool-show.py | ||
---|---|---|
31 | 31 |
# interpreted as representing official policies, either expressed |
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 |
from django.core.management.base import BaseCommand, CommandError |
|
34 |
from django.core.management.base import CommandError |
|
35 |
from snf_django.management.commands import SynnefoCommand |
|
35 | 36 |
from optparse import make_option |
36 | 37 |
|
37 | 38 |
from synnefo.db.pools import bitarray_to_map |
... | ... | |
40 | 41 |
POOL_CHOICES = ['bridge', 'mac-prefix'] |
41 | 42 |
|
42 | 43 |
|
43 |
class Command(BaseCommand):
|
|
44 |
class Command(SynnefoCommand):
|
|
44 | 45 |
args = "<pool ID>" |
45 | 46 |
help = "Show a pool" |
46 | 47 |
output_transaction = True |
47 |
option_list = BaseCommand.option_list + (
|
|
48 |
option_list = SynnefoCommand.option_list + (
|
|
48 | 49 |
make_option('--type', dest='type', |
49 | 50 |
choices=POOL_CHOICES, |
50 | 51 |
help="Type of pool" |
b/snf-cyclades-app/synnefo/logic/management/commands/port-create.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError |
|
36 |
from django.core.management.base import CommandError |
|
37 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 38 |
|
38 | 39 |
from synnefo.api import util |
39 | 40 |
from synnefo.management import common, pprint |
... | ... | |
48 | 49 |
with the network.""" |
49 | 50 |
|
50 | 51 |
|
51 |
class Command(BaseCommand):
|
|
52 |
class Command(SynnefoCommand):
|
|
52 | 53 |
help = HELP_MSG |
53 | 54 |
|
54 |
option_list = BaseCommand.option_list + (
|
|
55 |
option_list = SynnefoCommand.option_list + (
|
|
55 | 56 |
make_option( |
56 | 57 |
"--name", |
57 | 58 |
dest="name", |
b/snf-cyclades-app/synnefo/logic/management/commands/port-inspect.py | ||
---|---|---|
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 |
from django.core.management.base import BaseCommand, CommandError |
|
35 |
from django.core.management.base import CommandError |
|
36 |
from snf_django.management.commands import SynnefoCommand |
|
36 | 37 |
|
37 | 38 |
from synnefo.management.common import convert_api_faults |
38 | 39 |
from synnefo.management import pprint, common |
39 | 40 |
|
40 | 41 |
|
41 |
class Command(BaseCommand):
|
|
42 |
class Command(SynnefoCommand):
|
|
42 | 43 |
help = "Inspect a port on DB and Ganeti" |
43 | 44 |
args = "<port ID>" |
44 | 45 |
|
45 |
option_list = BaseCommand.option_list + (
|
|
46 |
option_list = SynnefoCommand.option_list + (
|
|
46 | 47 |
make_option( |
47 | 48 |
'--jobs', |
48 | 49 |
action='store_true', |
b/snf-cyclades-app/synnefo/logic/management/commands/queue-inspect.py | ||
---|---|---|
31 | 31 |
import pprint |
32 | 32 |
|
33 | 33 |
from optparse import make_option |
34 |
from django.core.management.base import BaseCommand, CommandError |
|
34 |
from django.core.management.base import CommandError |
|
35 |
from snf_django.management.commands import SynnefoCommand |
|
35 | 36 |
|
36 | 37 |
from synnefo.lib.amqp import AMQPClient |
37 | 38 |
|
38 | 39 |
|
39 |
class Command(BaseCommand):
|
|
40 |
class Command(SynnefoCommand):
|
|
40 | 41 |
args = "<queue name>" |
41 | 42 |
help = "Inspect the messages of a queue. Close all other clients in "\ |
42 | 43 |
"order to be able to inspect unacknowledged messages." |
43 | 44 |
|
44 |
option_list = BaseCommand.option_list + (
|
|
45 |
option_list = SynnefoCommand.option_list + (
|
|
45 | 46 |
make_option('--no-requeue', action='store_false', dest='requeue', |
46 | 47 |
default=True, help="Do not requeue the messages"), |
47 | 48 |
make_option('-i', '--interactive', action='store_true', default=False, |
b/snf-cyclades-app/synnefo/logic/management/commands/queue-retry.py | ||
---|---|---|
27 | 27 |
# those of the authors and should not be interpreted as representing official |
28 | 28 |
# policies, either expressed or implied, of GRNET S.A. |
29 | 29 |
# |
30 |
from django.core.management.base import BaseCommand
|
|
30 |
from snf_django.management.commands import SynnefoCommand
|
|
31 | 31 |
from optparse import make_option |
32 | 32 |
|
33 | 33 |
from synnefo.lib.amqp import AMQPClient |
... | ... | |
39 | 39 |
log = logging.getLogger("") |
40 | 40 |
|
41 | 41 |
|
42 |
class Command(BaseCommand):
|
|
42 |
class Command(SynnefoCommand):
|
|
43 | 43 |
help = "Resend messages from dead letter queues to original exchange""" |
44 | 44 |
|
45 |
option_list = BaseCommand.option_list + (
|
|
45 |
option_list = SynnefoCommand.option_list + (
|
|
46 | 46 |
make_option( |
47 | 47 |
'--keep-zombies', |
48 | 48 |
action='store_true', |
b/snf-cyclades-app/synnefo/logic/management/commands/reconcile-networks.py | ||
---|---|---|
36 | 36 |
""" |
37 | 37 |
import logging |
38 | 38 |
from optparse import make_option |
39 |
from django.core.management.base import BaseCommand
|
|
39 |
from snf_django.management.commands import SynnefoCommand
|
|
40 | 40 |
from synnefo.logic import reconciliation |
41 | 41 |
|
42 | 42 |
|
43 |
class Command(BaseCommand):
|
|
43 |
class Command(SynnefoCommand):
|
|
44 | 44 |
help = """Reconcile contents of Synnefo DB with state of Ganeti backend |
45 | 45 |
|
46 | 46 |
Network reconciliation can detect and fix the following cases: |
... | ... | |
53 | 53 |
""" |
54 | 54 |
|
55 | 55 |
can_import_settings = True |
56 |
option_list = BaseCommand.option_list + (
|
|
56 |
option_list = SynnefoCommand.option_list + (
|
|
57 | 57 |
make_option('--fix-all', action='store_true', |
58 | 58 |
dest='fix', default=False, |
59 | 59 |
help='Fix all issues.'), |
b/snf-cyclades-app/synnefo/logic/management/commands/reconcile-pools.py | ||
---|---|---|
29 | 29 |
# |
30 | 30 |
import logging |
31 | 31 |
from optparse import make_option |
32 |
from django.core.management.base import BaseCommand
|
|
32 |
from snf_django.management.commands import SynnefoCommand
|
|
33 | 33 |
from synnefo.logic import reconciliation |
34 | 34 |
|
35 | 35 |
|
... | ... | |
46 | 46 |
* Pool of IPv4 addresses for each network""" |
47 | 47 |
|
48 | 48 |
|
49 |
class Command(BaseCommand):
|
|
49 |
class Command(SynnefoCommand):
|
|
50 | 50 |
help = HELP_MSG |
51 | 51 |
|
52 |
option_list = BaseCommand.option_list + (
|
|
52 |
option_list = SynnefoCommand.option_list + (
|
|
53 | 53 |
make_option("--fix", action="store_true", |
54 | 54 |
dest="fix", default=False, |
55 | 55 |
help='Fix all issues.'), |
b/snf-cyclades-app/synnefo/logic/management/commands/reconcile-servers.py | ||
---|---|---|
38 | 38 |
import logging |
39 | 39 |
import subprocess |
40 | 40 |
from optparse import make_option |
41 |
from django.core.management.base import BaseCommand
|
|
41 |
from snf_django.management.commands import SynnefoCommand
|
|
42 | 42 |
from synnefo.management.common import get_backend |
43 | 43 |
from synnefo.logic import reconciliation |
44 | 44 |
from snf_django.management.utils import parse_bool |
45 | 45 |
|
46 | 46 |
|
47 |
class Command(BaseCommand):
|
|
47 |
class Command(SynnefoCommand):
|
|
48 | 48 |
can_import_settings = True |
49 | 49 |
|
50 | 50 |
help = 'Reconcile contents of Synnefo DB with state of Ganeti backend' |
51 |
option_list = BaseCommand.option_list + (
|
|
51 |
option_list = SynnefoCommand.option_list + (
|
|
52 | 52 |
make_option('--backend-id', default=None, dest='backend-id', |
53 | 53 |
help='Reconcilie VMs only for this backend'), |
54 | 54 |
make_option("--parallel", |
b/snf-cyclades-app/synnefo/logic/management/commands/server-create.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError |
|
36 |
from django.core.management.base import CommandError |
|
37 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 38 |
from synnefo.management import common, pprint |
38 | 39 |
from snf_django.management.utils import parse_bool |
39 | 40 |
|
... | ... | |
47 | 48 |
""" |
48 | 49 |
|
49 | 50 |
|
50 |
class Command(BaseCommand):
|
|
51 |
class Command(SynnefoCommand):
|
|
51 | 52 |
help = "Create a new VM." + HELP_MSG |
52 | 53 |
|
53 |
option_list = BaseCommand.option_list + (
|
|
54 |
option_list = SynnefoCommand.option_list + (
|
|
54 | 55 |
make_option("--backend-id", dest="backend_id", |
55 | 56 |
help="Unique identifier of the Ganeti backend." |
56 | 57 |
" Use snf-manage backend-list to find out" |
b/snf-cyclades-app/synnefo/logic/management/commands/server-import.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError |
|
36 |
from django.core.management.base import CommandError |
|
37 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 38 |
from synnefo.management import common |
38 | 39 |
|
39 | 40 |
from synnefo.db.models import VirtualMachine, Network, Flavor |
... | ... | |
60 | 61 |
""" |
61 | 62 |
|
62 | 63 |
|
63 |
class Command(BaseCommand):
|
|
64 |
class Command(SynnefoCommand):
|
|
64 | 65 |
help = "Import an existing Ganeti VM into Synnefo." + HELP_MSG |
65 | 66 |
args = "<ganeti_instance_name>" |
66 | 67 |
output_transaction = True |
67 | 68 |
|
68 |
option_list = BaseCommand.option_list + (
|
|
69 |
option_list = SynnefoCommand.option_list + (
|
|
69 | 70 |
make_option( |
70 | 71 |
"--backend-id", |
71 | 72 |
dest="backend_id", |
b/snf-cyclades-app/synnefo/logic/management/commands/server-inspect.py | ||
---|---|---|
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 |
from django.core.management.base import BaseCommand, CommandError |
|
35 |
from django.core.management.base import CommandError |
|
36 |
from snf_django.management.commands import SynnefoCommand |
|
36 | 37 |
|
37 | 38 |
from synnefo.management import common |
38 | 39 |
from synnefo.management import pprint |
39 | 40 |
|
40 | 41 |
|
41 |
class Command(BaseCommand):
|
|
42 |
class Command(SynnefoCommand):
|
|
42 | 43 |
help = "Inspect a server on DB and Ganeti" |
43 | 44 |
args = "<server ID>" |
44 | 45 |
|
45 |
option_list = BaseCommand.option_list + (
|
|
46 |
option_list = SynnefoCommand.option_list + (
|
|
46 | 47 |
make_option( |
47 | 48 |
'--jobs', |
48 | 49 |
action='store_true', |
b/snf-cyclades-app/synnefo/logic/management/commands/server-modify.py | ||
---|---|---|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 | 36 |
from django.db import transaction |
37 |
from django.core.management.base import BaseCommand, CommandError |
|
37 |
from django.core.management.base import CommandError |
|
38 |
from snf_django.management.commands import SynnefoCommand |
|
38 | 39 |
from synnefo.management.common import (get_vm, get_flavor, convert_api_faults, |
39 | 40 |
wait_server_task) |
40 | 41 |
from snf_django.management.utils import parse_bool |
... | ... | |
44 | 45 |
ACTIONS = ["start", "stop", "reboot_hard", "reboot_soft"] |
45 | 46 |
|
46 | 47 |
|
47 |
class Command(BaseCommand):
|
|
48 |
class Command(SynnefoCommand):
|
|
48 | 49 |
args = "<server ID>" |
49 | 50 |
help = "Modify a server." |
50 | 51 |
|
51 |
option_list = BaseCommand.option_list + (
|
|
52 |
option_list = SynnefoCommand.option_list + (
|
|
52 | 53 |
make_option( |
53 | 54 |
'--name', |
54 | 55 |
dest='name', |
b/snf-cyclades-app/synnefo/logic/management/commands/subnet-create.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError |
|
36 |
from django.core.management.base import CommandError |
|
37 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 38 |
from synnefo.management import common |
38 | 39 |
from snf_django.management.utils import parse_bool |
39 | 40 |
from synnefo.management import pprint |
... | ... | |
49 | 50 |
""" |
50 | 51 |
|
51 | 52 |
|
52 |
class Command(BaseCommand):
|
|
53 |
class Command(SynnefoCommand):
|
|
53 | 54 |
help = "Create a new Subnet." + HELP_MSG |
54 | 55 |
|
55 |
option_list = BaseCommand.option_list + (
|
|
56 |
option_list = SynnefoCommand.option_list + (
|
|
56 | 57 |
make_option("--network-id", dest="network_id", |
57 | 58 |
help="Specify the Network to attach the subnet. To get the" |
58 | 59 |
" networks of a user, use snf-manage network-list"), |
b/snf-cyclades-app/synnefo/logic/management/commands/subnet-inspect.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError |
|
36 |
from django.core.management.base import CommandError |
|
37 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 38 |
from synnefo.management import pprint, common |
38 | 39 |
|
39 | 40 |
|
40 |
class Command(BaseCommand):
|
|
41 |
class Command(SynnefoCommand):
|
|
41 | 42 |
help = "Inspect a subnet on DB and Ganeti." |
42 | 43 |
args = "<Subnet ID>" |
43 |
option_list = BaseCommand.option_list
|
|
44 |
option_list = SynnefoCommand.option_list
|
|
44 | 45 |
|
45 | 46 |
def handle(self, *args, **options): |
46 | 47 |
if len(args) != 1: |
b/snf-cyclades-app/synnefo/logic/management/commands/subnet-modify.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError |
|
36 |
from django.core.management.base import CommandError |
|
37 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 38 |
from synnefo.management import common |
38 | 39 |
|
39 | 40 |
from synnefo.logic import subnets |
... | ... | |
45 | 46 |
""" |
46 | 47 |
|
47 | 48 |
|
48 |
class Command(BaseCommand):
|
|
49 |
class Command(SynnefoCommand):
|
|
49 | 50 |
help = "Update a Subnet." + HELP_MSG |
50 | 51 |
args = "<Subnet ID>" |
51 |
option_list = BaseCommand.option_list + (
|
|
52 |
option_list = SynnefoCommand.option_list + (
|
|
52 | 53 |
make_option("--name", dest="name", |
53 | 54 |
help="The new subnet name."), |
54 | 55 |
) |
b/snf-cyclades-app/synnefo/plankton/management/commands/image-list.py | ||
---|---|---|
28 | 28 |
# policies, either expressed or implied, of GRNET S.A. |
29 | 29 |
# |
30 | 30 |
|
31 |
from django.core.management.base import BaseCommand
|
|
31 |
from snf_django.management.commands import SynnefoCommand
|
|
32 | 32 |
from optparse import make_option |
33 | 33 |
|
34 | 34 |
from snf_django.management.utils import pprint_table |
35 | 35 |
from synnefo.plankton.utils import image_backend |
36 | 36 |
|
37 | 37 |
|
38 |
class Command(BaseCommand):
|
|
38 |
class Command(SynnefoCommand):
|
|
39 | 39 |
help = "List public images or images available to a user." |
40 |
option_list = BaseCommand.option_list + (
|
|
40 |
option_list = SynnefoCommand.option_list + (
|
|
41 | 41 |
make_option( |
42 | 42 |
'--user-id', |
43 | 43 |
dest='userid', |
b/snf-cyclades-app/synnefo/plankton/management/commands/image-show.py | ||
---|---|---|
28 | 28 |
# policies, either expressed or implied, of GRNET S.A. |
29 | 29 |
# |
30 | 30 |
|
31 |
from django.core.management.base import BaseCommand, CommandError |
|
31 |
from django.core.management.base import CommandError |
|
32 |
from snf_django.management.commands import SynnefoCommand |
|
32 | 33 |
|
33 | 34 |
from synnefo.plankton.utils import image_backend |
34 | 35 |
from snf_django.management import utils |
35 | 36 |
|
36 | 37 |
|
37 |
class Command(BaseCommand):
|
|
38 |
class Command(SynnefoCommand):
|
|
38 | 39 |
args = "<image_id>" |
39 | 40 |
help = "Display available information about an image" |
40 | 41 |
|
b/snf-cyclades-app/synnefo/quotas/management/commands/reconcile-commissions-cyclades.py | ||
---|---|---|
31 | 31 |
# interpreted as representing official policies, either expressed |
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 |
from django.core.management.base import BaseCommand
|
|
34 |
from snf_django.management.commands import SynnefoCommand
|
|
35 | 35 |
from optparse import make_option |
36 | 36 |
|
37 | 37 |
from synnefo import quotas |
38 | 38 |
|
39 | 39 |
|
40 |
class Command(BaseCommand):
|
|
40 |
class Command(SynnefoCommand):
|
|
41 | 41 |
help = "Detect and resolve pending commissions to Quotaholder" |
42 | 42 |
output_transaction = True |
43 |
option_list = BaseCommand.option_list + (
|
|
43 |
option_list = SynnefoCommand.option_list + (
|
|
44 | 44 |
make_option("--fix", dest="fix", |
45 | 45 |
action='store_true', |
46 | 46 |
default=False, |
b/snf-cyclades-app/synnefo/quotas/management/commands/reconcile-resources-cyclades.py | ||
---|---|---|
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 | 34 |
from datetime import datetime |
35 |
from django.core.management.base import BaseCommand
|
|
35 |
from snf_django.management.commands import SynnefoCommand
|
|
36 | 36 |
from optparse import make_option |
37 | 37 |
|
38 | 38 |
from synnefo import quotas |
... | ... | |
41 | 41 |
from snf_django.utils import reconcile |
42 | 42 |
|
43 | 43 |
|
44 |
class Command(BaseCommand):
|
|
44 |
class Command(SynnefoCommand):
|
|
45 | 45 |
help = """Reconcile resource usage of Astakos with Cyclades DB. |
46 | 46 |
|
47 | 47 |
Detect unsynchronized usage between Astakos and Cyclades DB resources and |
48 | 48 |
synchronize them if specified so. |
49 | 49 |
|
50 | 50 |
""" |
51 |
option_list = BaseCommand.option_list + (
|
|
51 |
option_list = SynnefoCommand.option_list + (
|
|
52 | 52 |
make_option("--userid", dest="userid", |
53 | 53 |
default=None, |
54 | 54 |
help="Reconcile resources only for this user"), |
b/snf-django-lib/snf_django/management/utils.py | ||
---|---|---|
202 | 202 |
|
203 | 203 |
if headers: |
204 | 204 |
headers = map(smart_unicode, headers) |
205 |
table = [map(smart_unicode, row) for row in table] |
|
205 |
table = [map(safe_string, row) for row in table] |
|
206 |
table = [map(smart_locale_str, row) for row in table] |
|
206 | 207 |
|
207 | 208 |
if output_format == "json": |
208 | 209 |
assert(headers is not None), "json output format requires headers" |
Also available in: Unified diff