changed format string in nova-manage
This commit is contained in:
parent
6f467a94e3
commit
209334e474
152
bin/nova-manage
152
bin/nova-manage
@ -1108,67 +1108,71 @@ class VsaCommands(object):
|
|||||||
self.vsa_api = vsa.API()
|
self.vsa_api = vsa.API()
|
||||||
self.context = context.get_admin_context()
|
self.context = context.get_admin_context()
|
||||||
|
|
||||||
self._format_str_vsa = "%-5s %-15s %-25s %-10s %-6s "\
|
self._format_str_vsa = "%(id)-5s %(vsa_id)-15s %(name)-25s "\
|
||||||
"%-9s %-10s %-10s %10s"
|
"%(type)-10s %(vcs)-6s %(drives)-9s %(stat)-10s "\
|
||||||
self._format_str_volume = "\t%-4s %-15s %-5s %-10s %-20s %s"
|
"%(az)-10s %(time)-10s"
|
||||||
self._format_str_drive = "\t%-4s %-15s %-5s %-10s %-20s %-4s %-10s %s"
|
self._format_str_volume = "\t%(id)-4s %(name)-15s %(size)-5s "\
|
||||||
self._format_str_instance = "\t%-4s %-10s %-20s %-12s %-10s "\
|
"%(stat)-10s %(att)-20s %(time)s"
|
||||||
"%-15s %-15s %-10s %-15s %s"
|
self._format_str_drive = "\t%(id)-4s %(name)-15s %(size)-5s "\
|
||||||
|
"%(stat)-10s %(host)-20s %(type)-4s %(tname)-10s %(time)s"
|
||||||
|
self._format_str_instance = "\t%(id)-4s %(name)-10s %(dname)-20s "\
|
||||||
|
"%(image)-12s %(type)-10s %(fl_ip)-15s %(fx_ip)-15s "\
|
||||||
|
"%(stat)-10s %(host)-15s %(time)s"
|
||||||
|
|
||||||
def _print_vsa_header(self):
|
def _print_vsa_header(self):
|
||||||
print self._format_str_vsa %\
|
print self._format_str_vsa %\
|
||||||
(_('ID'),
|
dict(id=_('ID'),
|
||||||
_('vsa_id'),
|
vsa_id=_('vsa_id'),
|
||||||
_('displayName'),
|
name=_('displayName'),
|
||||||
_('vc_type'),
|
type=_('vc_type'),
|
||||||
_('vc_cnt'),
|
vcs=_('vc_cnt'),
|
||||||
_('drive_cnt'),
|
drives=_('drive_cnt'),
|
||||||
_('status'),
|
stat=_('status'),
|
||||||
_('AZ'),
|
az=_('AZ'),
|
||||||
_('createTime'))
|
time=_('createTime'))
|
||||||
|
|
||||||
def _print_vsa(self, vsa):
|
def _print_vsa(self, vsa):
|
||||||
print self._format_str_vsa %\
|
print self._format_str_vsa %\
|
||||||
(vsa['id'],
|
dict(id=vsa['id'],
|
||||||
vsa['name'],
|
vsa_id=vsa['name'],
|
||||||
vsa['display_name'],
|
name=vsa['display_name'],
|
||||||
vsa['vsa_instance_type'].get('name', None),
|
type=vsa['vsa_instance_type'].get('name', None),
|
||||||
vsa['vc_count'],
|
vcs=vsa['vc_count'],
|
||||||
vsa['vol_count'],
|
drives=vsa['vol_count'],
|
||||||
vsa['status'],
|
stat=vsa['status'],
|
||||||
vsa['availability_zone'],
|
az=vsa['availability_zone'],
|
||||||
str(vsa['created_at']))
|
time=str(vsa['created_at']))
|
||||||
|
|
||||||
def _print_volume_header(self):
|
def _print_volume_header(self):
|
||||||
print _(' === Volumes ===')
|
print _(' === Volumes ===')
|
||||||
print self._format_str_volume %\
|
print self._format_str_volume %\
|
||||||
(_('ID'),
|
dict(id=_('ID'),
|
||||||
_('name'),
|
name=_('name'),
|
||||||
_('size'),
|
size=_('size'),
|
||||||
_('status'),
|
stat=_('status'),
|
||||||
_('attachment'),
|
att=_('attachment'),
|
||||||
_('createTime'))
|
time=_('createTime'))
|
||||||
|
|
||||||
def _print_volume(self, vol):
|
def _print_volume(self, vol):
|
||||||
print self._format_str_volume %\
|
print self._format_str_volume %\
|
||||||
(vol['id'],
|
dict(id=vol['id'],
|
||||||
vol['display_name'] or vol['name'],
|
name=vol['display_name'] or vol['name'],
|
||||||
vol['size'],
|
size=vol['size'],
|
||||||
vol['status'],
|
stat=vol['status'],
|
||||||
vol['attach_status'],
|
att=vol['attach_status'],
|
||||||
str(vol['created_at']))
|
time=str(vol['created_at']))
|
||||||
|
|
||||||
def _print_drive_header(self):
|
def _print_drive_header(self):
|
||||||
print _(' === Drives ===')
|
print _(' === Drives ===')
|
||||||
print self._format_str_drive %\
|
print self._format_str_drive %\
|
||||||
(_('ID'),
|
dict(id=_('ID'),
|
||||||
_('name'),
|
name=_('name'),
|
||||||
_('size'),
|
size=_('size'),
|
||||||
_('status'),
|
stat=_('status'),
|
||||||
_('host'),
|
host=_('host'),
|
||||||
_('type'),
|
type=_('type'),
|
||||||
_('typeName'),
|
tname=_('typeName'),
|
||||||
_('createTime'))
|
time=_('createTime'))
|
||||||
|
|
||||||
def _print_drive(self, drive):
|
def _print_drive(self, drive):
|
||||||
if drive['volume_type_id'] is not None and drive.get('volume_type'):
|
if drive['volume_type_id'] is not None and drive.get('volume_type'):
|
||||||
@ -1177,28 +1181,28 @@ class VsaCommands(object):
|
|||||||
drive_type_name = ''
|
drive_type_name = ''
|
||||||
|
|
||||||
print self._format_str_drive %\
|
print self._format_str_drive %\
|
||||||
(drive['id'],
|
dict(id=drive['id'],
|
||||||
drive['display_name'],
|
name=drive['display_name'],
|
||||||
drive['size'],
|
size=drive['size'],
|
||||||
drive['status'],
|
stat=drive['status'],
|
||||||
drive['host'],
|
host=drive['host'],
|
||||||
drive['volume_type_id'],
|
type=drive['volume_type_id'],
|
||||||
drive_type_name,
|
tname=drive_type_name,
|
||||||
str(drive['created_at']))
|
time=str(drive['created_at']))
|
||||||
|
|
||||||
def _print_instance_header(self):
|
def _print_instance_header(self):
|
||||||
print _(' === Instances ===')
|
print _(' === Instances ===')
|
||||||
print self._format_str_instance %\
|
print self._format_str_instance %\
|
||||||
(_('ID'),
|
dict(id=_('ID'),
|
||||||
_('name'),
|
name=_('name'),
|
||||||
_('disp_name'),
|
dname=_('disp_name'),
|
||||||
_('image'),
|
image=_('image'),
|
||||||
_('type'),
|
type=_('type'),
|
||||||
_('floating_IP'),
|
fl_ip=_('floating_IP'),
|
||||||
_('fixed_IP'),
|
fx_ip=_('fixed_IP'),
|
||||||
_('status'),
|
stat=_('status'),
|
||||||
_('host'),
|
host=_('host'),
|
||||||
_('createTime'))
|
time=_('createTime'))
|
||||||
|
|
||||||
def _print_instance(self, vc):
|
def _print_instance(self, vc):
|
||||||
|
|
||||||
@ -1212,16 +1216,16 @@ class VsaCommands(object):
|
|||||||
floating_addr = floating_addr or fixed_addr
|
floating_addr = floating_addr or fixed_addr
|
||||||
|
|
||||||
print self._format_str_instance %\
|
print self._format_str_instance %\
|
||||||
(vc['id'],
|
dict(id=vc['id'],
|
||||||
ec2utils.id_to_ec2_id(vc['id']),
|
name=ec2utils.id_to_ec2_id(vc['id']),
|
||||||
vc['display_name'],
|
dname=vc['display_name'],
|
||||||
('ami-%08x' % int(vc['image_ref'])),
|
image=('ami-%08x' % int(vc['image_ref'])),
|
||||||
vc['instance_type']['name'],
|
type=vc['instance_type']['name'],
|
||||||
floating_addr,
|
fl_ip=floating_addr,
|
||||||
fixed_addr,
|
fx_ip=fixed_addr,
|
||||||
vc['state_description'],
|
stat=vc['state_description'],
|
||||||
vc['host'],
|
host=vc['host'],
|
||||||
str(vc['created_at']))
|
time=str(vc['created_at']))
|
||||||
|
|
||||||
def _list(self, context, vsas, print_drives=False,
|
def _list(self, context, vsas, print_drives=False,
|
||||||
print_volumes=False, print_instances=False):
|
print_volumes=False, print_instances=False):
|
||||||
@ -1283,7 +1287,7 @@ class VsaCommands(object):
|
|||||||
try:
|
try:
|
||||||
project_id = os.getenv("EC2_ACCESS_KEY").split(':')[1]
|
project_id = os.getenv("EC2_ACCESS_KEY").split(':')[1]
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
print _("Failed to retrieve project id: %(exc)s") % locals()
|
print _("Failed to retrieve project id: %(exc)s") % exc
|
||||||
raise
|
raise
|
||||||
|
|
||||||
if user_id is None:
|
if user_id is None:
|
||||||
@ -1291,7 +1295,7 @@ class VsaCommands(object):
|
|||||||
project = self.manager.get_project(project_id)
|
project = self.manager.get_project(project_id)
|
||||||
user_id = project.project_manager_id
|
user_id = project.project_manager_id
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
print _("Failed to retrieve user info: %(exc)s") % locals()
|
print _("Failed to retrieve user info: %(exc)s") % exc
|
||||||
raise
|
raise
|
||||||
|
|
||||||
is_admin = self.manager.is_admin(user_id)
|
is_admin = self.manager.is_admin(user_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user