Merge "VMware: Refactor the formatting instance metadata"
This commit is contained in:
commit
1ab5795268
@ -232,31 +232,21 @@ class VMwareVMOps(object):
|
|||||||
|
|
||||||
def _get_instance_metadata(self, context, instance):
|
def _get_instance_metadata(self, context, instance):
|
||||||
flavor = instance.flavor
|
flavor = instance.flavor
|
||||||
return ('name:%s\n'
|
metadata = [('name', instance.display_name),
|
||||||
'userid:%s\n'
|
('userid', context.user_id),
|
||||||
'username:%s\n'
|
('username', context.user_name),
|
||||||
'projectid:%s\n'
|
('projectid', context.project_id),
|
||||||
'projectname:%s\n'
|
('projectname', context.project_name),
|
||||||
'flavor:name:%s\n'
|
('flavor:name', flavor.name),
|
||||||
'flavor:memory_mb:%s\n'
|
('flavor:memory_mb', flavor.memory_mb),
|
||||||
'flavor:vcpus:%s\n'
|
('flavor:vcpus', flavor.vcpus),
|
||||||
'flavor:ephemeral_gb:%s\n'
|
('flavor:ephemeral_gb', flavor.ephemeral_gb),
|
||||||
'flavor:root_gb:%s\n'
|
('flavor:root_gb', flavor.root_gb),
|
||||||
'flavor:swap:%s\n'
|
('flavor:swap', flavor.swap),
|
||||||
'imageid:%s\n'
|
('imageid', instance.image_ref),
|
||||||
'package:%s\n') % (instance.display_name,
|
('package', version.version_string_with_package())]
|
||||||
context.user_id,
|
# NOTE: formatted as lines like this: 'name:NAME\nuserid:ID\n...'
|
||||||
context.user_name,
|
return ''.join(['%s:%s\n' % (k, v) for k, v in metadata])
|
||||||
context.project_id,
|
|
||||||
context.project_name,
|
|
||||||
flavor.name,
|
|
||||||
flavor.memory_mb,
|
|
||||||
flavor.vcpus,
|
|
||||||
flavor.ephemeral_gb,
|
|
||||||
flavor.root_gb,
|
|
||||||
flavor.swap,
|
|
||||||
instance.image_ref,
|
|
||||||
version.version_string_with_package())
|
|
||||||
|
|
||||||
def _create_folders(self, parent_folder, folder_path):
|
def _create_folders(self, parent_folder, folder_path):
|
||||||
folders = folder_path.split('/')
|
folders = folder_path.split('/')
|
||||||
|
Loading…
Reference in New Issue
Block a user