示例#1
0
                         $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);
         exit;
     }
     break;
示例#2
0
                 break;
         }
     }
     if ($machine->state == 'poweroff') {
         // network
         foreach (arrayParam('net') as $net) {
             $machine->{$net} = array('type' => stringParam($net . '_type', 'none'), 'driver' => stringParam($net . '_driver', '82543GC'), 'mac' => str_replace(':', '', stringParam($net . '_mac', 'auto')), 'adapter' => stringParam($net . '_adapter', FALSE), 'connected' => 'on');
         }
         // options
         $values = array('name' => stringParam('name', 'vbox-' . time()), 'ostype' => stringParam('ostype'), 'cpus' => intParam('cpus', 1), 'memory' => intParam('memory', 512), 'vram' => intParam('vram', 12), 'vrde' => boolParam('vrde'), 'vrdeaddress' => stringParam('vrdeaddress', '0.0.0.0'), 'vrdeport' => intParam('vrdeport', 3389));
         foreach (Machine::$vm as $name) {
             $values[$name] = boolParam($name);
         }
         $machine->set($values);
     } else {
         if ($machine->enableVRDE(boolParam('vrde'))) {
             header('Location: machine.php?machine=' . $machine->id);
             exit;
         }
     }
     break;
 case 'export':
     if ($machine->export()) {
         header('Location: machine.php?machine=' . $machine->id);
         exit;
     }
     break;
 case 'extract':
     $slot = stringParam('slot');
     $hdd = $machine->{$slot};
     if (is_a($hdd, 'HDD')) {