当前位置: 首页>>代码示例>>Python>>正文


Python db.block_device_mapping_update函数代码示例

本文整理汇总了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)
开发者ID:jdurgin,项目名称:nova,代码行数:12,代码来源:test_conductor.py

示例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')
开发者ID:gminator,项目名称:nova,代码行数:14,代码来源:test_conductor.py

示例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)
开发者ID:baoguodong,项目名称:nova,代码行数:11,代码来源:block_device.py

示例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)
开发者ID:dtroyer,项目名称:nova,代码行数:11,代码来源:block_device.py

示例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)
开发者ID:ruslanloman,项目名称:nova,代码行数:15,代码来源:block_device.py

示例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)
开发者ID:EnKalvi,项目名称:nova,代码行数:20,代码来源:block_device.py

示例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)
开发者ID:Yuriy-Leonov,项目名称:nova,代码行数:2,代码来源:fake.py


注:本文中的nova.db.block_device_mapping_update函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。