コード例 #1
0
ファイル: test_pci_device.py プロジェクト: hsluoyz/patron
 def test_save_removed(self):
     ctxt = context.get_admin_context()
     self._create_fake_pci_device(ctxt=ctxt)
     self.pci_device.status = 'removed'
     self.mox.StubOutWithMock(db, 'pci_device_destroy')
     db.pci_device_destroy(ctxt, 1, 'a')
     self.mox.ReplayAll()
     self.pci_device.save()
     self.assertEqual(self.pci_device.status, 'deleted')
     self.assertRemotes()
コード例 #2
0
ファイル: test_pci_device.py プロジェクト: 2Exception/patron
 def test_save_removed(self):
     ctxt = context.get_admin_context()
     self._create_fake_pci_device(ctxt=ctxt)
     self.pci_device.status = 'removed'
     self.mox.StubOutWithMock(db, 'pci_device_destroy')
     db.pci_device_destroy(ctxt, 1, 'a')
     self.mox.ReplayAll()
     self.pci_device.save()
     self.assertEqual(self.pci_device.status, 'deleted')
     self.assertRemotes()
コード例 #3
0
ファイル: pci_device.py プロジェクト: hsluoyz/patron
 def save(self):
     if self.status == 'removed':
         self.status = 'deleted'
         db.pci_device_destroy(self._context, self.compute_node_id,
                               self.address)
     elif self.status != 'deleted':
         updates = self.obj_get_changes()
         if 'extra_info' in updates:
             updates['extra_info'] = jsonutils.dumps(updates['extra_info'])
         if updates:
             db_pci = db.pci_device_update(self._context,
                                           self.compute_node_id,
                                           self.address, updates)
             self._from_db_object(self._context, self, db_pci)