Removed NIC radiobox dvorak42-other 0.1.41
authorSteven Valdez <dvorak42@mit.edu>
Wed, 4 Sep 2013 02:53:24 +0000 (22:53 -0400)
committerSteven Valdez <dvorak42@mit.edu>
Wed, 4 Sep 2013 02:53:24 +0000 (22:53 -0400)
code/controls.py
code/main.py
code/templates/functions.mako
code/templates/info.mako
code/templates/list.mako
code/validation.py
debian/changelog

index 0acca3a..a5f1693 100644 (file)
@@ -94,7 +94,7 @@ def bootMachine(machine, cdtype):
         raise CodeError('"%s" on "control %s create %s' 
                         % (err, machine.name, cdtype))
 
-def createVm(username, state, owner, contact, name, description, memory, disksize, machine_type, nic_type, cdrom, autoinstall):
+def createVm(username, state, owner, contact, name, description, memory, disksize, machine_type, cdrom, autoinstall):
     """Create a VM and put it in the database"""
     # put stuff in the table
     session.begin()
@@ -119,7 +119,6 @@ def createVm(username, state, owner, contact, name, description, memory, disksiz
                             "Contact %s." % config.contact)
         nic.machine = machine
         nic.hostname = name
-        nic.nic_type = nic_type
         session.add(nic)
         session.add(disk)
         cache_acls.refreshMachine(machine)
index 797f33b..b712696 100755 (executable)
@@ -156,11 +156,6 @@ ParaVM machines do not support local console access over VNC.  To
 access the serial console of these machines, you can SSH with Kerberos
 to %s, using the name of the machine as your
 username.""" % config.console.hostname,
-            'Network Device': """
-While we recommend you use the Intel e1000 NIC, we've provided you the
-option of using the AMD PCnet NIC if you are using an old enough OS
-that doesn't have support for the e1000 NIC.
-""",
             'HVM/ParaVM': """
 HVM machines use the virtualization features of the processor, while
 ParaVM machines rely on a modified kernel to communicate directly with
@@ -217,7 +212,7 @@ console will suffer artifacts.
 
     def parseCreate(self, fields):
         kws = dict([(kw, fields[kw]) for kw in
-         'name description owner memory disksize vmtype cdrom nictype autoinstall'.split()
+         'name description owner memory disksize vmtype cdrom autoinstall'.split()
                     if fields[kw]])
         validate = validation.Validate(cherrypy.request.login,
                                        cherrypy.request.state,
@@ -226,7 +221,6 @@ console will suffer artifacts.
                     description=validate.description, memory=validate.memory,
                     disksize=validate.disksize, owner=validate.owner,
                     machine_type=getattr(validate, 'vmtype', Defaults.type),
-                    nic_type=getattr(validate, 'nictype', Defaults.nic),
                     cdrom=getattr(validate, 'cdrom', None),
                     autoinstall=getattr(validate, 'autoinstall', None))
 
@@ -409,7 +403,6 @@ class Defaults:
     description = ''
     administrator = ''
     type = 'linux-hvm'
-    nic = 'e1000'
 
     def __init__(self, max_memory=None, max_disk=None, **kws):
         if max_memory is not None:
@@ -495,7 +488,6 @@ def getNicInfo(data_dict, machine):
     nic_fields_template = [('nic%s_hostname', 'NIC %s Hostname'),
                            ('nic%s_mac', 'NIC %s MAC Addr'),
                            ('nic%s_ip', 'NIC %s IP'),
-                           ('nic%s_type', 'NIC %s Type'),
                            ]
     nic_fields = []
     for i in range(len(machine.nics)):
@@ -503,7 +495,6 @@ def getNicInfo(data_dict, machine):
         data_dict['nic%s_hostname' % i] = getHostname(machine.nics[i])
         data_dict['nic%s_mac' % i] = machine.nics[i].mac_addr
         data_dict['nic%s_ip' % i] = machine.nics[i].ip
-        data_dict['nic%s_type' % i] = machine.nics[i].nic_type
     if len(machine.nics) == 1:
         nic_fields = [(x, y.replace('NIC 0 ', '')) for x, y in nic_fields]
     return nic_fields
@@ -543,10 +534,6 @@ def modifyDict(username, state, machine_id, fields):
         if hasattr(validate, 'memory'):
             machine.memory = validate.memory
 
-        if hasattr(validate, 'nictype'):
-            for i in range(len(machine.nics)):
-                machine.nics[i] = validate.nictype
-
         if hasattr(validate, 'vmtype'):
             machine.type = validate.vmtype
 
@@ -676,7 +663,6 @@ def infoDict(username, state, machine):
     for name in 'machine_id name description administrator owner memory contact'.split():
         if getattr(machine, name):
             setattr(defaults, name, getattr(machine, name))
-    defaults.nic = machine.nics[0].nic_type
     defaults.type = machine.type.type_id
     defaults.disk = "%0.2f" % (machine.disks[0].size/1024.)
     d = dict(user=username,
index a6fdbe3..7b46a35 100644 (file)
@@ -32,14 +32,6 @@ ${databaseList(sorted(database.Autoinstall.query, key=lambda x: x.description),
 % endfor
 </%def>
 
-<%def name="nicTypeList(default=None)">
-% for nictype in (('e1000', 'Intel e1000'), ('pcnet', 'AMD PCNet'), ):
-<label>
-   <input ${'checked="checked"' if default == vmtype[0] else '' | n} type="radio" name="nictype" id="nictype-${nictype[0]}" value="${nictype[0]}" />${nictype[1]}
-</label>
-% endfor
-</%def>
-
 <%def name="errorRow(value, err)">
 % if err and err.err_field == value:
 <tr>
index 303dd60..1fb4284 100644 (file)
@@ -81,13 +81,6 @@ ${self.fn.errorRow('contact', err)}
 % if not on:
     <tr><td>Machine Name:</td><td><input type="text" name="name" value="${defaults.name}"/>.${config.dns.domains[0]}</td></tr>
 ${self.fn.errorRow('name', err)}
-        <tr>
-          <td>Network Device${self.fn.helppopup('Network Device')}</td>
-          <td>
-         ${self.fn.nicTypeList(defaults.nic)}
-         </td>
-    </tr>
-${self.fn.errorRow('nictype', err)}
     <tr>
       <td>HVM/ParaVM${self.fn.helppopup('HVM/ParaVM')}</td>
       <td>${self.fn.vmTypeList(defaults.type)}</td>
index 9807265..777134f 100644 (file)
@@ -51,14 +51,6 @@ VM List
        </tr>
        ${self.fn.errorRow('disk', err)}
         <tr>
-          <td>Network Device${self.fn.helppopup('Network Device')}</td>
-          <td>
-         ${self.fn.nicTypeList(defaults.nic)}
-         </td>
-        </tr>
-       ${self.fn.errorRow('nictype', err)}
-
-        <tr>
           <td>HVM/ParaVM${self.fn.helppopup('HVM/ParaVM')}</td>
           <td>
          ${self.fn.vmTypeList(defaults.type)}
index 4782fdb..26a49a3 100755 (executable)
@@ -16,7 +16,7 @@ MIN_DISK_SINGLE = 0.1
 class Validate:
     def __init__(self, username, state, machine_id=None, name=None, description=None, owner=None,
                  admin=None, contact=None, memory=None, disksize=None,
-                 vmtype=None, nictype=None, cdrom=None, autoinstall=None, strict=False):
+                 vmtype=None, cdrom=None, autoinstall=None, strict=False):
         # XXX Successive quota checks aren't a good idea, since you
         # can't necessarily change the locker and disk size at the
         # same time.
@@ -56,8 +56,6 @@ class Validate:
             self.disksize = validDisk(self.owner, state, disksize, machine)
         if vmtype is not None:
             self.vmtype = validVmType(vmtype)
-        if nictype is not None:
-            self.nictype = validNICType(nictype)
         if cdrom is not None:
             if not CDROM.query.get(cdrom):
                 raise CodeError("Invalid cdrom type '%s'" % cdrom)
@@ -189,14 +187,6 @@ def validVmType(vm_type):
         raise CodeError("Invalid vm type '%s'"  % vm_type)
     return t
 
-def validNICType(nic_type):
-    if nic_type is None:
-        return None
-    t = nic_type
-    if not (t is "e1000" or t is "pcnet"):
-        raise CodeError("Invalid nic type '%s'"  % nic_type)
-    return t
-
 def testMachineId(user, state, machine_id, exists=True):
     """Parse, validate and check authorization for a given user and machine.
 
index f804f47..26a7fa2 100644 (file)
@@ -1,3 +1,9 @@
+invirt-web (0.1.41) precise; urgency=low
+
+  * Removed NIC radiobox code.
+
+ -- Steven Valdez <dvorak42@mit.edu>  Tue, 03 Sep 2013 22:44:10 -0400
+
 invirt-web (0.1.40) precise; urgency=low
 
   * Added nc into repo.