Commit 1d2550c7 by Bach Dániel

Merge branch 'fix-set_hostname' into 'master'

Fix Set Hostname
parents 2b450c1f 99602bbd
...@@ -10,8 +10,9 @@ ...@@ -10,8 +10,9 @@
</h3> </h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
{% blocktrans with owner=instance.owner fqdn=instance.primary_host %} {% blocktrans with owner=instance.owner name=instance.name id=instance.id%}
{{ owner }} offered to take the ownership of virtual machine {{fqdn}}. <strong>{{ owner }}</strong> offered to take the ownership of
virtual machine <strong>{{name}} ({{id}})</strong>.
Do you accept the responsility of being the host's owner? Do you accept the responsility of being the host's owner?
{% endblocktrans %} {% endblocktrans %}
<div class="pull-right"> <div class="pull-right">
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<i class="fa {{ i.get_status_icon }}" title="{{ i.get_status_display }}"></i> <i class="fa {{ i.get_status_icon }}" title="{{ i.get_status_display }}"></i>
{{ i.name }} {{ i.name }}
</span> </span>
<small class="text-muted"> {{ i.primary_host.hostname }}</small> <small class="text-muted"> {{ i.short_hostname }}</small>
<div class="pull-right dashboard-vm-favourite" data-vm="{{ i.pk }}"> <div class="pull-right dashboard-vm-favourite" data-vm="{{ i.pk }}">
{% if i.fav %} {% if i.fav %}
<i class="fa fa-star text-primary title-favourite" title="{% trans "Unfavourite" %}"></i> <i class="fa fa-star text-primary title-favourite" title="{% trans "Unfavourite" %}"></i>
......
...@@ -1883,7 +1883,7 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView): ...@@ -1883,7 +1883,7 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
'pk': i.pk, 'pk': i.pk,
'name': i.name, 'name': i.name,
'icon': i.get_status_icon(), 'icon': i.get_status_icon(),
'host': "" if not i.primary_host else i.primary_host.hostname, 'host': i.short_hostname,
'status': i.get_status_display(), 'status': i.get_status_display(),
'fav': i.pk in favs, 'fav': i.pk in favs,
} for i in instances] } for i in instances]
......
...@@ -2114,13 +2114,14 @@ msgstr "Átruházás" ...@@ -2114,13 +2114,14 @@ msgstr "Átruházás"
#, python-format #, python-format
msgid "" msgid ""
"\n" "\n"
" %(owner)s offered to take the ownership of virtual machine " " <strong>%(owner)s</strong> offered to take the ownership of\n"
"%(fqdn)s.\n" " virtual machine <strong>%(name)s (%(id)s)</strong>.\n"
" Do you accept the responsility of being the host's owner?\n" " Do you accept the responsility of being the host's owner?\n"
" " " "
msgstr "" msgstr ""
"\n" "\n"
" %(owner)s kezdeményezte a(z) %(fqdn)s virtuális gép átruházását.\n" " <strong>%(owner)s</strong> kezdeményezte a(z) <strong>%(name)s\n"
" (%(id)s)</strong> virtuális gép átruházását.\n"
" Elfogadja a gép birtoklásával járó felelősséget?\n" " Elfogadja a gép birtoklásával járó felelősséget?\n"
" " " "
......
...@@ -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