随笔分类 -  libvirt

摘要:/var/run/libvirt里面暂时为空的/var/lib/libvirt boot images network default虚拟网络的配置文件位于/var/lib/libvirt/network/default.xml,内容如下 qemu/etc/libvirt好像所有的配置文件 以及创建虚拟机的xml文件均放到这里了 阅读全文
posted @ 2012-02-20 20:26 zaleilynn 阅读(328) 评论(0) 推荐(0)
摘要:实例一 使用qemu-img命令使用快照 kvm环境下qcow2的镜像支持快照1 确认镜像的格式 [root@nc1 boss]# qemu-img info test.qcow2 image: test.qcow2 file format: qcow2 virtual size: 10G (10737418240 bytes) disk size: 1.6G cluster_size: 655362 为镜像test.qcow2创建快照,创建快照并没有产生新的镜像,虚拟机镜像大小增加,快照应属于镜像。 [root@nc1 boss]#qemu-img snapshot -c snapshot. 阅读全文
posted @ 2012-02-20 15:48 zaleilynn 阅读(863) 评论(4) 推荐(0)
摘要:$sudo apt-get install bridge-utils$sudo invoke-rc.d networking stop$sudo nano /etc/network/interfaces原来的文本内容可能只有下面部分:auto loiface lo inet loopback需要添加的内容根据你的网络情况而定,如果你的网络只需要从DHCP服务器中获得IP和服务,那么则在原有文本内容下添加一部分内容变成下面内容:auto loiface lo inet loopbackauto eth0iface eth0 inet manualauto br0iface br0 inet dh 阅读全文
posted @ 2012-02-15 13:44 zaleilynn 阅读(361) 评论(0) 推荐(0)
摘要:spanning tree protocol 生成树(spanning tree),即用两个网桥来连接两个相同的计算机网络段,是一项协议,允许网桥进行信息的交流,这样只需要其中一个网桥来处理两台计算机之间发送的信息。生成树协议(spanning tree protocol,STP)可以防止网桥环路的发生。The Spanning Tree Protocol (STP) is a network protocol that ensures a loop-free topology for any bridged Ethernet local area network. The basic fun 阅读全文
posted @ 2012-02-15 13:12 zaleilynn 阅读(313) 评论(0) 推荐(0)
摘要:想调研一下libvit xml能否提供类似的配置选项:xml应该写成这个样子,预先要在宿主机上面创建br0,配置要分配指定ipUsing an existing host bridgeSince 0.9.4 This shows how to use a pre-existing host bridge "br0". The guests will effectively be directly connected to the physical network (i.e. their IP addresses will all be on the subnet of th 阅读全文
posted @ 2012-02-15 12:45 zaleilynn 阅读(363) 评论(0) 推荐(0)
摘要:AddressingThe final set of elements define the addresses (IPv4 and/or IPv6, as well as MAC) to be assigned to the bridge device associated with the virtual network, and optionally enable DHCP services. These elements are only valid for isolated networks (no forward element specified), and for those 阅读全文
posted @ 2012-02-15 12:39 zaleilynn 阅读(1213) 评论(0) 推荐(0)
摘要:使用网桥br0 xml片断<interface type='bridge'> <mac address='00:11:22:33:44:55'/> <source bridge='br0'/></interface>使用virtio片段并禁用cache<disktype='file'device='disk'> <drivername='qemu'type='qcow2'cache='none'/> 阅读全文
posted @ 2012-02-15 10:02 zaleilynn 阅读(487) 评论(0) 推荐(0)
摘要:配置网络vim /etc/network/interface改为如下# This file describes the network interfaces available on your system# and how to activate them. For more information, see interfaces(5).# The loopback network interfaceauto loiface lo inet loopback# The primary network interfaceauto eth0iface eth0 inet manualauto b 阅读全文
posted @ 2012-02-14 14:04 zaleilynn 阅读(469) 评论(0) 推荐(0)
摘要:使用libvirt的xml配置文件创建虚拟机 kvm支持的镜像很多,常用的是原始镜像(*.img),还有支持动态大小扩张的qocw2格式(首选)。更优的选择是系统盘如C盘用img格式,数据盘用qcow2格式以减少服务器磁盘闲置空间。本文仅记录如何用ubuntu.iso制作系统镜像ubuntu.qcow2并创建启动虚拟机一、制作虚拟机镜像1、创建qcow2镜像,但是其实际占有磁盘大小仅为193K左右,而虚拟机内部显示磁盘大小为10G,也就是磁盘空间使用时才分配,即所谓动态扩张。 qemu-img create -f qcow2 ubuntu.qcow2 10G2、下载并复制ubuntu的iso镜 阅读全文
posted @ 2012-02-14 10:26 zaleilynn 阅读(994) 评论(0) 推荐(0)
摘要:指定cache方式<disk type='file' device='disk'><driver name='qemu' type='qcow2'cache='writeback'/><source file='/var/vms/vm2/ubuntu-kvm/tmphAUcOB.qcow2'/><target dev='hda' bus='ide'/></disk>http://libvirt.org/drv 阅读全文
posted @ 2012-02-14 10:06 zaleilynn 阅读(678) 评论(0) 推荐(0)
摘要:http://blog.csdn.net/whuqin/article/details/67328981.创建域(虚拟机):包括Volume和描述硬件配置的xml[java] view plaincopyprint?//前端与节点建立连接 Connectconn=newConnect("qemu+ssh://root@192.168.69/system",false);//根据xml描述创建新虚拟机并启动 SAXReaderreader=newSAXReader();Documentdocu=<spanstyle="white-space:pre" 阅读全文
posted @ 2012-02-14 10:03 zaleilynn 阅读(634) 评论(0) 推荐(0)
摘要:为什么要学习libvirt 中的XMLl Libvirt中配置虚拟机都是通过xml文件来配置的,如启动一个虚拟机需要的对虚拟机配置的描述就是通过XML来实现的。因此XML在libvirt管理虚拟机中有很重要的地位。Domain XML format1. 元素和属性概述根元素为所有虚拟机需要的是命名域。它有两个属性,第一个属性是指定Hypervisor的类型,如”Xen”,“KVM”,“qemu”,“lxc”和“kqemu”。第二个属性是id,运行的guest Domain 的ID,已停用的guest Domain有没有ID值。2. 通用元数据每个guest Domain都有它的名称,uuid 阅读全文
posted @ 2012-02-14 09:53 zaleilynn 阅读(1093) 评论(0) 推荐(0)
摘要:说明:这篇笔记为更好的管理虚拟化服务,如果仅仅是测试虚拟化,查看另一篇笔记:http://blog.chinaunix.net/space.php?uid=1838361&do=blog&id=234090补充:这篇笔记使用的libvirt版本为0.6.3,kernel为2.6.18-194.26.1.el5遇到了几个bug,建议首先升级kernel,然后升级libvirt,kvm。源:http://centos.ustc.edu.cn/centos/yum clean allyum makecache (一定要做)yum list kernel20110428:kernel 阅读全文
posted @ 2012-02-14 09:52 zaleilynn 阅读(2538) 评论(0) 推荐(0)
摘要:简介:Libvirt 库是一种实现 Linux 虚拟化功能的 Linux® API,它支持各种虚拟机监控程序,包括 Xen 和 KVM,以及 QEMU 和用于其他操作系统的一些虚拟产品。本文主要探讨 libvirt 及其用途和架构。讲到向外扩展计算(比如云计算),libvirt 可能是您从未听说过的最重要的库之一。libvirt 提供一种虚拟机监控程序不可知的 API 来安全管理运行于主机上的来宾操作系统。libvirt本身不是一种工具, 它是一种可以建立工具来管理来宾操作系统的 API。libvirt 本身构建于一种抽象的概念之上。它为受支持的虚拟机监控程序实现的常用功能提供通用的 阅读全文
posted @ 2012-02-14 00:45 zaleilynn 阅读(374) 评论(0) 推荐(0)
摘要:Summary: This two-part series explores how to use Python to create scripts for managing virtual machines using KVM. In this installment, you learn how to add a GUI to expand on the simple status and display tool.Part 1of this series looked at the basics of scripting Kernel-based Virtual Machine (KVM 阅读全文
posted @ 2012-02-14 00:35 zaleilynn 阅读(427) 评论(0) 推荐(0)
摘要:通过使用Xen的API或封装了其API的函数库,如libvirt进行编程,实现以下功能:1.以命令行形式显示宿主机(Host OS)上正在运行的客户机(Guest OS)名称;2.通过命令行形式显示指定客户机(Guest OS)的工作状态(显示其 CPU 利用率,和内存使用情况即可);这个作业工程类似于Fedora等Linux系统中内置的xm管理程序,在这里仅简单的实现xm top的功能。我选用了Fedora Core 8作为Host OS。在其上,通过Xen安装另一Fedora Core 8作为Guest OS。利用libvirt提供的API实现显示Guest OS名称、显示其 CPU 利用 阅读全文
posted @ 2012-02-14 00:33 zaleilynn 阅读(470) 评论(0) 推荐(0)
摘要:http://libvirt.org/html/libvirt-libvirt.html编译过程Ubuntu 10.04.3 LTS安装0.7.5 & 0.9.9./configure遇到的问题:You must install the Xen development package to compile Xen driver with -lxenstore在进行configure时候发现xen store没找到,查了些资料发现xen store的问题是由于需要安装xen-devel库,对于xen-devel来说依赖是xen-libs用apt-cache search libxen,找 阅读全文
posted @ 2012-02-13 22:00 zaleilynn 阅读(800) 评论(0) 推荐(0)
摘要:http://www.ibm.com/developerworks/opensource/library/os-python-kvm-scripting1/Paul Ferrill, CTO, ATACPaul Ferrill has been writing in the computer trade press for more than 20 years. He got his start writing networking reviews for PC Magazine on products like LANtastic and early versions of Novell N 阅读全文
posted @ 2012-02-10 10:16 zaleilynn 阅读(874) 评论(0) 推荐(0)