Example #1
0
                         $machine->{$slot} = $hdd;
                         $machine->{$slot}->autoreset = TRUE;
                     } else {
                         $machine->{$slot} = $hdd->duplicate();
                     }
                 }
                 break;
         }
         // set dvd
         if (boolParam('dvdenabled')) {
             if ($slot != 'ide0') {
                 $slot = 'ide0';
             } else {
                 $slot = 'ide1';
             }
             $machine->{$slot} = dvdParam('dvd');
         }
         // set fdd
         if (boolParam('fddenabled')) {
             $machine->fd0 = fddParam('fdd');
         }
         // set nic
         $machine->nic0 = array('type' => 'bridged', 'driver' => '82545EM', 'adapter' => 'eth0', 'connected' => 'on');
         header('Location: machine.php?machine=' . $machine->id);
         exit;
     }
     break;
 case 'import':
     $machine = Repository::importMachine(stringParam('file'));
     if ($machine && $machine->exists()) {
         header('Location: machine.php?machine=' . $machine->id);
Example #2
0
         if (is_a($sata, 'HDD')) {
             if ($sata->type != 'multiattach') {
                 $sata->destroy();
             }
         }
     }
     if ($machine->destroy()) {
         header('Location: index.php');
         exit;
     }
 case 'set':
     // mount
     foreach (arrayParam('slot') as $slot) {
         switch (stringParam($slot)) {
             case 'dvd':
                 $machine->{$slot} = dvdParam('dvd_' . $slot);
                 break;
             case 'fdd':
                 $machine->{$slot} = fddParam('fdd_' . $slot);
                 break;
             case 'hdd':
                 $machine->{$slot} = hddParam('hdd_' . $slot);
                 break;
             default:
                 $machine->{$slot} = NULL;
                 break;
         }
     }
     if ($machine->state == 'poweroff') {
         // network
         foreach (arrayParam('net') as $net) {