Parcourir la source

修正创建自定义模板镜像时,进度收尾 bug

James Iter il y a 8 ans
Parent
commit
175b6d011b
2 fichiers modifiés avec 2 ajouts et 5 suppressions
  1. 1 1
      api/snapshot.py
  2. 1 4
      models/event_processor.py

+ 1 - 1
api/snapshot.py

@@ -371,7 +371,7 @@ def r_convert_to_os_template_image(snapshot_id, disk_uuid):
             'snapshot_path': disk.path,
             'snapshot_path': disk.path,
             'template_path': os_template_image.path,
             'template_path': os_template_image.path,
             'os_template_image_id': os_template_image.id,
             'os_template_image_id': os_template_image.id,
-            'passback_parameters': {'id': snapshot.snapshot_id}
+            'passback_parameters': {'id': snapshot.snapshot_id, 'os_template_image_id': os_template_image.id}
         }
         }
 
 
         Utils.emit_instruction(message=json.dumps(message, ensure_ascii=False))
         Utils.emit_instruction(message=json.dumps(message, ensure_ascii=False))

+ 1 - 4
models/event_processor.py

@@ -313,10 +313,7 @@ class EventProcessor(object):
                 cls.snapshot.progress = 100
                 cls.snapshot.progress = 100
                 cls.snapshot.update()
                 cls.snapshot.update()
 
 
-                cls.guest.uuid = cls.snapshot.guest_uuid
-                cls.guest.get_by('uuid')
-
-                cls.os_template_image.id = cls.guest.os_template_image_id
+                cls.os_template_image.id = cls.message['message']['passback_parameters']['os_template_image_id']
                 cls.os_template_image.get()
                 cls.os_template_image.get()
 
 
                 if state == ResponseState.success.value:
                 if state == ResponseState.success.value: