{"id":400,"date":"2015-10-29T16:08:45","date_gmt":"2015-10-29T08:08:45","guid":{"rendered":"https:\/\/drho.club\/?p=400"},"modified":"2015-10-29T16:08:45","modified_gmt":"2015-10-29T08:08:45","slug":"kvm-vm-quick-deployment","status":"publish","type":"post","link":"https:\/\/104.es\/index.php\/2015\/10\/29\/kvm-vm-quick-deployment\/","title":{"rendered":"\u5feb\u901f\u90e8\u7f72\u5927\u91cf\u865b\u64ec\u6a5f(VM)\u7684\u65b9\u6cd5"},"content":{"rendered":"<p style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: 12pt; line-height: 200%; letter-spacing: 2pt;\">\u900f\u904eKVM\u5efa\u7acb\u597d\u4e86\u865b\u64ec\u4e3b\u6a5f\u74b0\u5883\u4e4b\u5f8c\uff0c\u6709\u6642\u5019\u60f3\u8981\u77e5\u9053\u9019\u53f0Node\u4e0a\u9762\u7a76\u7adf\u53ef\u4ee5\u57f7\u884c\u5230\u591a\u5c11\u53f0VM\uff0c\u60f3\u8a66\u8a66\u770b\u5b83\u7684\u80fd\u8010\u5230\u5e95\u5982\u4f55\uff0c\u7576\u7136\u4e0d\u53ef\u80fd\u5f9evirt-manager\u4e0a\u4e00\u53f0\u4e00\u53f0\u5b89\u88dd\uff0c\u9019\u6a23\u592a\u6162\u4e86\u3002\u6700\u597d\u7684\u65b9\u5f0f\uff0c\u662f\u5c31\u73fe\u6709\u6b63\u5728\u57f7\u884c\u4e2d\u7684VM\uff0c\u8907\u88fd\u5b83\u7684image\u6a94\u6848\uff0c\u7136\u5f8c\u518d\u505a\u4e00\u4e9b\u53c3\u6578\u4e0a\u7684\u4fee\u6539\u5c31\u53ef\u4ee5\u4e86\u3002\u9019\u6a23\u505a\u96d6\u7136\u6bd4\u8f03\u5feb\uff0c\u4f46\u662f\u8981\u65b0\u589e3\u30014\u53f0\u7576\u7136\u6c92\u6709\u554f\u984c\uff0c\u53ef\u662f\u5982\u679c\u8981\u90e8\u7f7210\u300120\u6216\u751a\u81f3100\u53f0\u7684\u8a71\uff0c\u6c92\u6709\u81ea\u52d5\u5316\u4e0d\u53ea\u4e0d\u65b9\u4fbf\uff0c\u800c\u4e14\u4e5f\u5bb9\u6613\u51fa\u932f\u3002\u9019\u6642\u5019\uff0c\u900f\u904epython-libvirt\u7a0b\u5f0f\u5eab\u4f86\u81ea\u52d5\u5316\u90e8\u7f72\uff0c\u5c31\u662f\u975e\u5e38\u65b9\u4fbf\u7684\u9078\u64c7\u3002\uff08\u807d\u8aaa\u6709\u4e00\u4e9b\u5de5\u5177\u53ef\u4ee5\u7528\uff0c\u4f46\u662f\u7b46\u8005\u9084\u662f\u559c\u6b61\u81ea\u5df1\u52d5\u624b\u505a\uff09<\/p>\n<p style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: 12pt; line-height: 200%; letter-spacing: 2pt;\">\u5047\u8a2d\uff0c\u6211\u5011\u5df2\u7d93\u6709\u4e00\u53f0\u53eb\u505abase\u7684VM\uff0c\u5b83\u7684image\u6a94\u6848\u662fbase.raw\uff08\u8acb\u6ce8\u610f\uff0c\u6211\u5011\u5728\u9019\u88e1\u4f7f\u7528\u7684\u65b9\u6cd5\u4e00\u5b9a\u8981\u662fraw\u683c\u5f0f\uff0c\u539f\u56e0\u8acb\u53c3\u8003\u3010<a href=\"https:\/\/drho.club\/2015\/10\/mount-vm-partitions\/\" target=\"_blank\" rel=\"noopener\">\u639b\u8f09VM\u786c\u789f\u5206\u5272\u5340\u7684\u65b9\u6cd5<\/a>\u3011\uff09\uff0c\u5df2\u5b89\u88dd\u4e86\u53ef\u4ee5\u57f7\u884c\u7684Linux\u4f5c\u696d\u7cfb\u7d71\uff08\u76ee\u524d\u6211\u5011\u7684\u65b9\u6cd5\u50c5\u9069\u7528\u65bc\u4e3b\u6d41\u7684Linux\u4f5c\u696d\u7cfb\u7d71\uff09\uff0c\u6211\u5011\u7684\u76ee\u6a19\u662f\u57f7\u884c\u4e00\u500bPython\u7a0b\u5f0f\uff0c\u5b83\u53ef\u4ee5\u5e6b\u6211\u5011\u8907\u88fdbase.raw\uff08\u56e0\u6b64\uff0c\u5efa\u7acb\u51fa\u4f86\u7684\u865b\u64ec\u6a5f\u6703\u548cbase\u4e00\u6a21\u4e00\u6a23\uff09\uff0c\u4e26\u4e14\u4fee\u6539\u865b\u64ec\u6a5f\u7684\u540d\u7a31\u3001\u4e3b\u6a5f\u540d\u7a31\u4ee5\u53caMac Address\uff0c\u4e26\u4f7f\u7528\u6307\u5b9a\u7684\u540d\u5b57\u5efa\u7acb\u65b0\u7684\u865b\u64ec\u6a5f\u540c\u6642\u958b\u555f\u57f7\u884c\u7a0b\u5e8f\u3002\u4ee5\u4e0b\u4fbf\u662f\u5feb\u901f\u90e8\u7f72\u7684\u6b65\u9a5f\u3002<\/p>\n<p style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: 12pt; line-height: 200%; letter-spacing: 2pt;\">\u9996\u5148\uff0c\u4f9d\u7167\u73fe\u6709\u7684\u4e3b\u6a5f\u74b0\u5883\uff0c\u628abase\u9019\u500bDomain\u7684XML\u50be\u5370\u51fa\u4f86\uff0c\u6307\u4ee4\u5982\u4e0b\uff1a<\/p>\n<p>[code lang=&#8221;bash&#8221;]<br \/>\n# virsh dumpxml base &gt; base.xml<br \/>\n[\/code]<\/p>\n<p style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: 12pt; line-height: 200%; letter-spacing: 2pt;\">\u6b64base.xml\u5982\u679c\u662f\u6b63\u5728\u57f7\u884c\u4e2d\u7684domain\uff0c\u5247\u5728XML\u6a94\u6848\u4e2d\u6703\u6709id\uff0c\u9700\u522a\u9664\u6b64id\u3002\u6b64\u5916\uff0cuuid\u9019\u500b\u6a19\u7c64\u7684\u5167\u5bb9\u4e5f\u8981\u6574\u500b\u79fb\u9664\uff0c\u65b0\u7684XML\u6a94\u6848\u5982\u679c\u6c92\u6709\u6307\u5b9aUUID\uff0c\u5247libivirt\u6703\u81ea\u52d5\u6307\u4ee4\u4e00\u500b\u65b0\u7684\u3002<\/p>\n<p style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: 12pt; line-height: 200%; letter-spacing: 2pt;\">\u6709\u4e86base.xml\u4ee5\u53cabase.raw\uff0c\u5047\u8a2dbase.raw\u4f4d\u65bc\/var\/lib\/libvirt\/images\u4e4b\u4e0b\uff0c\u90a3\u9ebc\u6211\u5011\u7684Python\u7a0b\u5f0f\u8981\u505a\u7684\u4e8b\u60c5\u4e3b\u8981\u6709\u5982\u4e0b\u5e7e\u9ede\uff1a<\/p>\n<ol>\n<li style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: 12pt; line-height: 200%; letter-spacing: 2pt;\">\u8a2d\u5b9araw\u6a94\u6848\u7684\u6b63\u78ba\u8def\u5f91<\/li>\n<li style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: 12pt; line-height: 200%; letter-spacing: 2pt;\">\u8a2d\u5b9a\u8981\u5efa\u7acb\u7684\u865b\u64ec\u6a5f\u540d\u7a31\u6e05\u55ae\u5982[&#8216;vm01&#8217;, &#8216;vm02&#8217;, &#8216;vm03&#8217;]\uff0c\u653e\u5728vm_lists\u4e32\u5217\u4e2d\uff0c\u6b64\u4e32\u5217\u4e2d\u6709\u591a\u5c11\u7684\u5b57\u4e32\uff0c\u5c31\u5efa\u7acb\u591a\u5c11\u53f0\u865b\u64ec\u6a5f\uff0c\u800c\u4e14\u6bcf\u4e00\u53f0\u865b\u64ec\u6a5f\u7684\u540d\u7a31\u4ee5\u53ca\u4e3b\u6a5f\u540d\u7a31\u5747\u8a2d\u5b9a\u70ba\u6b64\u4e32\u5217\u4e2d\u7684\u5b57\u4e32\u540d\u7a31<\/li>\n<li style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: 12pt; line-height: 200%; letter-spacing: 2pt;\">\u9010\u4e00\u53d6\u51favm_lists\u4e2d\u7684\u5b57\u4e32\uff0c\u4ee5\u6b64\u5b57\u4e32\u8907\u88fdbase.raw\uff0c\u4f8b\u5982vm01.raw<\/li>\n<li style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: 12pt; line-height: 200%; letter-spacing: 2pt;\">\u4f7f\u7528kpartx\u6307\u4ee4\u639b\u8f09vm01.raw\uff0c\u7136\u5f8c\u627e\u51fa\/etc\/hostname\uff0c\u5c07\u4e3b\u6a5f\u540d\u7a31\u6539\u70bavm01<\/li>\n<li style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: 12pt; line-height: 200%; letter-spacing: 2pt;\">\u8b80\u5165base.xml\uff0c\u4fee\u6539&lt;name&gt;base&lt;\/name&gt;\u6210\u70ba&lt;name&gt;vm01&lt;\/name&gt;\uff0c\u540c\u6642\u4e5f\u8981\u4fee\u6539&lt;disk&gt;\u6a19\u7c64\u4e2dsource file\u7684\u4f4d\u7f6e\uff0c\u4f7f\u6210\u70ba\/var\/lib\/libvirt\/images\/vm01.raw\u3002\u6b64\u5916\uff0c&lt;mac&gt;\u6a19\u7c64\u4e2d\u7684address\u5c6c\u6027\u4e5f\u8981\u8a2d\u5b9a\u4e00\u500b\u65b0\u7684\uff08\u4f7f\u7528\u4e82\u6578\u7522\u751f\uff09\u3002\u7531\u65bc\u6211\u5011\u7684\u865b\u64ec\u6a5f\u8a2d\u5b9a\u662f\u4f7f\u7528DHCP\uff0c\u6240\u4ee5\u7db2\u8defIP\u4f4d\u5740\u7684\u90e8\u4efd\u53ef\u4ee5\u4e0d\u7528\u7406\u6703\u3002<\/li>\n<li style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: 12pt; line-height: 200%; letter-spacing: 2pt;\">RAW\u4ee5\u53caXML\u6a94\u6848\u5747\u6e96\u5099\u597d\u4e86\u4e4b\u5f8c\uff0c\u518d\u900f\u904econn.defineXML(xml)\u4f86\u5efa\u7acb\u865b\u64ec\u6a5f\u7684Domain\uff0c\u7136\u5f8c\u4f7f\u7528create\u4f86\u57f7\u884c\uff0c\u5c31\u5927\u529f\u544a\u6210\u4e86\u3002<\/li>\n<li style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: 12pt; line-height: 200%; letter-spacing: 2pt;\">\u7b2c3\u6b65\u5230\u7b2c6\u6b65\u91cd\u8907\u57f7\u884c\u5230vm_lists\u6e05\u55ae\u4e2d\u7684\u5b57\u4e32\u6e05\u7a7a\uff0c\u6240\u6709\u7684\u865b\u64ec\u6a5f\u5c31\u5b8c\u5168\u90e8\u7f72\u5b8c\u7562\u3002<\/li>\n<\/ol>\n<p style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: 12pt; line-height: 200%; letter-spacing: 2pt;\">\u5728\u90e8\u7f72\u7684\u904e\u7a0b\u4e2d\uff0c\u7531\u65bcRAW\u7684\u6a94\u6848\u90fd\u5f88\u5927\uff08\u4ee5\u7b46\u8005\u5be6\u9a57\u7528\u7684Lubuntu\u4f5c\u696d\u7cfb\u7d71\uff0c\u4e5f\u89815GB\uff09\uff0c\u6240\u4ee5\u5728\u8907\u88fdRAW\u6a94\u6848\u7684\u6642\u5019\u6703\u82b1\u6bd4\u8f03\u4e45\u7684\u6642\u9593\uff08\u7b46\u8005\u7684\u5be6\u9a57Intel B820 CPU\uff0c\u50b3\u7d71\u786c\u789f\uff0cCentOS 7\u4e2d\u8907\u88fd5GB\u5927\u7d04\u89812~3\u5206\u9418\uff09\uff0c\u53e6\u5916\u4f60\u8a2d\u5b9a\u865b\u64ec\u4e3b\u6a5f\u6578\u91cf\u6642\uff0c\u4e5f\u8981\u6ce8\u610f\u6240\u6709\u53ef\u7528\u7684\u786c\u789f\u7a7a\u9593\u662f\u5426\u8db3\u5920\uff08NFS\u63d0\u4f9b\u7684\u7a7a\u9593\uff09\u3002<\/p>\n<p style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: 12pt; line-height: 200%; letter-spacing: 2pt;\">\u9084\u6709\u4e00\u9ede\uff0c\u5728mount\u78c1\u5340\u5230\u5be6\u969b\u53ef\u4ee5\u4f7f\u7528\u4e2d\u9593\u9700\u8981\u4e00\u9ede\u6642\u9593\uff0c\u6240\u4ee5\u9069\u7576\u7684sleep\u6642\u9593\u662f\u9700\u8981\u7684\uff0c\u4e0d\u7136\u6703\u51fa\u73fe\u4e00\u4e9b\u6a94\u6848\u64cd\u4f5c\u7684\u932f\u8aa4\u3002\u4ee5\u4e0b\u5c31\u662f\u81ea\u52d5\u5316\u90e8\u7f72\u7684Python\u7a0b\u5f0f\u78bc\uff1a<\/p>\n<p>[code lang=&#8221;python&#8221;]<br \/>\n#! \/usr\/bin\/python <\/p>\n<p>import os, subprocess, sys, shutil, time<br \/>\nfrom sh import mount, umount<br \/>\nimport libvirt, random<br \/>\nimport xml.dom.minidom<\/p>\n<p>def getMAC():<br \/>\n\tmac = [ 0x00, 0x16,0x3e,<br \/>\n                random.randint(0x00, 0x7f),<br \/>\n                random.randint(0x00, 0xff),<br \/>\n                random.randint(0x00, 0xff) ]<br \/>\n        return &#8216;:&#8217;.join(map(lambda x: &quot;%02x&quot; % x , mac))<\/p>\n<p>def deploy_vm(base_raw, base_xml, vm_name, target_vm):<br \/>\n\tret = True<br \/>\n\tmac = getMAC()<br \/>\n\txmlfile = xml.dom.minidom.parse(base_xml)<br \/>\n\tdom_root = xmlfile.documentElement<\/p>\n<p>\tnewxml = dom_root.toxml()<br \/>\n\tname_tag = dom_root.getElementsByTagName(&#8216;name&#8217;)<br \/>\n\tname_tag[0].firstChild.data = vm_name<br \/>\n\tmac_tag = dom_root.getElementsByTagName(&#8216;mac&#8217;)<br \/>\n\tmac_tag[0].setAttribute(&#8216;address&#8217;, mac)<br \/>\n\tdisk_tag = dom_root.getElementsByTagName(&#8216;disk&#8217;)<br \/>\n\tfor disk in disk_tag:<br \/>\n\t\tif disk.getAttribute(&#8216;device&#8217;) == &#8216;disk&#8217;:<br \/>\n\t\t\tsource_tag = disk.getElementsByTagName(&#8216;source&#8217;)<br \/>\n\t\t\tsource_tag[0].setAttribute(&#8216;file&#8217;, target_vm)<br \/>\n\t\t\tbreak<br \/>\n\tnewxml = dom_root.toxml()<br \/>\n\tprint &quot;Coping the file: &quot; + target_vm<br \/>\n\tprint &quot;Please wait for serveral miniutes&#8230;&quot;<br \/>\n\tshutil.copyfile(base_rawfile, target_vm)<\/p>\n<p>\tprint &quot;Changing the hostname for %s&#8230;&quot; % vm_name<br \/>\n\tp = subprocess.Popen([&#8216;kpartx&#8217;, &#8216;-av&#8217;, target_vm],<br \/>\n\t\t\t\tstdout=subprocess.PIPE, stderr=subprocess.PIPE)<br \/>\n\tout, err = p.communicate()<br \/>\n\tparts = out.split()<br \/>\n\tmountp = &#8221;<br \/>\n\tfor str in parts:<br \/>\n\t\tif str.startswith(&quot;loop&quot;):<br \/>\n\t\t\tmountp = str<br \/>\n\t\t\tbreak<br \/>\n\ttarget_path = &#8216;\/mnt\/vm&#8217;<br \/>\n\tmount_path = &#8216;\/dev\/mapper\/&#8217; + mountp<\/p>\n<p>\tif os.path.exists(target_path):<br \/>\n\t\tif os.path.ismount(target_path):<br \/>\n\t\t\tumount(target_path)<br \/>\n\telse:<br \/>\n\t\tos.mkdir(target_path)<br \/>\n\ttime.sleep(10)<br \/>\n\tprint &quot;Try to mount the partition:&quot;, mount_path, target_path<br \/>\n\tmount(mount_path, target_path)<br \/>\n\twith open(&#8216;\/mnt\/vm\/etc\/hostname&#8217;, &#8216;w&#8217;) as hostname_file:<br \/>\n\t\thostname_file.write(vm_name)<br \/>\n\tumount(target_path)<br \/>\n\tremove_raw_mapper = &#8216;kpartx -d &#8216; + target_vm<br \/>\n\tsubprocess.call(remove_raw_mapper, shell=True)<br \/>\n#<br \/>\n# Create the new domain<br \/>\n#<br \/>\n\tdom = conn.defineXML(newxml)<br \/>\n\tdom.create()<br \/>\n\treturn ret<br \/>\n#<br \/>\n# start of main program<br \/>\n#<br \/>\n# VM settings<br \/>\n#<br \/>\nnew_vm_lists = [ &#8216;vm01&#8242;,&#8217;vm02&#8242;,&#8217;vm03&#8242;,&#8217;vm04&#8217;, &#8216;vm05&#8217; ]<br \/>\ncurrent_vm_lists = []<br \/>\nRAW_PATH = &#8216;\/var\/lib\/libvirt\/images\/&#8217;<br \/>\n#<br \/>\n# check the number of arguments<br \/>\n#<br \/>\nif len(sys.argv)&lt;2:<br \/>\n\tprint &quot;Usage: %s &lt;base_raw_image&gt; &lt;base_xml_file&gt;&quot; % sys.argv[0]<br \/>\n\tprint &quot;       File extension is not required.&quot;<br \/>\n\tprint &quot;Example: %s base base&quot; % sys.argv[0]<br \/>\n\texit(1)<\/p>\n<p>base_rawfile = RAW_PATH + sys.argv[1] + &quot;.raw&quot;<br \/>\nxml_file = os.path.abspath(sys.argv[2] + &quot;.xml&quot;)<br \/>\n#<br \/>\n# check the existence of the base file<br \/>\n#<br \/>\nif not os.path.exists(base_rawfile):<br \/>\n\tprint &quot; %s is not existing!&quot; % base_rawfile<br \/>\n\texit(1)<\/p>\n<p>if not os.path.exists(xml_file):<br \/>\n\tprint &quot; %s is not existing!&quot; % xml_file<br \/>\n\texit(1)<br \/>\n#<br \/>\n# collect all of the existing domains for checking the duplication<br \/>\n#<br \/>\nconn = libvirt.open(&quot;qemu:\/\/\/system&quot;)<br \/>\nalldomains = conn.listAllDomains()<\/p>\n<p>for dm in alldomains:<br \/>\n\tcurrent_vm_lists.append(dm.name())<\/p>\n<p>print &#8216;\\nBase image file is %s. &#8216; % base_rawfile<br \/>\nnew_vm_count = 0<br \/>\n#<br \/>\n# start to deploy the specified VMs<br \/>\n#<br \/>\nfor vm in new_vm_lists:<br \/>\n\tif any(vm in domain for domain in current_vm_lists):<br \/>\n\t\tprint &quot;The name %s you specified is already exist!&quot; % vm<br \/>\n\t\tcontinue<br \/>\n\telse:<br \/>\n\t\traw_filename =  RAW_PATH + vm + &#8216;.raw&#8217;<br \/>\n\t\tif os.path.exists(raw_filename):<br \/>\n\t\t\tprint &quot;The raw file &quot; + raw_filename + &quot; is exist&quot;<br \/>\n\t\t\tcontinue<br \/>\n#<br \/>\n# Everything is OK, and go to deploy the virtual machine<br \/>\n#<br \/>\n\tif deploy_vm(base_rawfile, xml_file, vm, raw_filename):<br \/>\n\t\tnew_vm_count += 1<\/p>\n<p>print &quot;Done!\\n %s Virtual Machines have been deployed!&quot; % new_vm_count<\/p>\n<p>[\/code]<\/p>\n<p style=\"font-family: \u5fae\u8edf\u6b63\u9ed1\u9ad4; font-size: 12pt; line-height: 200%; letter-spacing: 2pt;\">\u7531\u65bc\u662f\u81ea\u7528\uff0c\u6240\u4ee5\u5728\u7a0b\u5f0f\u4e2d\u7701\u7565\u4e86\u8a31\u591a\u7684\u932f\u8aa4\u6aa2\u67e5\uff0c\u5be6\u7528\u4e0a\u9084\u662f\u81ea\u884c\u52a0\u5165\u70ba\u5b9c\u3002\u4e82\u6578\u7522\u751fMac Address\u7684\u526f\u7a0b\u5f0f\uff0c\u53d6\u81ea\u9019\u500b\u7db2\u5740\uff1a<a href=\"https:\/\/www.centos.org\/docs\/5\/html\/5.2\/Virtualization\/sect-Virtualization-Tips_and_tricks-Generating_a_new_unique_MAC_address.html\" target=\"_blank\" rel=\"noopener\">randomMAC<\/a>\u3002\u6b64\u5916\uff0c\u5728\u7a0b\u5f0f\u4e2d\uff0c\u6211\u5011\u4f7f\u7528defineXML\u4f86\u5efa\u7acb\u6c38\u4e45\u7684Domain\uff0c\u5982\u679c\u4f60\u8981\u5efa\u7acb\u7684\u662f\u66ab\u6642\u7684Domain\uff0c\u5728shutdown\u4e4b\u5f8c\u5c31\u6703\u6d88\u5931\u7684\uff0c\u5247\u76f4\u63a5\u4f7f\u7528createXML\u51fd\u6578\u5373\u53ef\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u900f\u904eKVM\u5efa\u7acb\u597d\u4e86\u865b\u64ec\u4e3b\u6a5f\u74b0\u5883\u4e4b\u5f8c\uff0c\u6709\u6642\u5019\u60f3\u8981\u77e5\u9053\u9019\u53f0Node\u4e0a\u9762\u7a76\u7adf\u53ef\u4ee5\u57f7\u884c\u5230\u591a\u5c11\u53f0VM\uff0c\u60f3\u8a66\u8a66\u770b\u5b83\u7684\u80fd\u8010\u5230\u5e95\u5982\u4f55\uff0c\u7576\u7136\u4e0d\u53ef\u80fd\u5f9evirt-manager\u4e0a\u4e00\u53f0\u4e00\u53f0\u5b89\u88dd\uff0c\u9019\u6a23\u592a\u6162\u4e86\u3002\u6700\u597d\u7684\u65b9\u5f0f\uff0c\u662f\u5c31\u73fe\u6709\u6b63\u5728\u57f7\u884c\u4e2d\u7684VM\uff0c\u8907\u88fd\u5b83\u7684image\u6a94\u6848\uff0c\u7136\u5f8c\u518d\u505a\u4e00\u4e9b\u53c3\u6578\u4e0a\u7684\u4fee\u6539\u5c31\u53ef\u4ee5\u4e86\u3002\u9019\u6a23\u505a\u96d6\u7136\u6bd4\u8f03\u5feb\uff0c\u4f46\u662f\u8981\u65b0\u589e3\u30014\u53f0\u7576\u7136\u6c92\u6709\u554f\u984c\uff0c\u53ef\u662f\u5982\u679c\u8981\u90e8\u7f7210\u300120\u6216\u751a\u81f3100\u53f0\u7684\u8a71\uff0c\u6c92\u6709\u81ea\u52d5\u5316\u4e0d\u53ea\u4e0d\u65b9\u4fbf\uff0c\u800c\u4e14\u4e5f\u5bb9\u6613\u51fa\u932f\u3002\u9019\u6642\u5019\uff0c\u900f\u904epython-libvirt\u7a0b\u5f0f\u5eab\u4f86\u81ea\u52d5\u5316\u90e8\u7f72\uff0c\u5c31\u662f\u975e\u5e38\u65b9\u4fbf\u7684\u9078\u64c7\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[97,15,100],"tags":[167,207],"class_list":["post-400","post","type-post","status-publish","format-standard","hentry","category-kvm-libvirt","category-python","category-vm","tag-python-libvirt","tag-207"],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/posts\/400","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/comments?post=400"}],"version-history":[{"count":0,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/posts\/400\/revisions"}],"wp:attachment":[{"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/media?parent=400"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/categories?post=400"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/104.es\/index.php\/wp-json\/wp\/v2\/tags?post=400"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}