当前位置: 首页 > news >正文

淘客导购网站怎么做网站域名301设置

淘客导购网站怎么做,网站域名301设置,正规网站建设推荐,医疗手机网站模板vbox 与 kvm 的区别#xff1a; vbox 是由 qemu 改写而成#xff0c;包含大量 qemu 代码。可以使用于 不支持 虚拟化的cpu。值得说的一点#xff1a;vbox 在图形方面比较好#xff0c;能进行2D 3D加速。cpu控制不理想#xff08;估计是因为图形支持的缘故#xff09;。操… vbox 与 kvm 的区别 vbox 是由 qemu 改写而成包含大量 qemu 代码。可以使用于 不支持 虚拟化的cpu。值得说的一点vbox 在图形方面比较好能进行2D 3D加速。cpu控制不理想估计是因为图形支持的缘故。操作上有独立的图形界面易于上手。 kvm 是linux内核包含的东西使用qemu作为上层管理命令行。cpu 必须支持虚拟化。性能作为服务器很好可是图形能力十分的差。即使放电影图像也是像刷油漆一样一层一层的。cpu使用率控制很好。 控制上比较简洁功能比较丰富比如使用 “无敌功能”所有更改指向内存你的镜像永远保持干净。 “母镜像”功能让你拥有n个独立快照点。 还有很多参数。另外kvm作为内核级的虚拟机刚开始发展关注的公司比较多——但是还没有达到商业应用的水平。 总体而言在支持 虚拟化的情况下vbox 和 kvm 的性能差不多主要是面向对象不同kvm使用于服务器vbox使用于桌面应用。 关于kvm kvm是开源软件全称是kernel-based virtual machine内核级虚拟机。是x86架构且硬件支持虚拟化技术如 intel VT 或 AMD-V的linux 全虚拟化 解决方案。它包含一个为处理器提供底层虚拟化 可加载的核心模块kvm.kokvm-intel.ko 或 kvm-AMD.ko)。 kvm还需要一个经过修改的QEMU软件qemu-kvm作为虚拟机上层控制和界面。 kvm能在不改变linux或windows镜像的情况下同时运行多个虚拟机ps它的意思是多个虚拟机使用同一镜像并为每一个虚拟机配置个性化硬件环境网卡、磁盘、图形适配器……。 在主流的linux内核如2.6.20以上的内核均包含了kvm核心。 KVM官方地址 http://kvm.qumranet.com/kvmwiki KVM的Changelog: http://kvm.qumranet.com/kvmwiki/ChangeLog, 可以知道最新的版本是多少做了那些改变。 KVM下载地址在sourceforge.net上 http://sourceforge.net/project/showfile ... _id180599 KVM的Howto文档 http://kvm.qumranet.com/kvmwiki/HOWTO Kqemu: http://sourceforge.net/projects/kqemu/ Qemu: http://fabrice.bellard.free.fr/qemu/index.html 入门篇基于ubuntu9.10 基本知识 qemu是独立虚拟软件能独立运行虚拟机根本不需要kvm。kqemu是该软件的加速软件。kvm并不需要qemu进行虚拟处理只是需要它的上层管理界面进行虚拟机控制。虚拟机依旧是由kvm驱动。 所以大家不要把概念弄错了盲目的安装qemu和kqemu。 安装准备 查看你的硬是否支持虚拟化。 命令 egrep (vmx|svm) /proc/cpuinfo 要有 vmx 或 svm 的标识才行。总的说来AMD在虚拟化方面作得更好一些。 使用intel cpu的朋友还需要进入bios进行设置——因为我的是AMD所以设置方法不敢乱说。 安装kvm 打开新立得软件库安装kvm。系统会自动安装相关的软件包包括qemu-kvm。什么kvmAMD 或 kvmintel模式系统都自动处理好了。现在大多文章都是2008年写的已经过时了可惜好多人只知道复制好多设置已经不需要了有些跟官方的完全冲突。 创建虚拟镜像 命令先cd 到你要保存镜像的位置 kvm-img create xxx.img 2G 由于是要安装xp精简系统2G已经足够大了安装下来只要700M。xxx 代表名字想取什么都可以。最好是连续的英文.默认格式为raw当然你可以自己设定比如-f qcow2加在 create 后面即可。.img这个后缀是我随便编的kvm对后缀名没有要求 其它格式如下 Supported formats: cow qcow vmdk cloop dmg bochs vpc vvfat qcow2 parallels nbd host_cdrom host_floppy host_device raw tftp ftps ftp https http 安装虚拟机系统 命令先cd 到你要保存镜像的位置 kvm -hda xxxx.img -cdrom /path/to/boot-media.iso -boot d -m 512 说明几点/path/to/boot-media.iso 只是个举例。具体为你的系统盘镜像位置。m 为虚拟机内存大小单位是M默认不写这个选项为128M。当然自己看着给吧。 建议如果虚拟的是xp系统把页面缓存给关了。 使用虚拟机最简单的命令 命令先cd 到你要保存镜像的位置 kvm -m 1024 -hda xxx.img 由于默认内存是128M所以不得不指定一下要不连-m 1024都可以省了。此时是没有声卡的当然也可加上声音选项。cpu默认是一颗网络默认启动为net内部端口映射可以上网但是主机识别不了它也无法连接主机。 你可以使用 kvm -m 1024 -hda /xxx/xxx/xxx.img 你也可以把它作为桌面“创建启动器”的命令使用。每次轻轻一点就可使用了。 中级篇 命令 kvm --help 命令 kvm-img --help 看看具体的选项说明需要什么功能就在“最简单命令”后面加就是了——特别简单、功能又很多。用的满意了可以做成“程序启动器”。或者打开gedit把命令保存进去把文件名改为xxx.sh。再把属性改为“可执行”要用就点击。 比如kvm -m 1024 -hda xxx.img -xxx xx -xxxx xxx -xxxxxx -xxx 现在分功能讲解 1,文件共享 我们希望虚拟机能和主机对一些文件夹进行共享操作。类似于vbox的共享文件夹。 首先安装 samba 。这是linux的共享功能软件支持windows系统的访问。记住不是samba4 然后新建一个文件夹属性。共享选项把所有选项开启。应用。接受系统的权限的更改。 好了默认在虚拟机的网上邻居就能找见了。没有看看整个网络侧边任务。 简单吧kvm早已升级了。根本不需要什么配置。 关于权限你是否有“无法访问权限不够……”的问题主机无法修改共享文件“你不是该文件的创建者” 那是因为linux的权限相当的严格必须要放权别人才能访问、修改。 如果上级文件夹无论哪个不让读取比如 其它文件夹访问 无那么就会出现无法访问的情况。你要设置上级文件夹权限为其它文件夹访问 访问文件就可以了不必完全放权。 因为安全考虑我的用户文件夹其它文件夹访问 无。所以一开始就出了权限问题。我的解决办法是使用命令 sudo gnome-open /home/ 在home中再新建一个文件夹在属性上把创建者改为非root改为经常使用的普通用户组群sambashare。权限全为创建和删除。 经测试外网虽然能显示共享文件夹却无法访问——保证只有虚拟机可以访问。我使用了ufw防火墙 windows虚拟机在共享文件夹中创建的文件主机是无法更改的。要设置权限 我的电脑打开工具文件夹选项查看 把“使用简单的文件共享”选项去掉。在文件夹属性——安全知道怎么弄了吧。 linux的文件夹系统权限作的十分的好。比如你把其它非受权文件夹的链接复制到共享文件夹依然无法访问。windows那种权限的随意性看见就想哭。 多说一点我的电脑右键可以把共享文件夹设置为网络硬盘。相当于移动硬盘可以方便的安装软件保存资料。 2。无敌模式-snapshot -snapshot       write to temporary files instead of disk image files 意思是不更改镜像文件启动后的所有改动均不会往镜像文件上写。临时文件存放在内存中了具体是cached。 同样的功能在vbox要独立安装软件。效率可想而知…… 在命令后面空格加上 -snapshot 即可 3.高速网络-net nic,modelvirtio -net user 表 2. 虚拟网络模块的性能差异 虚拟网络模块     网络传输速度ssh     客户机操作系统     网络状态 rtl8029    200-300KB/s    SLES10SP2 (kernel 2.6.16-60)    不稳定 e1000    4.8-5.4MB/s    SLES10SP2 (kernel 2.6.16-60)    稳定 virtio    10.6-11.1MB/s    SLES11 (kernel 2.6.27-19)    稳定 驱动下载地址 http://sourceforge.net/projects/kvm/files/ 名字是 kvm-driver-disc 的 NETKVM-20081229.iso  具体可能有变化使用命令 kvm -m 1024 -hda xp.img -cdrom /home/cat650/linux/kvm/NETKVM-20081229.iso  -enable-kvm -net nic,modelvirtio -net user 其中-cdrom是加载光驱的意思。网络默认设置是 -net nic -net user 这里由于要指定virtio模块所以要把命令加上。然后自动安装驱动就行了。听说速度接近真实网卡——明显是为打造虚拟服务器配置的。 以后在启动虚拟机命令后面加上-net nic,modelvirtio -net user就可以了。 4.高速虚拟 VirtIO paravirtual 是 Linux 虚拟机平台上统一的虚拟 IO 接口驱动。通常主机为了让客户机像在真实环境中一样运行需要为客户机创建各式各样的虚拟设备如磁盘网卡显卡时钟USB 等。这些虚拟设备大大降低了客户机的性能。如果客户机不关注这些硬件设备就可以用统一的虚拟设备代替他们这样可以大大提高虚拟机的性能。这个统一的标准化接口在 Linux 上就是 VirtIO 。需要注意的是 VirtIO 运行在 kernel 2.6.24 以上的版本中才能发挥它的性能优势。另外 KVM 项目组也发布了  Windows 平台上的 VirtIO 驱动这样 windows 客户机的网络性能也可以大大提高了。 下载地址http://www.linux-kvm.org/page/WindowsGuestDrivers/Download_Drivers viostor是磁盘的虚拟驱动。 带图片的参考http://www.linux-kvm.org/page/WindowsGuestDrivers/viostor/installation 命令把-hda xxx.img 替换为-drive file/home/cat650/virt/xp.img,ifvirtio,booton 意思是使用virtio磁盘系统并作为启动盘默认是bootoff作为附加的第二硬盘。第一次使用的时候记得挂载viostorXXXX.img来安装驱动。 5.使用金手指“母镜像”功能 要求镜像格式为 qcow2 。作用在“母镜像”的基础上建立一个新的镜像。虚拟机操作这个新镜像时不会对“母镜像”进行任何更改只读“母镜像”新镜像只保存由于操作产生的与“母镜像”的数据差异大小很小。由此实现超越“快照”“还原点”的金手指功能数量没有限制。 命令先cd 到你要保存镜像的位置 kvm-img create -b xp.img -f qcow2 xp.test 其中xp.img是“母镜像”参数 -b xxxxp.test是新镜像——只能用 qcow2 格式。 新镜像的使用正常使用即可。 6.镜像格式转换镜像信息查询 能转换的格式有raw,qcow2,qcow,cow,vmdk,cloop 如果你记不清你创建的镜像是什么格式的可以使用命令先cd 到你要保存镜像的位置 kvm-img info xxx.img 关于格式的优缺点请参看高级篇 转换命令先cd 到你要保存镜像的位置 kvm-img convert -f raw -O qcow2 xp.img xp.qco 注意-O是字母o的大写。 这条命令举例的意思是把名为xp.img格式为raw的镜像转换成新镜像xp.qco格式为qcow2 其它格式vmdk是 VMware 3 / 4 兼容镜像格式。 深入了解 1.kvm-img 命令 用法kvm-img 后续命令 [命令选项] 后续命令如下 check [-f fmt] filename create [-F base_fmt] [-b base_image] [-f fmt] [-o options] filename [size] commit [-f fmt] filename convert [-c] [-f fmt] [-O output_fmt] [-o options] [-B output_base_image] filename [filename2 [...]] output_filename info [-f fmt] filename snapshot [-l | -a snapshot | -c snapshot | -d snapshot] filename 部分内容详解: filename 镜像的文件名比如xp.img cat.raw……后缀名随便取或者不取 base_image 只读的镜像——有点像“母镜像”。在“母镜像”基础上创建的镜像只储存对“母镜像”的修改。 output_base_image forces the output image to be created as a copy on write image of the specified base image; output_base_image should have the same content as the inputs base image, however the path, image format, etc may differ base_fmt base_image母镜像 的格式. 参考 fmt fmt 指镜像格式。建议大多数情况让系统自动选择不使用该选项。 主要格式如下 raw Raw disk image format (默认).该格式精简易被多种虚拟机接受。 如果你的系统支持 holes 如 linux 的 ext2 ext3 ext4? windows 的 NTFS),那么它将有效节约空间比如你创建的磁盘是2G虚拟系统只使用了800M那么它实际也只占用800M的空间。使用命令“kvm-img info 镜像文件名”将显示实际使用的大小。linux用户还可以使用“ls -ls”命令直接查看。 qcow2 QEMU 镜像格式, 使用最多的格式. 创建的镜像比较小用多少就占多少对于系统文件不支持 holes 的比如windows系统下使用qemu很有帮助。可进行AES加密zlib基本压缩并支持多种VM的快照snapshots。 qcow 古老的 QEMU 镜像格式. Left for compatibility. cow User Mode Linux Copy On Write image format. Used to be the only growable image format in QEMU. It is supported only for compatibility with previous versions. It does not work on win32.不能运行win32. vmdk VMware 3 / 4 兼容镜像格式 cloop Linux Compressed Loop image, useful only to reuse directly compressed CD-ROM images present for example in the Knoppix CD- ROMs. size 镜像文件的大小比特. 一般单位使 M (megabyte, 1024k) 、 G (gigabyte, 1024M)、 T (terabyte, 1024G) 。 b is ignored. output_filename 生成的镜像文件名 output_fmt 生成的镜像文件格式       KVMXen与VirtualBox在Intel Haswell上的Linux虚拟化性能比较  现在我们做的是Intel Haswell的虚拟化基准测试。我们在Intel酷睿i7 4770K的“Haswell”处理器上使用搭载了最新软件组件的Fedora 19来进行KVMXen和VirtualBox的基准测试。 自从上个月推出Haswell以来我们已经发布了许多和这款全新的英特尔处理器相关的基准测试但我们直到这篇文章发布前一直没有涵盖虚拟化方面的性能测试。这里启用了英特尔硬件虚拟化后将在一个纯净的Fedora 19 的64位操作系统上分别安装KVMXen和Virtualbox并进行比较。 目前Fedora 19拥有搭载GCC 4.8.1的Linux 3.9.8版本内核Mesa 9.2.0开发库和一个EXT4文件系统。所有的虚拟化组件都从Fedora 19的仓库中获取的包括QEMU 1.4.2Xen 4.2.2和libvirt/virt-manager组件。Xen和KVM的虚拟化通过virt-manager来建立。VirtualBox 4.2.16则是通过VirtualBox.org获取并安装在Fedora 19中。 这个英特尔酷睿i7 4770K机器拥有16GB的内存和240GB的OCZ Vertex 3 固态硬盘。在测试中每一个虚拟机能够使用全部八个逻辑核心四个物理核心加上超线程、16GB内存中的12GB以及16GB的虚拟磁盘。 在采用英特尔酷睿i7 “Haswell”处理器的Linux 3.9版本内核的Fedora 19上安装的KVMXen和VirtualBox的性能也和在没有任何形式的虚拟化或其它抽象层上运行基准测试的“裸机Bare Metal”的性能进行了对比。VMWare的产品没有在这篇文章里被测试因为它们的EULA特性限制了这种公开基准测试尽管VMware在过去可以让我们正常地做这样的基准测试并且它们的试用软件只能限制运行在四核CPU上。但以后的另外一篇文章会比较下在其它硬件上XEN/KVM/VMware的性能。 全部的Linux虚拟化基准测试采用完全自动化和可重复的方式进行处理使用开源软件Phoronix Test Suite并由OpenBenchmarking.org支持。在使用虚拟磁盘而且Xen/KVM都没有一个可靠的访问主机驱动或GPU的方法以使用3D功能的情况下这篇文章里的大部分基准测试都是集中在不同Linux虚拟化方法计算性能开销上。 磁盘测试在这里并不是虚拟化测试的一个重点因为只有一个虚拟磁盘被主机的文件系统使用。然而当把这三种Linux虚拟化方法与裸机结果进行比较时运行在Linux 3.9内核上的KVM性能最好其次是Xen。Oracle的Virtual仅仅跑出了主机上PostMark邮件服务器性能的66%而KVM跑出了性能的96%Xen是83%。 对于Dolfyn计算流体动力学的工作量当运行在KVM或Xen上时和裸机的运行结果相比并没有任何重大的变化。然而VirtualBox则是明显变慢了。 FFTE和HMMer的结果和Dolfyn类似Xen和KVM用很小的开销获得很好的性能但Oracle的VirtualBox则慢得多。 当John The Ripper这个破解密码的程序在VirtualBox中运行时则直接崩溃了。 运行TTSIOD渲染器时在Linux 3.9 内核的Fedora 19上运行的Xen虚拟化方法获得了它的第一次性能比拼的胜利。 总之运行在搭载英特尔酷睿i7 4770K处理器Fedora 19上的Xen和KVM虚拟化技术工作良好。这些虚拟化方法在Haswell处理器上的性能开销是最小的。当Xen和KVM在这款全新的英特尔处理器上运行良好的时候Oracle的VirtualBox最新版本v4.2.16相对慢得多。虽然VirtualBox的一个优点是支持客户机3D加速但这会在未来的一篇Phoronix文章中再次进行测试。而把Haswell和前几代的英特尔处理器和AMD处理器比较不同虚拟化方法的性能开销也会在不久之后在Phoronix上进行测试。         虚拟化 KVM迁移到VirtualBox 时间:2013-07-17 09:36 来源:未知 作者:admin 点击: 次             我最近 尝试 一些 从 我们 的 KVM 服务器 虚拟 机 迁移 到 我的笔记本电脑 在 我 的 VirtualBox的 安装 在 本地 运行 。 正如我 经历的过程 我意识到这 不是一件很容易 的 过程 所以 我决定要 记下 我的进程 。 它可能 并不完美 但 它为我工作 。 Lo 我最近尝试一些从我们的KVM服务器虚拟机迁移到我的笔记本电脑在我的VirtualBox的安装在本地运行。正如我经历的过程我意识到这不是一件很容易的过程所以我决定要记下我的进程。它可能并不完美但它为我工作。 Locate Your KVM VM Managed by libvirt We can use virsh for this. First let’s list all the VMs that belong to me: [elatovklaptop ~]$ virsh -c qemussh://virtuserkvm01/system list --all| grep kelatov 5 kelatov_win7_client2 running - kelatov-child-domain-client shut off - kelatov-haproxy shut off - kelatov-win2k8-DC2-Repl shut off - kelatov-Win2k8-IIS2 shut off - kelatov-Win2k8_DC_Repl shut off - kelatov_Win2k8-Child_DC shut off - kelatov_Win2k8-DC2 shut off - kelatov_Win2k8_DC shut off - kelatov_win7_client1 shut off I have a lot of them, first let’s move the kelatov_Win2k8-DC2 VM. Locate the Disk Image Configured for the VM in libvirt KVM virsh is your friend for that as well: [elatovklaptop ~]$ virsh -c qemussh://virtuserkvm01/system domblklist kelatov_Win2k8-DC2 Target Source ------------------------------------------------ hda /images/kelatov_win2k8r2.img hdc - So our Disk Image file is under /images/kelatov_win2k8r2.img. Copy Over the Disk Image File to the Local Machine Now that we know the location of the disk file, let’s copy it over. First let’s create a folder and then let’s rsync the file over: [elatovklaptop ~]$ mkdir vm1 [elatovklaptop ~]$ rsync -avzP virtuserkvm01:/images/kelatov_win2k8r2.img vm1/. receiving incremental file list kelatov_win2k8r2.img 21474836480 100% 17.25MB/s 0:19:47 (xfer#1, to-check0/1) sent 30 bytes received 6353239881 bytes 5350096.77 bytes/sec total size is 21474836480 speedup is 3.38 Generate a libvirt Domain XML format Configuration of the KVM VM libvirt uses a special XML format file to keep track of all the configurations for a VM. All the specifics of the XML file are here. Using virsh, generating the file is a breeze: [elatovklaptop ~]$ cd vm1/ [elatovklaptop vm1]$ virsh -c qemussh://virtuserkvm01/system dumpxml kelatov_Win2k8-DC2 kelatov_Win2k8-DC2.xml The file is pretty long, but just checking the top of the file, we should see something like this: [elatovklaptop vm1]$ head kelatov_Win2k8-DC2.xml domain typekvm namekelatov_Win2k8-DC2/name uuidb5188795-2be0-b229-7538-0fe7f2e930a3/uuid memory1048576/memory currentmemory1048576/currentmemory vcpu1/vcpu os type archx86_64 machinerhel6.2.0hvm/type boot devhd/boot /os libvirt keeps the configuration XML file under /etc/libvirt/qemu as well: [virtuserkvm01 ~]$ head /etc/libvirt/qemu/kelatov_Win2k8-DC2.xml !-- WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE OVERWRITTEN AND LOST. Changes to this xml configuration should be made using: virsh edit kelatov_Win2k8-DC2 or other application using the libvirt API. -- /domaindomain typekvm namekelatov_Win2k8-DC2/name uuidb5188795-2be0-b229-7538-0fe7f2e930a3/uuid So if you really wanted to, you could just rsync that file. Convert RAW Format Disk Image (.img) to VMDK Now that we have all the files: [elatovklaptop vm1]$ ls -1 kelatov_Win2k8-DC2.xml kelatov_win2k8r2.img Let’s create an OVF file, so we can import it into VirtualBox. To do  this, first we will need to convert our disk image to VMDK format. You  can use qemu-img to find out the exact format of the disk image file: [elatovklaptop vm1]$ qemu-img info kelatov_win2k8r2.img image: kelatov_win2k8r2.img file format: raw virtual size: 20G (21474836480 bytes) disk size: 20G So we are currently in RAW format. Here is the command we can use to convert it to VMDK format: [elatovklaptop vm1]$ qemu-img convert -O vmdk kelatov_win2k8r2.img kelatov_win2k8r2.vmdk -p (100.00/100%) Convert Domain XML Format Configuration File to libvirt “image” XML Configuration File (virt-image) For some reason, the virt-image and virt-convert commands can only convert from the image XML Descriptor file. From the virt-image man page: virt-image is a command line tool for creating virtual machines from an XML image descriptor IMAGE.XML (virt-image(5)). Most attributes of the virtual machine are taken from the XML descriptor (e.g., where the files to back the virtual machines disks are and how to map them into the guest), though certain information must be added on the command line, such as the name of the guest. The XML descriptor defines most attributes of the guest, making it possible to bundle and distribute it together with the files backing the guests disks. And here is the section from virt-convert: Conversion Options -i format Input format. Currently, vmx, virt-image, and ovf are supported. There have been other people wondering how to convert libvirt domain  XML file into other formats like the XML image format (virt-image),  VMware VMX, or even OVF. Here are some forums that talk about it: virt-convert from libvirt to vmware      [libvirt] Intend to add OVA installation API      [libvirt-users] using virsh (or something) to convert from KVM domain XML to vmx…      [fedora-virt] exporting a vm imagebut none of the above have been resolved yet. There is a script that goes from vmx to libvirt domain XML format: vmware2libvirt. There is also a way to go from XML to VMX, and the process is described here.  But that only works if you already had converted a VMX to XML and then  converted it back. It never has instructions on how to start from XML  and go to VMX. On Fedora, I had to enable another repository to enable libvirt-client tools to have VMware/ESX support built it. Instructions on that can be seen at “Virtualization Preview Repository“. After you install the new libvirt-client tools you can then run commands against an ESX host: [elatovklaptop ~]$ virsh -c esx://vmware01/?no_verify1 dumpxml kelatov-2 Enter username for vmware01 [root]: Enter roots password for vmware01: /domaindomain typevmware namekelatov-2/name uuid564d3355-1ee8-ce81-00fa-ef6c1a767850/uuid memory unitKiB4194304/memory currentmemory unitKiB4194304/currentmemory vcpu placementstatic2/vcpu os type archx86_64hvm/type /os clock offsetutc/clock on_poweroffdestroy/on_poweroff on_rebootrestart/on_reboot on_crashdestroy/on_crash devices disk typefile devicedisk source file[images] kelatov-2/kelatov-2.vmdk/ target devsda busscsi/target address typedrive controller0 bus0 target0 unit0/address /disk disk typeblock devicecdrom source devcdrom1/ target devhda buside/target address typedrive controller0 bus0 target0 unit0/address /disk controller typescsi index0 modellsilogic/controller controller typeide index0/controller interface typebridge mac address00:0c:29:76:78:50/mac source bridgenet1/ model typee1000/model /interface video model typevmvga vram4096/model /video /devices /domain So if I had started out with ESX and was trying to go to KVM that would have been pretty easy (but at least now I can use virsh  to query an ESX server). Since no solution has been found, I decided to  write my own python script that converts from libvirt Domain XML format  to virt-image (XML Image Descriptor) XML format. The format of the XML  image descriptor is seen here. Here is an example of the format: ?xml version1.0 encodingUTF-8? image namesysresccd/name domain boot typehvm guest archi686/arch /guest os loader devcdrom/loader /os drive diskroot.raw targethda/drive drive disksysresc/drive /boot devices vcpu1/vcpu memory262144/memory interface/interface graphics/graphics /devices /domain storage disk fileroot.raw usescratch size100 formatraw/disk disk idsysresc fileisos/systemrescuecd.iso usesystem formatiso/disk /storage /image Here is what I came up with: [elatovklaptop vm1]$ cat dom2img.py #!/usr/bin/env python from xml.dom import minidom from xml.dom.minidom import Document import sys # Read in first arguement input_file sys.argv[1] # parse our XML file xml minidom.parse(input_file) # Get the DomainName or the VM Name domainName xml.getElementsByTagName(name) domain_name domainName[0].childNodes[0].nodeValue # Get the hypervisor Type domainHType xml.getElementsByTagName(type) h_type domainHType[0].childNodes[0].nodeValue # Get the Arch and OS domainOSInfo xml.getElementsByTagName(type) for i in domainOSInfo: domain_arch i.getAttribute(arch) domain_os i.getAttribute(machine) # Get Boot Device Type domainBootDevType xml.getElementsByTagName(boot) for i in domainBootDevType: boot_dev_type i.getAttribute(dev) # Get disk Device location for node in xml.getElementsByTagName(disk): if node.getAttribute(device) disk: source node.getElementsByTagName(source) for s in source: disk_loc s.getAttribute(file) # Get Boot Device mapping {} for node in xml.getElementsByTagName(disk): dev node.getAttribute(device) target node.getElementsByTagName(target) for t in target: mapping[dev] t.getAttribute(dev) if boot_dev_type hd: boot_dev mapping[disk] elif boot_dev_type cdrom: boot_dev mapping[cdrom] # Get amount of CPUS domainVCPUs xml.getElementsByTagName(vcpu) vcpu_count domainVCPUs[0].childNodes[0].nodeValue # Get amount of RAM domainMemory xml.getElementsByTagName(memory) memory domainMemory[0].childNodes[0].nodeValue # Create an empty XML Document doc Document() # Create the image element image doc.createElement(image) doc.appendChild(image) # Create the Name Element name_element doc.createElement(name) image.appendChild(name_element) name_text doc.createTextNode(domain_name) name_element.appendChild(name_text) # Create the Label Element label_element doc.createElement(label) image.appendChild(label_element) label_text doc.createTextNode(domain_name) label_element.appendChild(label_text) # Create the Description Element desc_element doc.createElement(description) image.appendChild(desc_element) desc_text doc.createTextNode(domain_os) desc_element.appendChild(desc_text) # Create the Domain Element domain_element doc.createElement(domain) image.appendChild(domain_element) # Create boot element boot_element doc.createElement(boot) boot_element.setAttribute(type,h_type ) domain_element.appendChild(boot_element) # Create guest Element guest_element doc.createElement(guest) boot_element.appendChild(guest_element) # Create the arch attribute arch_element doc.createElement(arch) guest_element.appendChild(arch_element) arch_text doc.createTextNode(domain_arch) arch_element.appendChild(arch_text) # Create OS Element os_element doc.createElement(os) boot_element.appendChild(os_element) # Create the loader element and set the dev attribute loader_element doc.createElement(loader) loader_element.setAttribute(dev,boot_dev_type) os_element.appendChild(loader_element) # Create drive element and set its attributes drive_element doc.createElement(drive) drive_element.setAttribute(disk, disk_loc) drive_element.setAttribute(target, boot_dev) boot_element.appendChild(drive_element) # Create device Element devices_element doc.createElement(devices) domain_element.appendChild(devices_element) # Create VCPU text vcpu_element doc.createElement(vcpu) devices_element.appendChild(vcpu_element) vcpu_text doc.createTextNode (vcpu_count) vcpu_element.appendChild(vcpu_text) # Create Memory text memory_element doc.createElement(memory) devices_element.appendChild(memory_element) memory_text doc.createTextNode(memory) memory_element.appendChild(memory_text) # Create interface element interface_element doc.createElement(interface) devices_element.appendChild(interface_element) # Create graphics element graphics_element doc.createElement(graphics) devices_element.appendChild(graphics_element) # Create storage element storage_element doc.createElement(storage) image.appendChild(storage_element) # create disk element and set its attributes disk_element doc.createElement(disk) disk_element.setAttribute(file,disk_loc) disk_element.setAttribute(format,vmdk) disk_element.setAttribute(use,system) storage_element.appendChild(disk_element) f open(input_file _converted, w) f.write (doc.toprettyxml(indent ,encodingutf-8)) f.close() It basically takes in one argument, the domain XML file to be  converted, and produces a new file with “converted” appended to the  original filename. Here is what I did to run the conversion: [elatovklaptop vm1]$ ./dom2img.py kelatov_Win2k8-DC2.xml Now to check out both files, here is the original: [elatovklaptop vm1]$ head kelatov_Win2k8-DC2.xml domain typekvm namekelatov_Win2k8-DC2/name uuidb5188795-2be0-b229-7538-0fe7f2e930a3/uuid memory1048576/memory currentmemory1048576/currentmemory vcpu1/vcpu os type archx86_64 machinerhel6.2.0hvm/type boot devhd/boot /os And here is the converted one: [elatovklaptop vm1]$ head kelatov_Win2k8-DC2.xml_converted ?xml version1.0 encodingutf-8? image namekelatov_Win2k8-DC2/name labelkelatov_Win2k8-DC2/label descriptionrhel6.2.0/description domain boot typehvm guest archx86_64/arch /guest os Convert XML Image Descriptor to VMX Luckily virt-convert can handle this: [elatovklaptop vm1]$ virt-convert -i virt-image kelatov_Win2k8-DC2.xml_converted -o vmx kelatov_Win2k8-DC2.vmx Generating output in vmx format to /home/elatov/vm1/ Converting disk /images/kelatov_win2k8r2.img to type vmdk... Done. Now checking out the VMX file: [elatovklaptop vm1]$ head -20 kelatov_Win2k8-DC2.vmx #!/usr/bin/vmplayer # Generated by virt-convert # http://virt-manager.org/ # This is a Workstation 5 or 5.5 config file and can be used with Player config.version 8 virtualHW.version 4 guestOS other displayName kelatov_Win2k8-DC2 annotation rhel6.2.0 guestinfo.vmware.product.long kelatov_Win2k8-DC2 guestinfo.vmware.product.url http://virt-manager.org/ guestinfo.vmware.product.class virtual machine numvcpus 1 memsize 1024 MemAllowAutoScaleDown FALSE MemTrimRate -1 uuid.action create That doesn’t look too bad. Create OVF from VMX and VMDK Let’s first fix the disk location, right now it’s still pointing to the .img file: [elatovklaptop vm1]$ grep img kelatov_Win2k8-DC2.vmx ide0:0.fileName /images/kelatov_win2k8r2.img Since the VMDK is located in the same directory: [elatovklaptop vm1]$ ls -1 dom2img.py kelatov_Win2k8-DC2.vmx kelatov_Win2k8-DC2.xml kelatov_Win2k8-DC2.xml_converted kelatov_win2k8r2.img kelatov_win2k8r2.vmdk Let’s edit the VMX file: [elatovklaptop vm1]$ vi kelatov_Win2k8-DC2.vmx and fix the location to be relative to the current directory: [elatovklaptop vm1]$ grep vmdk kelatov_Win2k8-DC2.vmx ide0:0.fileName kelatov_win2k8r2.vmdk That looks good, now let’s create the OVF. More information regarding installing and using ovftool is seen at “Migrating a VM from VMware Workstation to Oracle VirtualBox“. Here is the command I ran to create our OVF: [elatovklaptop vm1]$ ovftool kelatov_Win2k8-DC2.vmx kelatov_Win2k8-DC2.ovf Opening VMX source: kelatov_Win2k8-DC2.vmx Opening OVF target: kelatov_Win2k8-DC2.ovf Writing OVF package: kelatov_Win2k8-DC2.ovf Transfer Completed Completed successfully After it was done, I had the following files: [elatovklaptop vm1]$ ls -rt1 kelatov_win2k8r2.img kelatov_Win2k8-DC2.xml kelatov_win2k8r2.vmdk kelatov_Win2k8-DC2.xml_converted dom2img.py kelatov_Win2k8-DC2.vmx kelatov_Win2k8-DC2-disk1.vmdk kelatov_Win2k8-DC2.ovf kelatov_Win2k8-DC2.mf The bottom 3 files were created by the OVF creation process. Import OVF into VirtualBox Doing a VirtualBox dry-run import, I saw the following: [elatovklaptop vm1]$ VBoxManage import -n kelatov_Win2k8-DC2.ovf 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Interpreting /home/elatov/vm1/kelatov_Win2k8-DC2.ovf... OK. Disks: vmdisk1 20 17550934016 http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized kelatov_Win2k8-DC2-disk1.vmdk 6997323776 -1 Virtual system 0: 0: Suggested OS type: Other (change with --vsys 0 --ostype type; use list ostypes to list all possible values) 1: Suggested VM name vm (change with --vsys 0 --vmname name) 2: Description rhel6.2.0 (change with --vsys 0 --description desc) 3: Number of CPUs: 1 (change with --vsys 0 --cpus n) 4: Guest memory: 1024 MB (change with --vsys 0 --memory mb) 5: Network adapter: orig nat, config 2, extra typenat 6: IDE controller, type PIIX4 (disable with --vsys 0 --unit 6 --ignore) 7: Hard disk image: source imagekelatov_Win2k8-DC2-disk1.vmdk, target path/home/elatov/.virt/vm/kelatov_Win2k8-DC2-disk1.vmdk, controller6;channel0 (change target path with --vsys 0 --unit 7 --disk path; disable with --vsys 0 --unit 7 --ignore) I liked the outcome: memory, CPU, and hard disk information was  correct. I decided to run the import and at the same time I changed the  OS type and the name. Here is how the whole process looked like: [elatovklaptop vm1]$ VBoxManage import kelatov_Win2k8-DC2.ovf --vsys 0 --ostype Windows2008_64 --vsys 0 --vmname kelatov_win2k8_DC 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Interpreting /home/elatov/vm1/kelatov_Win2k8-DC2.ovf... OK. Disks: vmdisk1 20 17550934016 http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized kelatov_Win2k8-DC2-disk1.vmdk 6997323776 -1 Virtual system 0: 0: OS type specified with --ostype: Windows2008_64 1: VM name specified with --vmname: kelatov_win2k8_DC 2: Description rhel6.2.0 (change with --vsys 0 --description desc) 3: Number of CPUs: 1 (change with --vsys 0 --cpus n) 4: Guest memory: 1024 MB (change with --vsys 0 --memory mb) 5: Network adapter: orig nat, config 2, extra typenat 6: IDE controller, type PIIX4 (disable with --vsys 0 --unit 6 --ignore) 7: Hard disk image: source imagekelatov_Win2k8-DC2-disk1.vmdk, target path/home/elatov/.virt/vm/kelatov_Win2k8-DC2-disk1.vmdk, controller6;channel0 (change target path with --vsys 0 --unit 7 --disk path; disable with --vsys 0 --unit 7 --ignore) 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Successfully imported the appliance. I then launched VirtualBox and powered on the VM, it booted without any issues:   (责任编辑admin)     尝试在虚拟机多开系统 Guest OS是WinXP 硬件平台为I5四核DDRIII 8G 想要实现10-12台虚拟机同时开 每台任务firefox开一个标签看视频循环看不同的网络视频24小时全开...1最开始试的是KVM Host系统debian 6 64bit 开了virtio、writeback模式 做Guest系统用的是Ghost版速度为1000M还原速度 ignore_js_op QQ截图20130426175611.png (99.29 KB, 下载次数: 12) 下载附件 2013-4-26 17:56 上传 听说KVM非常给力于是上来就8台一起跑.. 几个小时候后所有guest都进不去kvm开的vnc口另一台电脑通过vnc分别登陆这8台guest做日常访问 看进程又没死CPU的用户状态占用极高 ignore_js_op QQ截图20130426175828.png (3.94 KB, 下载次数: 7) 下载附件 2013-4-26 17:59 上传 kvm -vnc :1 -localtime -m 512 -smp 2 -vga vmware -drive file/var/lib/libvirt/images/WinXP01.img,cachewriteback,ifvirtio,booton -enable-kvm -net nic,macaddr00-00-00-00-00-01,modelvirtio -net user -daemonize -boot c -no-fd-bootchk 这是我一台虚拟机启动的参数配置问题 只好一个个kill掉进程重新运行一段时间后Guest机再次无法访问2VMware Workstation 9 同一台主机Host系统为ubuntu 10.04 server 64bit 安装官方最新VMware 9客户机依然Ghost版深度的XP 做Guest系统时神速平均3240MB/min超KVM几条街 ignore_js_op QQ截图20130413110340.png (55.89 KB, 下载次数: 8) 下载附件 2013-4-26 18:00 上传 每台分配1CPU 1核分配512M内存最多也就开到6台 超过6台后感到有拖慢现象 用top命令查看mem跟swap都充足cpu的us用户态很低但sy内核状态非常高几乎超过80%这跟KVM刚好相反 致使客户机开始拖慢但没有像KVM一样无法访问... 平时只好4个虚拟机开启稳定运行。 ignore_js_op QQ截图20130426181439.png (101.92 KB, 下载次数: 6) 下载附件 2013-4-26 18:15 上传 3VirtualBox 暂时无力测试------ 想问下各位大牛这瓶颈出在哪是软件问题(改装ESX)还是硬件不够需要至强CPU 或者怎样配置能够达到10-12台虚拟机齐开 ------                               Ubuntu11.10下Xen、KVM和VirtualBox比拼 2011-11-4 14:59| 发布者: joejoe0332| 查看: 13795| 评论: 0|原作者: 范平|来自: ZOL 摘要:   虚拟化测试平台  近日国外有人利用Ubuntu 11.10对VirtualBox、Xen、和KVM不同Linux虚拟化进行对比测试。该测试采用了安装有英特尔酷睿i7 2630QMSandy Bridge四核处理器并支持超线程的ZaReason笔记本电 ...   虚拟化测试平台   近日国外有人利用Ubuntu 11.10对VirtualBox、Xen、和KVM不同Linux虚拟化进行对比测试。该测试采用了安装有英特尔酷睿i7 2630QMSandy Bridge四核处理器并支持超线程的ZaReason笔记本电脑它配备有8GB内存和128GB SSD以及 NVIDIA GeForce GT 555M显卡Ubuntu 11.10 x86-64被安装在Oneiric Linux 3.0 kernel、Unity 4.22.0、X.Org Server 1.10.4、GCC 4.6.1和EXT4文件系统的主机上。每个虚拟机实例都被设定为8个逻辑内核和6GB内存。 测试平台(点击图片看大图)   VirtualBox 4.1.2、KVM、和Xen 4.1.1都是在Ubuntu Oneiric上进行安装。Ubuntu 11.10也证明了Xen虚拟化对DomU客户机的支持。不过虽然Xen现在能在Ubuntu上大展身手但Canonical仍将KVM视作主要的Linux虚拟化技术并加以不断支持。VMware的 Linux虚拟化没有在此次测试中提及主要是考虑到使用条件方面的限制会影响到基准测试。   除了VirtualBox、Xen、和KVM的基准测试我们也会公布Sandy Bridge系统在裸机上的基准测试以供参考。 C-Ray多线程运算测试   首先我们采用C-Ray来测试多线程运算性能。从图中我们可以看到使用KVM虚拟化表现出的运算性能出众。KVM客户机实例能够以91%的裸机运算速度来处理多线程而Sandy Bridge上的VirtualBox和Xen DomU客户机的运算速度分别为85%和68%。 POV-Ray渲染测试   POV-Ray 3.6.1是一款单线程、图像渲染测试工具KVM表现仍然领先 。KVM的渲染速度几乎和使用Linux 3.0 kernel的Sandy Bridge笔记本裸机上的效果相仿。紧随其后的则是VirtualBoxXen则被远远落在后面。   加密测试VirtualBox和KVM持平   Smallpt全局照明渲染测试中测试结果大体不变KVM仍然是运算最快的Linux虚拟化平台随后则是VirtualBox和Xen。 全局照明渲染测试   在密码测试方面我们看到KVM仍然保持遥遥领先。其运算速度达到了裸机性能的97%其次就是VirtualBox和Xen DomU。后者的运算速度仅为裸机的69%。在对MD5算法进行测试的情况下测试结果大体一致。 传统DES密码测试 MD5密码测试   在使用Blowfish进行加密测试的时候VirtualBox和KVM速度几乎相同然而DomU客户机的性能与它们却有着30%的差距。 Blowfish加密测试   在运行OpenSSL的时候其产生的结果与刚才使用的John The Ripper测试工具得出的结果类似。 利用OpenSSL对4096位字符串进行密码测试   并行处理测试KVM表现最好   在KVM实例上运行7-Zip进行解压缩测试时我们发现其性能只降低了10%然而使用VirtualBox和Xen其性能损失分别为15%和30%。 7-Zip解压缩测试   NAS Parallel并行处理测试中整体来看KVM表现仍然最为优秀而Xen表现最差。     VT-x技术助KVM大展身手   在多序列比对软件MAFFT测试中数值越低越好KVM仍然表现出众。   在处理OpenMP方面KVM表现出的效率也最高。   对CPU进行的各种压力测试转移到对磁盘测试上我们也同样看到KVM仍然不负众望而Xen的表现也快速得到提升几乎与KVM持平。VirtualBox表现最差。需要指出的是这些测试数据都采用了默认的磁盘格式是基于Apache的静态网页负载测试。   在PostMark磁盘测试中KVM性能损失几乎为20%相比裸机而VirtualBox则跌去了25%Xen几乎下降了一半。   SQLite测试出来的最快虚拟化方案当属甲骨文的VirtualBox它甚至比裸机的表现还要出色数值越小表现越佳。不过其中的奥秘恐怕在于VirtualBox并不会强迫执行SQLite的Sync/FSync请求。   综上从运算性能和磁盘负载角度来说Linux KVM不失为最快的虚拟化解决方案单线程或者多线程。得益于英特尔VT-x技术的Sandy Bridge 酷睿i7硬件平台KVMKernel-based Virtual Machine表现尤为出众。除了最后一项SQLite之外的其他所有测试KVM都提供了最好的成绩。相比之下VirtualBox在测试中排名第二而Xen在HVM模式下的虚拟化表现最差。   如果要说VirtualBox对比KVM的优势恐怕要数其目前支持的2D/3D加速技术通过该技术可以在客户机上重定向至主机的显卡上。Xen同样也支持通过PCI传入和控制显卡。当然通过Gallium3D驱动支持VMware也能提供2D/3D加速技术。 酷毙 8
http://www.hkea.cn/news/14285662/

相关文章:

  • 网络公司网站源码写作网站有哪些
  • 电子商务网站系统建设实训心得小程序营销策划方案
  • 网站上传的图片怎么做的清晰东莞市建设
  • 网站建设与管理岗位国内做网站公司排名
  • 安徽省建设厅网站官网信息发布网站开发模板
  • 正在建设中的网站可算违规表白网页制作免费网站
  • 红色大气网站互联网网站制作公司哪家好
  • 宣讲家网站两学一做心得wordpress下雪
  • 统计局网站建设情况免费咨询男性问题
  • 给女朋友做网站的素材百度信息流
  • 作作网站北京兼职做网站建设
  • 企业网站建设专业服务wordpress 颜色插件下载
  • 自己做网站好还是让别人做1688品牌加盟网
  • 在哪个网站做流动补胎的广告好短网址压缩
  • 微信公众号里怎么做网站网络营销郑州网站搭建方案
  • 二级菜单网站如何做伪静态怎样查公司注册信息查询
  • 河南seo网站开发小程序开发哪家好
  • 餐饮加盟网站模板视频素材网站大全免费
  • 汉中微信网站建设公司做城市网站的标语
  • 湖北长安建设集团股份有限公司网站权重查询
  • 建设食品网站的目的临猗网站建设
  • 上海南京东路网站建设东莞百度提升优化
  • 网站推广目标关键词查项目经理有没有在建怎么查
  • 整站优化提升排名杭州百度推广代理公司哪家好
  • 做网站维护需要多少钱网站推广常用方法
  • 做教师知识网站有哪些内容怎么把网站排名优化
  • 综合门户网站是什么意思html5网页模板代码
  • 温岭市建设工程质量安全网站保定外贸网站制作
  • 微信网站建设价格推广渠道的优缺点
  • 工程建设造价信息网站我要设计网