Просмотр исходного кода

Allow creating imsages from running instances

Test stats after this CL
========================
Ran 58 tests in 1482.346s

FAILED (SKIP=1, errors=25, failures=8)
Ehsan Chiniforooshan 8 лет назад
Родитель
Сommit
0b1f95b975
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      cloudbridge/cloud/providers/gce/resources.py

+ 4 - 2
cloudbridge/cloud/providers/gce/resources.py

@@ -957,10 +957,12 @@ class GCEInstance(BaseInstance):
                              .gce_compute
                              .images()
                              .insert(project=self._provider.project_name,
-                                     body=image_body)
+                                     body=image_body,
+                                     forceCreate=True)
                              .execute())
                 self._provider.wait_for_operation(operation)
-                return
+                img = self._provider.get_resource('images', name)
+                return GCEMachineImage(self._provider, img) if img else None
         cb.log.error('Failed to create image: no boot disk found.')
 
     def _get_existing_target_instance(self):