zoukankan      html  css  js  c++  java
  • [qemu][kvm] 在一个vmware虚拟机里安装qemu-kvm虚拟机

    说起来这个需求,简直是傻傻的。但却实实在在的摆在我的面前。。。。

    VM无外乎就是为了模拟场景:我现在要的场景就是一台很多个core的linux主机。但是我只有一个装了windows的笔记本。上边有一个VMware,而VMware又不能模拟超过hostCPU个数的guestCPU数。

    所以,用KVM在VMware里模拟一下。

    CentOS 安装 qemu:

    [root@D128 VM]# yum install qemu qemu-kvm

    首先,默认情况下,vmware没有开启虚拟化支持。在guest里运行kvm会报错:

    [root@D128 j]# ./start.sh 
    
    (process:2651): GLib-WARNING **: gmem.c:483: custom memory allocation vtable not supported
    Could not access KVM kernel module: No such file or directory
    failed to initialize KVM: No such file or directory

    可以在VMware的软件外部设置里,开启虚拟化支持,如图:

    最后,晒一下我的启动脚本:

    [root@D128 j]# cat start.sh 
    qemu-system-x86_64 -enable-kvm 
        -m 2G 
        -cpu Nehalem -smp cores=4,threads=2,sockets=2 
            -numa node,mem=1G,cpus=0-8,nodeid=0 
            -numa node,mem=1G,cpus=9-16,nodeid=1 
        -display vnc=0.0.0.0:1 
        -net nic,vlan=1,model=virtio,macaddr='00:00:00:01:00:01' 
        -net nic,vlan=2,model=virtio,macaddr='00:00:00:01:00:02' 
        -net tap,vlan=1,ifname=tap-1,script=no,downscript=no 
        -net tap,vlan=2,ifname=tap-2,script=no,downscript=no 
        -drive file=disk.img,if=virtio 
        &
    
    ip link set tap-1 up
    brctl addif br0 tap-1
    
    #-device vfio-pci,host='0000:00:19.0' 
    #    -cdrom /root/CentOS-7-x86_64-DVD-1708.iso 
    #    -boot order=d
  • 相关阅读:
    leetcode 443: String Compression,357: Count Numbers with Unique Digits
    C++ 中 freopen()函数的用法
    filter
    map
    os.listdir
    os.path.join
    assert
    numpy中的axis和Pytorch中的dim参数
    mac中qq接收视频存放的位置
    requests
  • 原文地址:https://www.cnblogs.com/hugetong/p/8716508.html
Copyright © 2011-2022 走看看