本文整理汇总了Python中nova.db.instance_extra_update_by_uuid函数的典型用法代码示例。如果您正苦于以下问题:Python instance_extra_update_by_uuid函数的具体用法?Python instance_extra_update_by_uuid怎么用?Python instance_extra_update_by_uuid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了instance_extra_update_by_uuid函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _save
def _save(self):
primitive = self.obj_to_primitive()
payload = jsonutils.dumps(primitive)
values = {"migration_context": payload}
db.instance_extra_update_by_uuid(self._context, self.instance_uuid, values)
self.obj_reset_changes()
示例2: create
def create(self, context):
topology = self.topology_from_obj()
if not topology:
return
values = {'numa_topology': topology.to_json()}
db.instance_extra_update_by_uuid(context, self.instance_uuid,
values)
self.obj_reset_changes()
示例3: save
def save(self, context):
blob = [{'count': x.count,
'spec': x.spec,
'alias_name': x.alias_name,
'is_new': x.is_new,
'request_id': x.request_id} for x in self.requests]
requests = jsonutils.dumps(blob)
db.instance_extra_update_by_uuid(context, self.instance_uuid,
{'pci_requests': requests})
示例4: _save_vcpu_model
def _save_vcpu_model(self, context):
# TODO(yjiang5): should merge the db accesses for all the extra
# fields
if "vcpu_model" in self.obj_what_changed():
if self.vcpu_model:
update = jsonutils.dumps(self.vcpu_model.obj_to_primitive())
else:
update = None
db.instance_extra_update_by_uuid(context, self.uuid, {"vcpu_model": update})
示例5: _save_flavor
def _save_flavor(self, context):
# FIXME(danms): We can do this smarterly by updating this
# with all the other extra things at the same time
flavor_info = {
"cur": self.flavor.obj_to_primitive(),
"old": (self.old_flavor and self.old_flavor.obj_to_primitive() or None),
"new": (self.new_flavor and self.new_flavor.obj_to_primitive() or None),
}
db.instance_extra_update_by_uuid(context, self.uuid, {"flavor": jsonutils.dumps(flavor_info)})
self.obj_reset_changes(["flavor", "old_flavor", "new_flavor"])
示例6: _save_flavor
def _save_flavor(self, context):
if not any([x in self.obj_what_changed() for x in
('flavor', 'old_flavor', 'new_flavor')]):
return
# FIXME(danms): We can do this smarterly by updating this
# with all the other extra things at the same time
flavor_info = {
'cur': self.flavor.obj_to_primitive(),
'old': (self.old_flavor and
self.old_flavor.obj_to_primitive() or None),
'new': (self.new_flavor and
self.new_flavor.obj_to_primitive() or None),
}
db.instance_extra_update_by_uuid(
context, self.uuid,
{'flavor': jsonutils.dumps(flavor_info)})
self.obj_reset_changes(['flavor', 'old_flavor', 'new_flavor'])
示例7: delete_by_instance_uuid
def delete_by_instance_uuid(cls, context, instance_uuid):
values = {'numa_topology': None}
db.instance_extra_update_by_uuid(context, instance_uuid,
values)
示例8: _save
def _save(self):
values = {'numa_topology': self._to_json()}
db.instance_extra_update_by_uuid(self._context, self.instance_uuid,
values)
self.obj_reset_changes()
示例9: save
def save(self, context):
blob = self.to_json()
db.instance_extra_update_by_uuid(context, self.instance_uuid,
{'pci_requests': blob})
示例10: _destroy
def _destroy(cls, context, instance_uuid):
values = {'migration_context': None}
db.instance_extra_update_by_uuid(context, instance_uuid, values)