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 fa0b64b500, 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
			
			
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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())
 | 
			
		||||
 
 | 
			
		||||
@@ -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()
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user