From 79420db5c9aa2d29c78058a38a82a5fa049bf1e8 Mon Sep 17 00:00:00 2001
From: John Garbutt <john.garbutt@rackspace.com>
Date: Thu, 25 Jul 2013 15:36:24 +0100
Subject: [PATCH] xenapi: remove propagate xenapi_use_agent key

The compute.api class will already propagate then xenapi_use_agent key
when required, so we can remove the xenapi specific code that tries to
propagate this value. The code did not correctly access the system
metadata, would have failed to propagate the key anyway.

Fixes bug 1204933
Change-Id: Ib291a265318d80705129e565155d4250fd704b75
---
 nova/tests/virt/xenapi/image/test_glance.py | 5 ++---
 nova/virt/xenapi/image/glance.py            | 5 -----
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/nova/tests/virt/xenapi/image/test_glance.py b/nova/tests/virt/xenapi/image/test_glance.py
index 81c17ad8d335..7459b2216cef 100644
--- a/nova/tests/virt/xenapi/image/test_glance.py
+++ b/nova/tests/virt/xenapi/image/test_glance.py
@@ -51,7 +51,7 @@ class TestGlanceStore(stubs.XenAPITestBase):
                 vm_utils, 'get_sr_path', lambda *a, **kw: '/fake/sr/path')
 
         self.instance = {'uuid': 'blah',
-                         'system_metadata': {'image_xenapi_use_agent': 'true'},
+                         'system_metadata': [],
                          'auto_disk_config': True,
                          'os_type': 'default',
                          'xenapi_use_agent': 'true'}
@@ -86,8 +86,7 @@ class TestGlanceStore(stubs.XenAPITestBase):
                   'sr_path': '/fake/sr/path',
                   'auth_token': 'foobar',
                   'properties': {'auto_disk_config': True,
-                                 'os_type': 'default',
-                                 'xenapi_use_agent': 'true'}}
+                                 'os_type': 'default'}}
         return params
 
     def test_upload_image(self):
diff --git a/nova/virt/xenapi/image/glance.py b/nova/virt/xenapi/image/glance.py
index 86c5d0bb297f..59930a69e53a 100644
--- a/nova/virt/xenapi/image/glance.py
+++ b/nova/virt/xenapi/image/glance.py
@@ -17,7 +17,6 @@ from oslo.config import cfg
 
 from nova import exception
 from nova.image import glance
-from nova.virt.xenapi import agent
 from nova.virt.xenapi import vm_utils
 
 CONF = cfg.CONF
@@ -61,10 +60,6 @@ class GlanceStore(object):
         props['auto_disk_config'] = instance['auto_disk_config']
         props['os_type'] = instance['os_type'] or CONF.default_os_type
 
-        sys_meta = instance["system_metadata"]
-        if agent.USE_AGENT_SM_KEY in sys_meta:
-            props[agent.USE_AGENT_KEY] = sys_meta[agent.USE_AGENT_SM_KEY]
-
         try:
             self._call_glance_plugin(session, 'upload_vhd', params)
         except exception.PluginRetriesExceeded: