Commit c5826e9f by Dudás Ádám

vm: add option to save instance as template with integrated shutdown

parent cb83f2ca
......@@ -815,11 +815,6 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
self.node = None
self.vnc_port = None
def shutdown_and_save_as_template(self, name, user=None, task_uuid=None,
**kwargs):
self.shutdown(user=user)
self.save_as_template(name, user=user, **kwargs)
def get_status_icon(self):
return {
'NOSTATE': 'icon-rocket',
......
......@@ -247,7 +247,11 @@ class SaveAsTemplateOperation(InstanceOperation):
Users can instantiate Virtual Machines from Templates.
""")
def _operation(self, activity, name, user, system, timeout=300, **kwargs):
def _operation(self, activity, name, user, system, timeout=300,
with_shutdown=True, **kwargs):
if with_shutdown:
ShutdownOperation(self.instance).call(parent_activity=activity,
user=user)
# prepare parameters
params = {
'access_method': self.instance.access_method,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment