本文整理汇总了Python中nova.db.block_device_mapping_update函数的典型用法代码示例。如果您正苦于以下问题:Python block_device_mapping_update函数的具体用法?Python block_device_mapping_update怎么用?Python block_device_mapping_update使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了block_device_mapping_update函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_block_device_mapping_update_or_create
def test_block_device_mapping_update_or_create(self):
fake_bdm = {"id": "fake-id"}
self.mox.StubOutWithMock(db, "block_device_mapping_create")
self.mox.StubOutWithMock(db, "block_device_mapping_update")
self.mox.StubOutWithMock(db, "block_device_mapping_update_or_create")
db.block_device_mapping_create(self.context, fake_bdm)
db.block_device_mapping_update(self.context, fake_bdm["id"], fake_bdm)
db.block_device_mapping_update_or_create(self.context, fake_bdm)
self.mox.ReplayAll()
self.conductor.block_device_mapping_update_or_create(self.context, fake_bdm, create=True)
self.conductor.block_device_mapping_update_or_create(self.context, fake_bdm, create=False)
self.conductor.block_device_mapping_update_or_create(self.context, fake_bdm)
示例2: test_block_device_mapping_update_or_create
def test_block_device_mapping_update_or_create(self):
self.mox.StubOutWithMock(db, 'block_device_mapping_create')
self.mox.StubOutWithMock(db, 'block_device_mapping_update')
self.mox.StubOutWithMock(db, 'block_device_mapping_update_or_create')
db.block_device_mapping_create(self.context, 'fake-bdm')
db.block_device_mapping_update(self.context,
'fake-id', {'id': 'fake-id'})
db.block_device_mapping_update_or_create(self.context, 'fake-bdm')
self.mox.ReplayAll()
self.conductor.block_device_mapping_create(self.context, 'fake-bdm')
self.conductor.block_device_mapping_update(self.context, 'fake-id', {})
self.conductor.block_device_mapping_update_or_create(self.context,
'fake-bdm')
示例3: save
def save(self, context):
updates = self.obj_get_changes()
if 'instance' in updates:
raise exception.ObjectActionError(action='save',
reason='instance changed')
updates.pop('id', None)
updated = db.block_device_mapping_update(self._context, self.id,
updates, legacy=False)
cells_api = cells_rpcapi.CellsAPI()
cells_api.bdm_update_or_create_at_top(context, updated)
self._from_db_object(context, self, updated)
示例4: save
def save(self, context):
updates = self.obj_get_changes()
if "instance" in updates:
raise exception.ObjectActionError(action="save", reason="instance changed")
updates.pop("id", None)
updated = db.block_device_mapping_update(self._context, self.id, updates, legacy=False)
self._from_db_object(context, self, updated)
cell_type = cells_opts.get_cell_type()
if cell_type == "compute":
cells_api = cells_rpcapi.CellsAPI()
cells_api.bdm_update_or_create_at_top(context, self)
示例5: save
def save(self):
updates = self.obj_get_changes()
if 'instance' in updates:
raise exception.ObjectActionError(action='save',
reason='instance changed')
updates.pop('id', None)
updated = db.block_device_mapping_update(self._context, self.id,
updates, legacy=False)
if not updated:
raise exception.BDMNotFound(id=self.id)
self._from_db_object(self._context, self, updated)
cell_type = cells_opts.get_cell_type()
if cell_type == 'compute':
cells_api = cells_rpcapi.CellsAPI()
cells_api.bdm_update_or_create_at_top(self._context, self)
示例6: save
def save(self):
updates = self.obj_get_changes()
if "instance" in updates:
raise exception.ObjectActionError(action="save", reason="instance changed")
updates.pop("id", None)
updated = db.block_device_mapping_update(self._context, self.id, updates, legacy=False)
if not updated:
raise exception.BDMNotFound(id=self.id)
self._from_db_object(self._context, self, updated)
cell_type = cells_opts.get_cell_type()
if cell_type == "compute":
create = False
# NOTE(alaski): If the device name has just been set this bdm
# likely does not exist in the parent cell and we should create it.
# If this is a modification of the device name we should update
# rather than create which is why None is used here instead of True
if "device_name" in updates:
create = None
cells_api = cells_rpcapi.CellsAPI()
cells_api.bdm_update_or_create_at_top(self._context, self, create=create)
示例7: block_device_mapping_update
def block_device_mapping_update(self, context, bdm_id, values):
return db.block_device_mapping_update(context, bdm_id, values)