in perfkitbenchmarker/virtual_machine.py [0:0]
def GetResourceMetadata(self):
"""Returns a dict containing VM metadata.
Returns:
dict mapping string property key to value.
"""
if not self.created:
return {}
result = self.metadata.copy()
result.update({
'image': self.image,
'zone': self.zone,
'cloud': self.CLOUD,
'os_type': type(self).OS_TYPE,
})
if self.cidr is not None:
result['cidr'] = self.cidr
if self.machine_type is not None:
result['machine_type'] = self.machine_type
if self.use_dedicated_host is not None:
result['dedicated_host'] = self.use_dedicated_host
if self.num_vms_per_host is not None:
result['num_vms_per_host'] = self.num_vms_per_host
if self.tcp_congestion_control is not None:
result['tcp_congestion_control'] = self.tcp_congestion_control
if self.numa_node_count is not None:
result['numa_node_count'] = self.numa_node_count
if self.num_disable_cpus is not None:
result['num_disable_cpus'] = self.num_disable_cpus
if self.num_cpus is not None:
result['num_cpus'] = self.num_cpus
if (
self.num_cpus is not None
and self.NumCpusForBenchmark() != self.num_cpus
):
result['num_benchmark_cpus'] = self.NumCpusForBenchmark()
# Some metadata is unique per VM.
# Update publisher._VM_METADATA_TO_LIST to add more
if self.id is not None:
result['id'] = self.id
if self.name is not None:
result['name'] = self.name
if self.ip_address is not None:
result['ip_address'] = self.ip_address
if pkb_flags.RECORD_PROCCPU.value and self.cpu_version:
result['cpu_version'] = self.cpu_version
if self.create_operation_name is not None:
result['create_operation_name'] = self.create_operation_name
if self.create_start_time:
result['create_start_time'] = self.create_start_time
return result