def test_update_and_get_cluster_lock_second_host_lock_released(self):
     ret = ovsvapp_db.update_and_get_cluster_lock("fake_vcenter", "fake_cluster")
     self.assertEqual("1", ret)
     ovsvapp_db.release_cluster_lock("fake_vcenter", "fake_cluster")
     with mock.patch("networking_vsphere.db.ovsvapp_db." "LOG.info") as info_log:
         ret_1 = ovsvapp_db.update_and_get_cluster_lock("fake_vcenter", "fake_cluster")
     self.assertEqual("1", ret_1)
     self.assertTrue(info_log.called)
 def test_update_and_get_cluster_lock_second_host_lock_released(self):
     ret = ovsvapp_db.update_and_get_cluster_lock('fake_vcenter',
                                                  'fake_cluster')
     self.assertEqual('1', ret)
     ovsvapp_db.release_cluster_lock('fake_vcenter', 'fake_cluster')
     with mock.patch('networking_vsphere.db.ovsvapp_db.'
                     'LOG.info') as info_log:
         ret_1 = ovsvapp_db.update_and_get_cluster_lock(
             'fake_vcenter', 'fake_cluster')
     self.assertEqual('1', ret_1)
     self.assertTrue(info_log.called)
Пример #3
0
 def test_update_and_get_cluster_lock_second_host_lock_released(self):
     ret = ovsvapp_db.update_and_get_cluster_lock('fake_vcenter',
                                                  'fake_cluster')
     self.assertEqual('1', ret)
     ovsvapp_db.release_cluster_lock('fake_vcenter', 'fake_cluster')
     with mock.patch('networking_vsphere.db.ovsvapp_db.'
                     'LOG.info') as info_log:
         ret_1 = ovsvapp_db.update_and_get_cluster_lock('fake_vcenter',
                                                        'fake_cluster')
     self.assertEqual('1', ret_1)
     self.assertTrue(info_log.called)
Пример #4
0
 def update_cluster_lock(self, rpc_context, **kwargs):
     vcenter_id = kwargs['vcenter_id']
     cluster_id = kwargs['cluster_id']
     success = kwargs['success']
     if cluster_id and vcenter_id:
         try:
             if success:
                 LOG.info(_LI("Releasing the cluster row for "
                              "cluster %(id)s in vCenter %(vc)s."),
                          {'id': cluster_id, 'vc': vcenter_id})
                 ovsvapp_db.release_cluster_lock(vcenter_id, cluster_id)
             else:
                 ovsvapp_db.set_cluster_threshold(vcenter_id, cluster_id)
         except Exception:
             LOG.exception(_LE("Failed to release/set the cluster lock."))
     return
Пример #5
0
 def update_cluster_lock(self, rpc_context, **kwargs):
     vcenter_id = kwargs['vcenter_id']
     cluster_id = kwargs['cluster_id']
     success = kwargs['success']
     if cluster_id and vcenter_id:
         try:
             if success:
                 LOG.info(_LI("Releasing the cluster row for "
                              "cluster %(id)s in vCenter %(vc)s."),
                          {'id': cluster_id, 'vc': vcenter_id})
                 ovsvapp_db.release_cluster_lock(vcenter_id, cluster_id)
             else:
                 ovsvapp_db.set_cluster_threshold(vcenter_id, cluster_id)
         except Exception:
             LOG.exception(_LE("Failed to release/set the cluster lock."))
     return