コード例 #1
0
     }
 } else {
     if ($action == 'virtual-networks') {
         echo "<h2>Networks</h2>";
         echo "This is the administration of virtual networks. You can see all the virtual network being available with their settings. Please make sure you're using the right network for the purpose you need to since using the isolated network between two or multiple guests is providing the sharing option but internet connectivity will be disabled. Please enable internet services only on the guests that are really requiring internet access for operation like e.g. HTTP server or FTP server but you don't need to put the internet access to the guest with e.g. MySQL instance or anything that might be managed from the web-site. For the scenario described you could setup 2 network, internet and isolated, where isolated network should be setup on both machine with Apache and MySQL but internet access should be set up just on the machine with Apache webserver with scripts to remotely connect to MySQL instance and manage it (using e.g. phpMyAdmin). Isolated network is the one that's having forwarding column set to None.";
         $ret = false;
         if ($subaction) {
             $name = $_GET['name'];
             if ($subaction == 'start') {
                 $ret = $lv->set_network_active($name, true) ? "Network has been started successfully" : 'Error while starting network: ' . $lv->get_last_error();
             } else {
                 if ($subaction == 'stop') {
                     $ret = $lv->set_network_active($name, false) ? "Network has been stopped successfully" : 'Error while stopping network: ' . $lv->get_last_error();
                 } else {
                     if ($subaction == 'dumpxml' || $subaction == 'edit') {
                         $xml = $lv->network_get_xml($name, false);
                         if ($subaction == 'edit') {
                             if (@$_POST['xmldesc']) {
                                 $ret = $lv->network_change_xml($name, $_POST['xmldesc']) ? "Network definition has been changed" : 'Error changing network definition: ' . $lv->get_last_error();
                             } else {
                                 $ret = 'Editing network XML description: <br /><br /><form method="POST"><table><tr><td>Network XML description: </td>' . '<td><textarea name="xmldesc" rows="25" cols="90%">' . $xml . '</textarea></td></tr><tr align="center"><td colspan="2">' . '<input type="submit" value=" Edit domain XML description "></tr></form>';
                             }
                         } else {
                             $ret = 'XML dump of network <i>' . $name . '</i>:<br /><br />' . htmlentities($lv->get_network_xml($name, false));
                         }
                     }
                 }
             }
         }
         echo "<h3>List of networks</h3>";
         $tmp = $lv->get_networks(VIR_NETWORKS_ALL);