def update_pci_device(self, node_id, address, values):
try:
pci_device = self.get_pci_device_by_addr(node_id, address)
target = self.client.read('/pcidevices/' + pci_device.uuid)
target_value = json.loads(target.value)
target_value.update(values)
target.value = json.dump_as_bytes(target_value)
self.client.update(target)
except exception.PciDeviceNotFound:
values.update({'compute_node_uuid': node_id,
'address': address})
return self._create_pci_device(values)
except Exception as e:
LOG.error('Error occurred while updating pci device: %s',
six.text_type(e))
raise
return translate_etcd_result(target, 'pcidevice')
评论列表
文章目录