Commit 71162da5 by Karsa Zoltán István

fix bugs

parent 8b5c4576
...@@ -496,6 +496,7 @@ class Disk(TimeStampedModel): ...@@ -496,6 +496,7 @@ class Disk(TimeStampedModel):
disk.type = result['type'] disk.type = result['type']
disk.checksum = result['checksum'] disk.checksum = result['checksum']
disk.is_ready = True disk.is_ready = True
disk.ci_disk = False
disk.save() disk.save()
return disk return disk
......
...@@ -372,7 +372,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin, ...@@ -372,7 +372,7 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
@property @property
def get_meta_data(self): def get_meta_data(self):
data = str(self.ci_user_data).replace('{{hostname}}', self.short_hostname) data = str(self.ci_meta_data).replace('{{hostname}}', self.short_hostname)
return data return data
def _update_status(self): def _update_status(self):
......
...@@ -435,7 +435,7 @@ class DeployOperation(InstanceOperation): ...@@ -435,7 +435,7 @@ class DeployOperation(InstanceOperation):
self.instance.save() self.instance.save()
else: else:
self.instance.allocate_node() self.instance.allocate_node()
logger.debug(' - - valami - - ')
init_disk = None init_disk = None
try: try:
init_disk = self.instance.disks.get(ci_disk=True) init_disk = self.instance.disks.get(ci_disk=True)
...@@ -505,6 +505,10 @@ class DeployOperation(InstanceOperation): ...@@ -505,6 +505,10 @@ class DeployOperation(InstanceOperation):
disk.full_clean() disk.full_clean()
disk.save() disk.save()
self.instance.disks.add(disk) self.instance.disks.add(disk)
return create_readable(ugettext_noop(
" ---- META-DATA ----\n%(meta_data)s\n\n ---- USER-DATA ----\n%(user_data)s"),
meta_data=self.instance.get_meta_data,
user_data=self.instance.get_user_data)
@register_operation @register_operation
class DeployDisksOperation(SubOperationMixin, InstanceOperation): class DeployDisksOperation(SubOperationMixin, InstanceOperation):
...@@ -843,7 +847,7 @@ class SaveAsTemplateOperation(InstanceOperation): ...@@ -843,7 +847,7 @@ class SaveAsTemplateOperation(InstanceOperation):
'ci_meta_data': self.instance.ci_meta_data, 'ci_meta_data': self.instance.ci_meta_data,
'ci_user_data': self.instance.ci_user_data, 'ci_user_data': self.instance.ci_user_data,
} }
print(params)
params.update(kwargs) params.update(kwargs)
params.pop("parent_activity", None) params.pop("parent_activity", None)
...@@ -857,13 +861,14 @@ class SaveAsTemplateOperation(InstanceOperation): ...@@ -857,13 +861,14 @@ class SaveAsTemplateOperation(InstanceOperation):
self.disks = [] self.disks = []
for disk in self.instance.disks.all(): for disk in self.instance.disks.all():
with activity.sub_activity( if disk.ci_disk == False:
with activity.sub_activity(
'saving_disk', 'saving_disk',
readable_name=create_readable( readable_name=create_readable(
ugettext_noop("saving disk %(name)s"), ugettext_noop("saving disk %(name)s"),
name=disk.name) name=disk.name)
): ):
self.disks.append(__try_save_disk(disk)) self.disks.append(__try_save_disk(disk))
# create template and do additional setup # create template and do additional setup
tmpl = InstanceTemplate(**params) tmpl = InstanceTemplate(**params)
......
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