Revision 29e3919d snf-cyclades-app/synnefo/quotas/management/commands/enforce-resources-cyclades.py
b/snf-cyclades-app/synnefo/quotas/management/commands/enforce-resources-cyclades.py | ||
---|---|---|
72 | 72 |
action="store_true", |
73 | 73 |
help=("Confirm actions that may permanently " |
74 | 74 |
"remove a vm")), |
75 |
make_option("--shutdown-timeout", |
|
76 |
help="Force vm shutdown after given seconds."), |
|
75 | 77 |
) |
76 | 78 |
|
77 | 79 |
def confirm(self): |
... | ... | |
113 | 115 |
m = "Expected integer max operations." |
114 | 116 |
raise CommandError(m) |
115 | 117 |
|
118 |
shutdown_timeout = options["shutdown_timeout"] |
|
119 |
if shutdown_timeout is not None: |
|
120 |
try: |
|
121 |
shutdown_timeout = int(shutdown_timeout) |
|
122 |
except ValueError: |
|
123 |
m = "Expected integer shutdown timeout." |
|
124 |
raise CommandError(m) |
|
125 |
|
|
116 | 126 |
users = options['users'] |
117 | 127 |
if users is not None: |
118 | 128 |
users = users.split(',') |
... | ... | |
130 | 140 |
resources = set(h[0] for h in handlers) |
131 | 141 |
dangerous = bool(resources.difference(DEFAULT_RESOURCES)) |
132 | 142 |
|
143 |
opts = {"shutdown_timeout": shutdown_timeout} |
|
133 | 144 |
actions = {} |
134 | 145 |
overlimit = [] |
135 | 146 |
viol_id = 0 |
... | ... | |
181 | 192 |
self.confirm() |
182 | 193 |
write("Applying actions. Please wait...\n") |
183 | 194 |
title = "Applied Actions" if fix else "Suggested Actions" |
184 |
log = enforce.perform_actions(actions, maxops=maxops, fix=fix) |
|
195 |
log = enforce.perform_actions(actions, maxops=maxops, fix=fix, |
|
196 |
options=opts) |
|
185 | 197 |
headers = ("Type", "ID", "State", "Backend", "Action", "Violation") |
186 | 198 |
if fix: |
187 | 199 |
headers += ("Result",) |
Also available in: Unified diff