Commit 0f33e9ae by Bach Dániel

agent: use instance.short_hostname in send_init_commands()

closes #263
parent 2b450c1f
...@@ -613,6 +613,13 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin, ...@@ -613,6 +613,13 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
except: except:
return return
@property
def short_hostname(self):
try:
return self.primary_host.hostname
except AttributeError:
return self.vm_name
def get_vm_desc(self): def get_vm_desc(self):
"""Serialize Instance object to vmdriver. """Serialize Instance object to vmdriver.
""" """
......
...@@ -46,7 +46,7 @@ def send_init_commands(instance, act): ...@@ -46,7 +46,7 @@ def send_init_commands(instance, act):
with act.sub_activity('set_hostname', with act.sub_activity('set_hostname',
readable_name=ugettext_noop('set hostname')): readable_name=ugettext_noop('set hostname')):
set_hostname.apply_async( set_hostname.apply_async(
queue=queue, args=(vm, instance.primary_host.hostname)) queue=queue, args=(vm, instance.short_hostname))
def send_networking_commands(instance, act): def send_networking_commands(instance, act):
......
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