From 9893c3eb5794e689736e881ec0551bdfeda48d8f Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Wed, 1 Aug 2012 11:24:59 -0400 Subject: [PATCH] Remove agent_update from the compute manager. It appears that this method of the compute method has never been used since it was added in fa0b64b500f3a196044459ba4bf8ed0dea214e92, so just remove it. It was also added to the virt driver API, but the only use is internally to the xenapi driver, so leave it as an internal thing to that driver only. Part of blueprint no-db-messaging. Change-Id: Idb2c823421e714fa364affbbb80d28175b9b5b4e --- nova/compute/manager.py | 18 ------------------ nova/tests/compute/test_compute.py | 20 -------------------- nova/tests/test_virt_drivers.py | 6 ------ nova/virt/driver.py | 13 ------------- nova/virt/fake.py | 3 --- 5 files changed, 60 deletions(-) diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 4540b76cf0dd..134983f017cf 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -1303,24 +1303,6 @@ class ComputeManager(manager.SchedulerDependentManager): instance=instance) self.driver.inject_file(instance, path, file_contents) - @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) - @checks_instance_lock - @wrap_instance_fault - def agent_update(self, context, instance_uuid, url, md5hash): - """Update agent running on an instance on this host.""" - context = context.elevated() - instance_ref = self.db.instance_get_by_uuid(context, instance_uuid) - current_power_state = self._get_power_state(context, instance_ref) - expected_state = power_state.RUNNING - if current_power_state != expected_state: - LOG.warn(_('trying to update agent on a non-running ' - '(state: %(current_power_state)s ' - 'expected: %(expected_state)s)') % locals(), - instance=instance_ref) - LOG.audit(_('updating agent to %(url)s') % locals(), - instance=instance_ref) - self.driver.agent_update(instance_ref, url, md5hash) - @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) @checks_instance_lock @wrap_instance_fault diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py index 4988a4be9321..d59753d58a70 100644 --- a/nova/tests/compute/test_compute.py +++ b/nova/tests/compute/test_compute.py @@ -766,26 +766,6 @@ class ComputeTestCase(BaseTestCase): self.compute.terminate_instance(self.context, instance=instance) - def test_agent_update(self): - """Ensure instance can have its agent updated""" - called = {'agent_update': False} - - def fake_driver_agent_update(self2, instance, url, md5hash): - called['agent_update'] = True - self.assertEqual(url, 'http://fake/url/') - self.assertEqual(md5hash, 'fakehash') - - self.stubs.Set(nova.virt.fake.FakeDriver, 'agent_update', - fake_driver_agent_update) - - instance = self._create_fake_instance() - self.compute.run_instance(self.context, instance['uuid']) - self.compute.agent_update(self.context, instance['uuid'], - 'http://fake/url/', 'fakehash') - self.assertTrue(called['agent_update']) - self.compute.terminate_instance(self.context, - instance=jsonutils.to_primitive(instance)) - def test_snapshot(self): """Ensure instance can be snapshotted""" instance = jsonutils.to_primitive(self._create_fake_instance()) diff --git a/nova/tests/test_virt_drivers.py b/nova/tests/test_virt_drivers.py index b724c2276fa8..fb109731fb01 100644 --- a/nova/tests/test_virt_drivers.py +++ b/nova/tests/test_virt_drivers.py @@ -258,12 +258,6 @@ class _VirtDriverTestCase(_FakeDriverBackendTestCase): base64.b64encode('/testfile'), base64.b64encode('testcontents')) - @catch_notimplementederror - def test_agent_update(self): - instance_ref, network_info = self._get_running_instance() - self.connection.agent_update(instance_ref, 'http://www.openstack.org/', - 'd41d8cd98f00b204e9800998ecf8427e') - @catch_notimplementederror def test_resume_state_on_host_boot(self): instance_ref, network_info = self._get_running_instance() diff --git a/nova/virt/driver.py b/nova/virt/driver.py index 4e821eab2762..262c4c3ef53c 100644 --- a/nova/virt/driver.py +++ b/nova/virt/driver.py @@ -539,19 +539,6 @@ class ComputeDriver(object): """ pass - def agent_update(self, instance, url, md5hash): - """ - Update agent on the specified instance. - - The first parameter is an instance of nova.compute.service.Instance, - and so the instance is being specified as instance.name. The second - parameter is the URL of the agent to be fetched and updated on the - instance; the third is the md5 hash of the file for verification - purposes. - """ - # TODO(Vek): Need to pass context in for access to auth_token - raise NotImplementedError() - def inject_network_info(self, instance, nw_info): """inject network info for specified instance""" # TODO(Vek): Need to pass context in for access to auth_token diff --git a/nova/virt/fake.py b/nova/virt/fake.py index cf143480bb47..0e5443074ecd 100644 --- a/nova/virt/fake.py +++ b/nova/virt/fake.py @@ -114,9 +114,6 @@ class FakeDriver(driver.ComputeDriver): def inject_file(self, instance, b64_path, b64_contents): pass - def agent_update(self, instance, url, md5hash): - pass - def resume_state_on_host_boot(self, context, instance, network_info): pass