2018-09-28 01:33:48 +08:00
|
|
|
<?php
|
|
|
|
Header("Content-type: text/plain");
|
2018-10-10 02:12:21 +08:00
|
|
|
// Include Libvirt libraries
|
2018-09-28 01:33:48 +08:00
|
|
|
include("libvirt/libvirt.php");
|
2018-10-10 02:12:21 +08:00
|
|
|
// Instantiation Libvirt
|
2018-09-28 01:33:48 +08:00
|
|
|
$Libvirt = new Libvirt();
|
2018-10-10 02:12:21 +08:00
|
|
|
// Connect to 192.168.3.181:22 and set libvirt root at /data/libvirt/
|
2018-09-28 01:33:48 +08:00
|
|
|
$Libvirt->setHost("192.168.3.181", 22, "/data/libvirt/");
|
2018-10-10 02:12:21 +08:00
|
|
|
// Use the username 'root' and the password '123456' login to server.
|
2018-09-28 01:33:48 +08:00
|
|
|
$Libvirt->connect("root", "123456");
|
2018-10-10 02:12:21 +08:00
|
|
|
// Print the virtual machine centos's config file.
|
|
|
|
echo $Libvirt->dumpxml("centos");
|