Merge "Add purge flag in image_meta_to_headers"
diff --git a/tempest/common/image.py b/tempest/common/image.py
index 72e3a72..95a7d1a 100644
--- a/tempest/common/image.py
+++ b/tempest/common/image.py
@@ -47,6 +47,11 @@
     fields_copy = copy.deepcopy(metadata)
 
     copy_from = fields_copy.pop('copy_from', None)
+    purge = fields_copy.pop('purge_props', None)
+
+    if purge is not None:
+        headers['x-glance-registry-purge-props'] = purge
+
     if copy_from is not None:
         headers['x-glance-api-copy-from'] = copy_from
 
diff --git a/tempest/tests/common/test_image.py b/tempest/tests/common/test_image.py
index 34772a2..240df4d 100644
--- a/tempest/tests/common/test_image.py
+++ b/tempest/tests/common/test_image.py
@@ -46,7 +46,8 @@
             disk_format='vhd',
             copy_from='http://localhost/images/10',
             properties={'foo': 'bar'},
-            api={'abc': 'def'})
+            api={'abc': 'def'},
+            purge_props=True)
 
         expected = {
             'x-image-meta-name': 'test',
@@ -54,6 +55,7 @@
             'x-image-meta-disk_format': 'vhd',
             'x-glance-api-copy-from': 'http://localhost/images/10',
             'x-image-meta-property-foo': 'bar',
-            'x-glance-api-property-abc': 'def'
+            'x-glance-api-property-abc': 'def',
+            'x-glance-registry-purge-props': True
         }
         self.assertEqual(expected, observed)