$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)
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:
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"
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:
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(),