欧卡2中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

需要三步,才能开始

只需两步,慢速开始

玩欧卡就用莱仕达V99方向盘欧卡2入门方向盘选莱仕达V9莱仕达折叠便携游戏方向盘支架欢迎地图Mod入驻
查看: 9360|回复: 5
收起左侧

cloudstack嵌套虚拟化

[复制链接]
oppo 发表于 2014-10-29 15:55 | 显示全部楼层 |阅读模式
本帖最后由 oppo 于 2014-11-5 17:43 编辑

http://my.oschina.net/lionel45/blog/176599

编辑agent配置文件 /etc/cloudstack/agent/agent.properties,添加下面内容

guest.cpu.mode=custom|host-model|host-passthrough

若选择 guest.cpu.mode=custom就需要增加下面这行,选其他的不必添加下面这行

guest.cpu.model=xxxx

xxxx内容是从 /usr/share/libvirt/cpu_map.xml 文件中选取的,是选择CPU的类型

解释说明:

custom: 选择custrom时你可以直接显视的给出CPU的module name规范,这个规范从文件 /usr/share/libvirt/cpu_map.xml中查找。
host-model: libvirt 根据/usr/share/libvirt/cpu_map.xml 文件来自动确定 CPU 模型。选择和主机最相近的匹配。 尽可能找到CPU性能和flags参数相近的主机。
host-passthrough: libvirt 会告诉KVM向没有修改过CPU的主机迁移. 与host-model的差别是不仅匹配flags特性,还要匹配CPU的每一个特性. 这将给出绝对最好的性能, 同时对一些应用程序很重要,但这样做会付出一些代价:虚拟机之间的迁移只会迁移到完全匹配CPU的主机上。
提示:使用host-passthrough参数可能会导致迁移失败,这个时候建议你改成host-model 或custom参数。

例如:

custom
    guest.cpu.mode=custom
    guest.cpu.model=SandyBridge
host-model
    guest.cpu.mode=host-model
host-passthrough
    guest.cpu.mode=host-passthrough

注意:cloudstack-agent服务不必手动开启,ManagementServer在添加主机的时候会自动帮你启动。
 楼主| oppo 发表于 2014-10-29 15:56 | 显示全部楼层
OpenStack KVM嵌套虚拟化的配置
这两天为研发部门搭建一套OpenStack测试环境,需要在KVM虚拟机中跑KVM虚拟机,所以用到嵌套虚拟化技术。
虽然compute节点使用较新的centos6.5标准内核,发现不支持nested技术。
[root@controller ~]# cat /sys/module/kvm_intel/parameters/nested
cat: /sys/module/kvm_intel/parameters/nested: 没有那个文件或目录
# modinfo kvm_intel
filename:       /lib/modules/2.6.32-431.11.2.el6.x86_64/kernel/arch/x86/kvm/kvm-intel.ko
license:        GPL
author:         Qumranet
srcversion:     34373A27E1A78784FD945C4
depends:        kvm
vermagic:       2.6.32-431.11.2.el6.x86_64 SMP mod_unload modversions
parm:           bypass_guest_pf:bool
parm:           vpid:bool
parm:           flexpriority:bool
parm:           ept:bool
parm:           unrestricted_guest:bool
parm:           eptad:bool
parm:           emulate_invalid_guest_state:bool
parm:           yield_on_hlt:bool
parm:           vmm_exclusive:bool
parm:           ple_gap:int
parm:           ple_window:int
后来在centos的wiki上找到了方法:
http://wiki.centos.org/zh/HowTos/NestedVirt
compute节点配置:
1.添加kernel源:
[root@controller ~]# wget -P /etc/yum.repos.d http://dev.centos.org/centos/6/xen-c6/xen-c6.repo
[root@controller ~]# yum repolist
2.安装新内核:
[root@controller ~]# yum --enablerepo xen-c6 install kernel kernel-firmware
[root@controller ~]# vi /boot/grub/grub.conf
在kernel行末端添加:kvm-intel.nested=1
[root@controller ~]# reboot
3.检查nested加载情况:
[root@controller ~]# cat /sys/module/kvm_intel/parameters/nested
Y
4.修改nova.conf:
添加:libvirt_cpu_mode = host-passthrough
该设置使创建的实例可最大程度的使用物理CPU的指令集,因此可以实现二次虚拟化。
 楼主| oppo 发表于 2014-10-31 18:13 | 显示全部楼层
kvm虚拟机里运行VMware:

VM打开电源 出现 :You are running VMware Workstation through an incompatible hypervisor. You canno

http://litianchang.cn/xen-vmware/,虚拟机里面装虚拟机

edit the instance.vmx file and add the following line to it:
vmx.allowNested = TRUE

同样的问题,按照以下红字编辑vmx文件已解决!
Using virtualization technology has helped me reduce I.T. costs within an office and development/production website environments.  I primarily use VMware products such as Workstation, Player and ESXi Server.  I find these applications simple to install and manage and they are quite robust and stable.  Yesterday I found myself needing to install a Linux VM within an Amazon EC2 Windows Server 2008 VM by using VMware Player.  Don’t ask why, it just had to be done and not for academic entertainment.  I have never tried to install a VM within a VM before so I was initially quite surprised that Player wouldn’t allow me to power on the VM I created to install Linux.  The message it gave me was

You are running VMware Player via an incompatible hypervisor. You may not power on a virtual machine until this hypervisor is disabled.

I knew there had to be a way to get this to work, so a Google search on that message led me to a VMware Community article that discusses running a VM within a VM.  Thankfully the solution was easy to spot, even though it was at the very bottom of the article.  To get this VMware Player VM running inside an Amazon EC2 instance, all I needed to do was edit the instance.vmx file and add the following line to it:

vmx.allowNested = TRUE

I am now successfully running a CentOS 5.7 Linux VM within an Amazon EC2 Windows Server 2008 VM. Cheers to VMware!
 楼主| oppo 发表于 2014-10-31 18:14 | 显示全部楼层
VMware on KVM,不支持64位,virtualbox只能建32位虚拟机。VMware给出的提示比较详细:

Software virtualization is incompatible with long mode on this platform. Disabling long mode. Without long mode support, the virtual machine will not be able to run 64 bit code. For more details see http://vmware.com/info?id=152.
 楼主| oppo 发表于 2014-10-31 18:16 | 显示全部楼层
cpu信息:

[root@manage ~]# dmidecode -t processor
# dmidecode 2.11
SMBIOS 2.5 present.

Handle 0x0400, DMI type 4, 40 bytes
Processor Information
        Socket Designation: CPU1
        Type: Central Processor
        Family: Xeon
        Manufacturer: Intel
        ID: 76 06 01 00 FF FB EB BF
        Signature: Type 0, Family 6, Model 23, Stepping 6
        Flags:
                FPU (Floating-point unit on-chip)
                VME (Virtual mode extension)
                DE (Debugging extension)
                PSE (Page size extension)
                TSC (Time stamp counter)
                MSR (Model specific registers)
                PAE (Physical address extension)
                MCE (Machine check exception)
                CX8 (CMPXCHG8 instruction supported)
                APIC (On-chip APIC hardware supported)
                SEP (Fast system call)
                MTRR (Memory type range registers)
                PGE (Page global enable)
                MCA (Machine check architecture)
                CMOV (Conditional move instruction supported)
                PAT (Page attribute table)
                PSE-36 (36-bit page size extension)
                CLFSH (CLFLUSH instruction supported)
                DS (Debug store)
                ACPI (ACPI supported)
                MMX (MMX technology supported)
                FXSR (FXSAVE and FXSTOR instructions supported)
                SSE (Streaming SIMD extensions)
                SSE2 (Streaming SIMD extensions 2)
                SS (Self-snoop)
                HTT (Multi-threading)
                TM (Thermal monitor supported)
                PBE (Pending break enabled)
        Version: Intel(R) Xeon(R) CPU           E5410  @ 2.33GHz
        Voltage: 1.4 V
        External Clock: 1333 MHz
        Max Speed: 3600 MHz
        Current Speed: 2333 MHz
        Status: Populated, Enabled
        Upgrade: Socket LGA771
        L1 Cache Handle: 0x0700
        L2 Cache Handle: 0x0701
        L3 Cache Handle: 0x0702
        Serial Number: Not Specified
        Asset Tag: Not Specified
        Part Number: Not Specified
        Core Count: 4
        Core Enabled: 4
        Thread Count: 4
        Characteristics:
                64-bit capable

Handle 0x0401, DMI type 4, 40 bytes
Processor Information
        Socket Designation: CPU2
        Type: Central Processor
        Family: Unknown
        Manufacturer: Intel
        ID: 00 00 00 00 00 00 00 00
        Version: Not Specified
        Voltage: 1.4 V
        External Clock: Unknown
        Max Speed: 3600 MHz
        Current Speed: Unknown
        Status: Unpopulated
        Upgrade: Socket LGA771
        L1 Cache Handle: 0x0703
        L2 Cache Handle: 0x0704
        L3 Cache Handle: 0x0705
        Serial Number: Not Specified
        Asset Tag: Not Specified
        Part Number: Not Specified
        Characteristics:
                64-bit capable
 楼主| oppo 发表于 2014-10-31 20:31 | 显示全部楼层
This virtual machine is configured for 64-bit guest operating systems. However, 64-bit operation is not possible.

This host is VT-capable, but the VT implementation is incompatible with VMware Workstation.

联系我们|手机版|欧卡2中国 ( 湘ICP备11020288号-1 )

GMT+8, 2024-11-25 12:29 , Processed in 0.037077 second(s), 6 queries , Redis On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表