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