Révision 33cff547
Add autoconf and enhance graphs
| plugins/nova/nova_floating_ips | ||
|---|---|---|
| 12 | 12 |
# |
| 13 | 13 |
# Magic markers |
| 14 | 14 |
#%# capabilities=autoconf |
| 15 |
#%# family=nova
|
|
| 15 |
#%# family=auto
|
|
| 16 | 16 |
|
| 17 |
from nova import context |
|
| 18 |
from nova import db |
|
| 19 |
from nova import flags |
|
| 20 |
from nova import utils |
|
| 21 | 17 |
import sys |
| 22 | 18 |
|
| 23 |
states = ['total', 'allocated', 'associated'] |
|
| 19 |
try: |
|
| 20 |
from nova import context |
|
| 21 |
from nova import db |
|
| 22 |
from nova import flags |
|
| 23 |
from nova import utils |
|
| 24 |
except ImportError: |
|
| 25 |
succesful_import = False |
|
| 26 |
else: |
|
| 27 |
succesful_import = True |
|
| 28 |
|
|
| 24 | 29 |
|
| 25 | 30 |
|
| 31 |
states = ['total', 'allocated', 'associated'] |
|
| 32 |
|
|
| 26 | 33 |
def print_config(): |
| 27 | 34 |
global states |
| 28 | 35 |
print 'graph_title Nova Floating IPs' |
| 29 |
print 'graph_vlabel %'
|
|
| 36 |
print 'graph_vlabel IPs'
|
|
| 30 | 37 |
print 'graph_args --base 1000 --lower-limit 0' |
| 31 | 38 |
print 'graph_category nova' |
| 32 | 39 |
print 'graph_scale no' |
| ... | ... | |
| 65 | 72 |
if sys.argv[1] == "config": |
| 66 | 73 |
print_config() |
| 67 | 74 |
elif sys.argv[1] == "autoconf": |
| 68 |
print "yes" |
|
| 69 |
else: |
|
| 75 |
if not succesful_import: |
|
| 76 |
print 'no (failed import nova module)' |
|
| 77 |
sys.exit(0) |
|
| 78 |
else: |
|
| 79 |
print 'yes' |
|
| 80 |
elif succesful_import: |
|
| 70 | 81 |
utils.default_flagfile() |
| 71 | 82 |
flags.FLAGS(sys.argv) |
| 72 | 83 |
print_values() |
Formats disponibles : Unified diff