Changeset 762 for trunk/packages


Ignore:
Timestamp:
Jul 28, 2008, 3:25:33 AM (16 years ago)
Author:
ecprice
Message:

Add autoinstall to sipb-database.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/sipb-xen-database/client/etc/xen/sipb-database

    r671 r762  
    1919machine = models.Machine.get_by(name=machine_name)
    2020check(machine is not None)
    21 hvm = machine.type.hvm
    22 if 'cdrom_image' in locals():
    23     hvm = True
     21machine_type = models.Type.get_by(type_id=machine.type_id)
    2422
    2523memory = machine.memory
     
    3533viftype = ""
    3634
    37 if hvm:
     35pae = machine_type.pae
     36acpi = machine_type.acpi
     37apic = machine_type.apic
     38
     39vif = []
     40
     41disk = []
     42
     43if machine_type.hvm:
     44    codepath = 'hvm'
     45else:
     46    codepath = 'paravm'
     47
     48if 'mirror' in locals(): #Installer
     49    disk.append('phy:/dev/xenvg/d_foobar4_hda,hdb,r')
     50
     51    kernel = '/boot/vmlinuz-2.6.24-19-xen' #From hardy
     52    ramdisk = '/boot/initrd.img-2.6.24-19-xen'
     53
     54    if not machine.nics:
     55        raise RuntimeError('You must have a nic to autoinstall')
     56    n = machine.nics[0]
     57    extra = 'ro noresume'
     58    extra += ' ip=%s::18.181.0.1:255.255.0.0:%s:eth0:off' % (n.ip, machine.name)
     59    extra += ' mirror=%s dist=%s' % (mirror, dist)
     60    extra += ' imagesize=%s' % imagesize
     61    #extra += ' noinstall'
     62    root = '/dev/hdb1'
     63    codepath = None
     64elif 'cdrom_image' in locals():
     65    check(re.match('^[A-Za-z0-9][A-Za-z0-9_.-]*$', cdrom_image))
     66    disk.append('file:/srv/images/' + cdrom_image + '.iso,hdc:cdrom,r')
     67    boot = 'd'
     68    codepath = 'hvm'
     69
     70if codepath == 'hvm':
    3871    ioemu = "ioemu:"
    3972    viftype = "type=ioemu, "
    40 
    4173    kernel = 'hvmloader'
    4274    builder = 'hvm'
     
    4476    vncpasswd = 'moocow'
    4577    device_model = '/usr/sbin/qemu-dm-sipb'
    46     serial = 'pty'
    47 else:
    48     kernel  = '/boot/vmlinuz-2.6.18-5-xen-amd64'
    49     ramdisk = '/boot/initrd.img-2.6.18-5-xen-amd64'
    50     builder = 'linux'
     78    serial = "pty"
     79elif codepath == 'paravm':
     80    bootloader = '/usr/lib/xen-default/bin/pygrub'
    5181
    52 pae = machine.type.pae
    53 acpi = machine.type.acpi
    54 apic = machine.type.apic
    55 
    56 vif = []
    5782
    5883for n in machine.nics:
     
    6186    vif.append(d)
    6287
    63 disk = []
    64 
    6588for d in machine.disks:
    6689    check(re.match('^[A-Za-z0-9]+$', d.guest_device_name))
     
    6891    dspec = 'phy:%s,%s%s,w' % (device, diskioemu, d.guest_device_name)
    6992    disk.append(dspec)
    70 
    71 if 'installer' in locals():
    72     check(re.match('^[A-Za-z0-9][A-Za-z0-9_.-]*$', installer))
    73     tmptree = tempfile.mkdtemp('', 'auto-install.', '/tmp')
    74     call(['/usr/sbin/sipb-xen-make-iso', installer, tmptree]
    75          + installer_options.split(' '))
    76     disk.append('file:'+tmptree+'/install.iso,hdc:cdrom,r')
    77     boot = 'd'
    78 
    79 elif 'disks' in locals(): # for the copying installer's use
    80     disk = disks.split(' ')
    81     boot = 'c'
    82 
    83 elif 'cdrom_image' in locals():
    84     check(re.match('^[A-Za-z0-9][A-Za-z0-9_.-]*$', cdrom_image))
    85     disk.append('file:/srv/images/' + cdrom_image + '.iso,hdc:cdrom,r')
    86     boot = 'd'
    8793
    8894usbdevice = 'tablet'
Note: See TracChangeset for help on using the changeset viewer.