From: Eric Price Date: Mon, 29 Oct 2007 03:27:32 +0000 (-0400) Subject: Remove the hostname as separate from machine name. X-Git-Tag: sipb-xen-www/1~40 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/commitdiff_plain/c3226455f0fd065757b681e2be52e8d8c2362ff8?ds=sidebyside Remove the hostname as separate from machine name. svn path=/trunk/web/; revision=227 --- diff --git a/templates/info.tmpl b/templates/info.tmpl index c84e8eb..c0ff1ff 100644 --- a/templates/info.tmpl +++ b/templates/info.tmpl @@ -68,10 +68,6 @@ $errorRow('owner', $err) $errorRow('administrator', $err) Contact email: $errorRow('contact', $err) -#if $machine.nics - Hostname:.servers.csail.mit.edu -#end if -$errorRow('hostname', $err) #if not $on Machine Name: $errorRow('name', $err) diff --git a/templates/list.tmpl b/templates/list.tmpl index 50022b2..67cefdc 100644 --- a/templates/list.tmpl +++ b/templates/list.tmpl @@ -65,10 +65,8 @@ $errorRow('cdrom', $err) #if $machine.nics #set $nic = $machine.nics[0] $nic.ip - $nic.hostname #else - #end if #slurp #if $machine.uptime @@ -104,7 +102,6 @@ $has_vnc[$machine] Memory owner IP - Hostname Uptime VNC diff --git a/templates/main.py b/templates/main.py index cc8c3d8..7e92c8b 100755 --- a/templates/main.py +++ b/templates/main.py @@ -258,15 +258,16 @@ def getNicInfo(data_dict, machine): of (key, name) pairs to display "name: data_dict[key]" to the user. """ data_dict['num_nics'] = len(machine.nics) - nic_fields_template = [('nic%s_hostname', 'NIC %s hostname'), + nic_fields_template = [('nic%s_hostname', 'NIC %s Hostname'), ('nic%s_mac', 'NIC %s MAC Addr'), ('nic%s_ip', 'NIC %s IP'), ] nic_fields = [] for i in range(len(machine.nics)): nic_fields.extend([(x % i, y % i) for x, y in nic_fields_template]) - data_dict['nic%s_hostname' % i] = (machine.nics[i].hostname + - '.servers.csail.mit.edu') + if not i: + data_dict['nic%s_hostname' % i] = (machine.name + + '.servers.csail.mit.edu') data_dict['nic%s_mac' % i] = machine.nics[i].mac_addr data_dict['nic%s_ip' % i] = machine.nics[i].ip if len(machine.nics) == 1: @@ -328,8 +329,6 @@ def modifyDict(user, fields): machine) contact = validation.testContact(user, fields.getfirst('contact'), machine) - hostname = validation.testHostname(owner, fields.getfirst('hostname'), - machine) name = validation.testName(user, fields.getfirst('name'), machine) oldname = machine.name command = "modify" @@ -348,12 +347,6 @@ def modifyDict(user, fields): disk.size = disksize ctx.current.save(disk) - # XXX first NIC gets hostname on change? - # Interface doesn't support more. - for nic in machine.nics[:1]: - nic.hostname = hostname - ctx.current.save(nic) - if owner is not None: machine.owner = owner if name is not None: @@ -512,8 +505,6 @@ def infoDict(user, machine): defaults = Defaults() for name in 'machine_id name administrator owner memory contact'.split(): setattr(defaults, name, getattr(machine, name)) - if machine.nics: - defaults.hostname = machine.nics[0].hostname defaults.disk = "%0.2f" % (machine.disks[0].size/1024.) d = dict(user=user, cdroms=CDROM.select(),