コード例 #1
0
 def test_aggregate_host_delete(self):
     """Ensure we can add host to the aggregate."""
     ctxt = context.get_admin_context()
     result = _create_aggregate_with_hosts(context=ctxt, metadata=None)
     db.aggregate_host_delete(ctxt, result.id, _get_fake_aggr_hosts()[0])
     expected = db.aggregate_host_get_all(ctxt, result.id)
     self.assertEqual(0, len(expected))
コード例 #2
0
ファイル: test_db_api.py プロジェクト: hiteshwadekar/nova
 def test_aggregate_host_delete(self):
     """Ensure we can add host to the aggregate."""
     ctxt = context.get_admin_context()
     result = _create_aggregate_with_hosts(context=ctxt, metadata=None)
     db.aggregate_host_delete(ctxt, result.id, _get_fake_aggr_hosts()[0])
     expected = db.aggregate_host_get_all(ctxt, result.id)
     self.assertEqual(0, len(expected))
コード例 #3
0
    def delete_host(self, host):
        if self.in_api:
            _host_delete_from_db(self._context, self.id, host)
        else:
            db.aggregate_host_delete(self._context, self.id, host)

        self.hosts.remove(host)
        self.obj_reset_changes(fields=['hosts'])
コード例 #4
0
ファイル: aggregate.py プロジェクト: 4everming/nova
    def delete_host(self, host):
        if self.in_api:
            _host_delete_from_db(self._context, self.id, host)
        else:
            db.aggregate_host_delete(self._context, self.id, host)

        self.hosts.remove(host)
        self.obj_reset_changes(fields=['hosts'])
コード例 #5
0
ファイル: test_db_api.py プロジェクト: matiu2/nova
 def test_aggregate_host_add_deleted(self):
     """Ensure we can add a host that was previously deleted."""
     ctxt = context.get_admin_context()
     result = _create_aggregate_with_hosts(context=ctxt, metadata=None)
     host = _get_fake_aggr_hosts()[0]
     db.aggregate_host_delete(ctxt, result.id, host)
     db.aggregate_host_add(ctxt, result.id, host)
     expected = db.aggregate_host_get_all(ctxt, result.id)
     self.assertEqual(len(expected), 1)
コード例 #6
0
 def test_aggregate_host_add_deleted(self):
     """Ensure we can add a host that was previously deleted."""
     ctxt = context.get_admin_context()
     result = _create_aggregate_with_hosts(context=ctxt, metadata=None)
     host = _get_fake_aggr_hosts()[0]
     db.aggregate_host_delete(ctxt, result.id, host)
     db.aggregate_host_add(ctxt, result.id, host)
     expected = db.aggregate_host_get_all(ctxt, result.id)
     self.assertEqual(len(expected), 1)
コード例 #7
0
ファイル: test_aggregate.py プロジェクト: ykwon8651/project-e
 def test_delete_host(self):
     self.mox.StubOutWithMock(db, 'aggregate_host_delete')
     db.aggregate_host_delete(self.context, 123, 'foo')
     self.mox.ReplayAll()
     agg = aggregate.Aggregate()
     agg.id = 123
     agg.hosts = ['foo', 'bar']
     agg._context = self.context
     agg.delete_host('foo')
     self.assertEqual(agg.hosts, ['bar'])
コード例 #8
0
ファイル: test_aggregate.py プロジェクト: CrazyTeaFs/nova
 def test_delete_host(self):
     self.mox.StubOutWithMock(db, 'aggregate_host_delete')
     db.aggregate_host_delete(self.context, 123, 'foo')
     self.mox.ReplayAll()
     agg = aggregate.Aggregate()
     agg.id = 123
     agg.hosts = ['foo', 'bar']
     agg._context = self.context
     agg.delete_host('foo')
     self.assertEqual(agg.hosts, ['bar'])
コード例 #9
0
ファイル: test_aggregate.py プロジェクト: wenlongwljs/nova
 def test_delete_host(self):
     self.mox.StubOutWithMock(db, "aggregate_host_delete")
     db.aggregate_host_delete(self.context, 123, "foo")
     self.mox.ReplayAll()
     agg = aggregate.Aggregate()
     agg.id = 123
     agg.hosts = ["foo", "bar"]
     agg._context = self.context
     agg.delete_host("foo")
     self.assertEqual(agg.hosts, ["bar"])
コード例 #10
0
ファイル: test_host_filters.py プロジェクト: bhuvan/nova
 def test_aggregate_filter_fails_extra_specs_deleted_host(self):
     self._stub_service_is_up(True)
     filt_cls = self.class_map['AggregateInstanceExtraSpecsFilter']()
     extra_specs = {'opt1': '1', 'opt2': '2'}
     self._create_aggregate_with_host(metadata={'opt1': '1'})
     agg2 = self._create_aggregate_with_host(name='fake2',
             metadata={'opt2': '2'})
     filter_properties = {'context': self.context, 'instance_type':
             {'memory_mb': 1024, 'extra_specs': extra_specs}}
     host = fakes.FakeHostState('host1', 'compute', {'free_ram_mb': 1024})
     db.aggregate_host_delete(self.context.elevated(), agg2.id, 'host1')
     self.assertFalse(filt_cls.host_passes(host, filter_properties))
コード例 #11
0
 def test_aggregate_filter_fails_extra_specs_deleted_host(self):
     self._stub_service_is_up(True)
     filt_cls = self.class_map['AggregateInstanceExtraSpecsFilter']()
     extra_specs = {'opt1': '1', 'opt2': '2'}
     self._create_aggregate_with_host(metadata={'opt1': '1'})
     agg2 = self._create_aggregate_with_host(name='fake2',
                                             metadata={'opt2': '2'})
     filter_properties = {
         'context': self.context,
         'instance_type': {
             'memory_mb': 1024,
             'extra_specs': extra_specs
         }
     }
     host = fakes.FakeHostState('host1', 'compute', {'free_ram_mb': 1024})
     db.aggregate_host_delete(self.context.elevated(), agg2.id, 'host1')
     self.assertFalse(filt_cls.host_passes(host, filter_properties))
コード例 #12
0
 def _delete_from_aggregate(self, service, aggregate):
     return db.aggregate_host_delete(self.context,
                                     aggregate['id'], service['host'])
コード例 #13
0
ファイル: aggregate.py プロジェクト: allinhtml/nova
 def delete_host(self, context, host):
     db.aggregate_host_delete(context, self.id, host)
     self.hosts.remove(host)
     self.obj_reset_changes(fields=['hosts'])
コード例 #14
0
 def _delete_from_aggregate(self, service, aggregate):
     return db.aggregate_host_delete(self.context, aggregate['id'],
                                     service['host'])
コード例 #15
0
ファイル: aggregate.py プロジェクト: gilmeir/nova
 def delete_host(self, context, host):
     db.aggregate_host_delete(context, self.id, host)
     self.hosts.remove(host)
     self.obj_reset_changes(fields=["hosts"])
コード例 #16
0
 def _delete_from_aggregate(self, service, aggregate):
     return db.aggregate_host_delete(self.context, aggregate["id"], service["host"])