Remove the hostname as separate from machine name.
authorEric Price <ecprice@mit.edu>
Mon, 29 Oct 2007 03:27:32 +0000 (23:27 -0400)
committerEric Price <ecprice@mit.edu>
Mon, 29 Oct 2007 03:27:32 +0000 (23:27 -0400)
svn path=/trunk/web/; revision=227

templates/info.tmpl
templates/list.tmpl
templates/main.py

index c84e8eb..c0ff1ff 100644 (file)
@@ -68,10 +68,6 @@ $errorRow('owner', $err)
 $errorRow('administrator', $err)
     <tr><td>Contact email:</td><td><input type="text" name="contact" value="$defaults.contact"/></td></tr>
 $errorRow('contact', $err)
-#if $machine.nics
-    <tr><td>Hostname:</td><td><input type="text" name="hostname" value="$defaults.hostname"/>.servers.csail.mit.edu</td></tr>
-#end if
-$errorRow('hostname', $err)
 #if not $on
     <tr><td>Machine Name:</td><td><input type="text" name="name" value="$defaults.name"/></td></tr>
 $errorRow('name', $err)
index 50022b2..67cefdc 100644 (file)
@@ -65,10 +65,8 @@ $errorRow('cdrom', $err)
 #if $machine.nics
 #set $nic = $machine.nics[0]
        <td>$nic.ip</td>
-       <td>$nic.hostname</td>
 #else
        <td></td>
-       <td></td>
 #end if
 <td>#slurp
 #if $machine.uptime
@@ -104,7 +102,6 @@ $has_vnc[$machine]
        <td>Memory</td>
        <td>owner</td>
        <td>IP</td>
-       <td>Hostname</td>
        <td>Uptime</td>
        <td>VNC</td>
        <td></td>
index cc8c3d8..7e92c8b 100755 (executable)
@@ -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(),