コード例 #1
0
                             $ret = $lv->domain_change_xml($domName, $_POST['xmldesc']) ? "Domain definition has been changed" : 'Error changing domain definition: ' . $lv->get_last_error();
                         } else {
                             $ret = 'Editing domain XML description: <br /><br /><form method="POST"><table><tr><td>Domain 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 = "Domain XML for domain <i>{$domName}</i>:<br /><br />" . htmlentities($xml);
                     }
                 }
             }
         }
     }
 }
 $doms = $lv->get_domains();
 $domkeys = array_keys($doms);
 echo "<table>\n\t\t\t   <tr>\n\t\t\t\t<th>Name</th>\n\t\t\t\t<th>CPU#</th>\n\t\t\t\t<th>Memory</th>\n\t\t\t\t<th>Disk(s)</th>\n\t\t\t\t<th>NICs</th>\n\t\t\t\t<th>Arch</th>\n\t\t\t\t<th>State</th>\n\t\t\t\t<th>ID / VNC port</th>";
 if ($tmp['active'] > 0 && $lv->supports('screenshot')) {
     echo "\n\t\t\t\t<th>Domain screenshot</th>\n\t\t\t\t";
 }
 echo "\n\t\t\t\t<th>Action</th>\n\t\t\t  </tr>";
 $active = $tmp['active'];
 for ($i = 0; $i < sizeof($doms); $i++) {
     $name = $doms[$i];
     $res = $lv->get_domain_by_name($name);
     $uuid = libvirt_domain_get_uuid_string($res);
     $dom = $lv->domain_get_info($name);
     $mem = number_format($dom['memory'] / 1024, 2, '.', ' ') . ' MB';
     $cpu = $dom['nrVirtCpu'];
     $state = $lv->domain_state_translate($dom['state']);
     $id = $lv->domain_get_id($res);
     $arch = $lv->domain_get_arch($res);
     $vnc = $lv->domain_get_vnc_port($res);