老的命令:

/root/BUILD_qemu/bin/qemu-system-x86_64 -enable-kvm \
-m 2G \
-cpu Nehalem -smp cores=,threads=,sockets= \
-numa node,mem=1G,cpus=-,nodeid= \
-numa node,mem=1G,cpus=-,nodeid= \
-display vnc=0.0.0.0: \
-net nic,vlan=1,model=virtio,macaddr='00:00:00:01:00:01' \
-net tap,vlan=1,ifname=tap-int,script=no,downscript=no \
-device virtio-net-pci,netdev=dev1,macaddr='00:00:00:01:00:02',vectors=,mq=on \
-netdev tap,ifname=tap-,id=dev1,script=no,downscript=no,vhost=on,queues=16 \
-drive file=disk.img,if=virtio \
-cdrom /root/CentOS--x86_64-DVD-.iso \
-boot order=c \

在qemu-2.11-0 会报错如下:

qemu-system-x86_64: -net nic,vlan=,model=virtio,macaddr=:::::: 'vlan' is deprecated. Please use 'netdev' instead.

详细用法:https://qemu.weilnetz.de/doc/qemu-doc.html#Network-options

摘要:

-nic [tap|bridge|user|l2tpv3|vde|netmap|vhost-user|socket][,...][,mac=macaddr][,model=mn]
This option is a shortcut for configuring both the on-board (default) guest NIC hardware and the host network backend in one go.
The host backend options are the same as with the corresponding -netdev options below. The guest NIC model can be set with model=modelname.
Use model=help to list the available device types. The hardware MAC address can be set with mac=macaddr. The following two example do exactly the same, to show how -nic can be used to shorten the command line length (note that the e1000 is
the default on i386, so the model=e1000 parameter could even be omitted here, too): qemu-system-i386 -netdev user,id=n1,ipv6=off -device e1000,netdev=n1,mac=:::::
qemu-system-i386 -nic user,ipv6=off,model=e1000,mac=:::::

简单解释:

两个方法:

  A,用 -netdev和-device配合,-device需要志明model和mac,已经netdev的名字(这里是n1)是两个配置连接起来。

    所有可选的参数见:

[root@D128 j]# /root/BUILD_qemu/bin/qemu-system-x86_64 -device help

    不同的设备参数不同,需要查询详细的选项,如e1000e

[root@D128 j]# /root/BUILD_qemu/bin/qemu-system-x86_64 -device e1000e,help
e1000e.rombar=uint32
e1000e.disable_vnet_hdr=uint8 (Do not use virtio headers, perform SW offloads emulation instead)
e1000e.x-pcie-lnksta-dllla=bool (on/off)
e1000e.bootindex=int32
e1000e.multifunction=bool (on/off)
e1000e.romfile=str
e1000e.vlan=int32 (Integer VLAN id to connect to)
e1000e.command_serr_enable=bool (on/off)
e1000e.x-pcie-extcap-init=bool (on/off)
e1000e.addr=int32 (Slot and optional function number, example: 06.0 or )
e1000e.mac=str (Ethernet -byte MAC Address, example: :::::)
e1000e.netdev=str (ID of a netdev to use as a backend)
e1000e.subsys_ven=uint16 (PCI device Subsystem Vendor ID)
e1000e.subsys=uint16 (PCI device Subsystem ID)

  B, 使用简化的命令,-nic,功能同A。同样需要指明model和mac。可选参数见:

[root@D128 j]# /root/BUILD_qemu/bin/qemu-system-x86_64 -nic model=help
qemu: Supported NIC models: e1000,e1000-82544gc,e1000-82545em,e1000e,i82550,i82551,i82557a,i82557b,i82557c,i82558a,i82558b,i82559a,i82559b,i82559c,
i82559er,i82562,i82801,ne2k_pci,pcnet,rocker,rtl8139,virtio-net-pci,vmxnet3
[root@D128 j]#

改过之后的启动脚本:

/root/BUILD_qemu/bin/qemu-system-x86_64 -enable-kvm \
-m 2G \
-cpu Nehalem -smp cores=,threads=,sockets= \
-numa node,mem=1G,cpus=-,nodeid= \
-numa node,mem=1G,cpus=-,nodeid= \
-display vnc=0.0.0.0: \
-device e1000e,netdev=dev0,mac='00:00:00:01:00:01' \
-netdev tap,ifname=tap-int,id=dev0,script=no,downscript=no,vhost=on \
-device virtio-net-pci,netdev=dev1,mac='00:00:00:01:00:02',vectors=,mq=on \
-netdev tap,ifname=tap-,id=dev1,script=no,downscript=no,vhost=on,queues=16 \
-drive file=disk.img,if=virtio \
-cdrom /root/CentOS--x86_64-DVD-.iso \
-boot order=c \
&

-----------------------------------------------------------------------------------------------------------------------

依照如下步骤。虽然能编译,也能用,但是用起来还是有问题的,不清楚为什么。

比如: 1. kvm不好用,运行起来特别慢。2。 旧的image无法boot。

-----------------  update ---------------

改了些编译参数,再编译:

[root@D128 qemu-2.12.0-rc3]# yum install ncurses-devel
[root@D128 qemu-2.12.0-rc3]# ./configure --enable-curses --enable-vhost-user --prefix=/root/BUILD_qemu/ --target-list=x86_64-softmmu --disable-gtk --enable-docs --enable-numa --enable-kvm --enable-modules --enable-system --enable-linux-user

支持了什么,configure的输出里都会打印出来。

可能会造成影响的参数包括

--enable-modules --enable-system --enable-linux-user

以上的参数,对效果影响没有区别。。。。

跟其他同事又找了一组设置:

./configure \
--disable-bluez \
--disable-brlapi \
--disable-curses \
--disable-debug-tcg \
--disable-fdt \
--disable-guest-agent \
--disable-live-block-migration --disable-qom-cast-debug \
--disable-sdl --disable-sparse --disable-strip \
--disable-vnc-jpeg --disable-xen --enable-docs \
--enable-kvm \
--enable-lzo --enable-seccomp --enable-snappy \
--enable-werror \
--block-drv-ro-whitelist=vmdk,vhdx,vpc,https \
--block-drv-rw-whitelist=qcow2,raw,file,host_device,nbd,gluster,blkdebug,luks \
--disable-xen-pci-passthrough --disable-guest-agent-msi --enable-attr \
--enable-coroutine-pool --enable-debug-info \
--enable-gnutls \
--enable-numa \
--enable-system \
--enable-tools \
--enable-vhost-net \
--enable-vhost-vsock \
--enable-vnc \
--enable-debug \
--tls-priority=NORMAL \
--with-coroutine=ucontext \
--extra-cflags="-O2 -g -pipe -Wall -fexceptions \
-fstack-protector-strong --param=ssp-buffer-size= -m64 -mtune=generic -fPIE -DPIE" \
--extra-ldflags=" -pie -Wl,-z,relro -Wl,-z,now" \
--target-list=x86_64-softmmu

还是不行。。。

再试一次:卸载掉qemu-2.0.0的rpm,安装自编译的qemu到系统目录。

[root@D128 qemu-2.12.-rc3]# yum autoremove qemu qemu-kvm
[root@D128 qemu-2.12.-rc3]# ./configure --enable-curses --enable-vhost-user --target-list=x86_64-softmmu --disable-gtk --enable-docs --enable-numa --enable-kvm --enable-system --enable-modules

还是不行。。。 算了。。。

始终提示CPU STUCK

回退一个版本到2.10

[root@D128 qemu]# git branch
master
* stable-2.10
[root@D128 qemu]# git submodule init
Submodule 'roms/QemuMacDrivers' (git://git.qemu.org/QemuMacDrivers.git) registered for path 'roms/QemuMacDrivers'
[root@D128 qemu]# git submodule update --recursive

再编译:

还是不行。。。。

错误类似:

[   28.050008] BUG: soft lockup - CPU# stuck for 23s! [systemd-udevd:]
[ 56.050010] BUG: soft lockup - CPU# stuck for 23s! [systemd-udevd:]
[ 84.050006] BUG: soft lockup - CPU# stuck for 23s! [systemd-udevd:]
[ 112.050007] BUG: soft lockup - CPU# stuck for 22s! [systemd-udevd:]
[ 140.050006] BUG: soft lockup - CPU# stuck for 22s! [systemd-udevd:]
[ 168.050009] BUG: soft lockup - CPU# stuck for 22s! [systemd-udevd:]
[ 196.050008] BUG: soft lockup - CPU# stuck for 22s! [systemd-udevd:]
[ 224.050006] BUG: soft lockup - CPU# stuck for 22s! [systemd-udevd:]
[ 252.050014] BUG: soft lockup - CPU# stuck for 22s! [systemd-udevd:]
[ 280.050006] BUG: soft lockup - CPU# stuck for 22s! [systemd-udevd:]

退到2.9版本:

2.9也是这样。好的,放弃了。。。。

==========================   我又回来了,@ 2018-04-20  =====================

一直耿耿于怀这个问题。

那么,首先,soft lookup到底是什么问题? 见:

https://www.cnblogs.com/lyhabc/p/6640012.html

简单的说,就是内核出了问题。然后我用的是标准CentOS7的发行版,所以基本上就是驱动的问题。

那么对于一个qemu的虚拟机来说,唯一能做的就是改变硬件,如下:

我去掉了所有的网卡,并且去掉disk的virtio驱动。

果然正常运行了!

/root/BUILD_qemu/bin/qemu-system-x86_64 -enable-kvm \
-m 2G \
-cpu Nehalem -smp cores=,threads=,sockets= \
-numa node,mem=1G,cpus=-,nodeid= \
-numa node,mem=1G,cpus=-,nodeid= \
-display vnc=0.0.0.0: \
-drive file=disk.img \

查看文档,改变一下参数,重新把virtio用起来。

在那之前,再编一个qemu-2.12

[root@D128 qemu-2.12.-rc3]# ./configure --prefix=/root/BUILD_qemu/ --target-list=x86_64-softmmu --disable-gtk --enable-virtfs

不认识virtio,换了参数也不行:

#    -device virtio-blk-pci,scsi=off,bus=pci.,addr=0x7,drive=disk0,bootindex= \
# -drive file=disk.img,if=none,id=disk0 \

kvm+virtio 就会有问题。很可能是VMware的原因。

--------------------------

差一个题外内容:

What is the difference and relationship between “xx-softmmu” and “xx-linux-user”?
To put it simply, xxx-softmmu will compile qemu-system-xxx, which is an emulated machine for xxx architecture (System Emulation).
When it resets, the starting point will be the reset vector of that architecture. While xxx-linux-user, compiles qemu-xxx,
which allows you to run user application in xxx architecture (User-mode Emulation). Which will seek the user applications'
main function, and start execution from there. See https://en.wikipedia.org/wiki/QEMU#Operating_modes

https://stackoverflow.com/questions/32435138/what-is-the-difference-and-relationship-between-xx-softmmu-and-xx-linux-user?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

[qemu] qemu旧的net参数已经不再可用了,新的这样用。的更多相关文章

  1. Apache服务停止:信号灯超时时间已到,指定的网络名不再可用

    环境说明:Apache2.4.10,Windows Server 2008 R2 问题说明: apache服务用于下载文件,但是在运行一段时间后,突然挂了. 其错误提示如下所示: [error] (7 ...

  2. apache 指定的网络名不再可用 原因及解决方法

    1.出现问题状况: 出现问题网站:http://www.ayyzz.cn/ 前段时间作文大全网出现有时候比较慢,有时候“找不到网页”404错误:另外在error.log里也报错: [Mon May 0 ...

  3. \\ip 映射 指定的网络名不再可用

    问题:\\ip 映射  指定的网络名不再可用 解决方法:服务器端打开服务列表  services.msc 启动两个进程 1.Computer Browser 2. Workstation 就正常了~~ ...

  4. nginx gunicorn 部署flask,带参数链接不可用的现象(笔记)

    微信小程序后台,开启 gunicorn之后屏幕会输出打印结果,一旦关闭shell 带参数链接不可用,只有开启shell才能使用, 一针见血 : 注释掉所有print语句,关闭shell 带参数的链接  ...

  5. AIO 开始不定时的抛异常: java.io.IOException: 指定的网络名不再可用

    一天里会抛出几个这样的错误,但发现服务还在正常的运行. java.io.IOException: 指定的网络名不再可用. at sun.nio.ch.Iocp.translateErrorToIOEx ...

  6. ubuntu14.04 Samba服务无法访问 可能没有权限 指定的网络名不再可用的问题

    按常规配置后,在windows资源管理器中登陆samba服务器,看得到分享目录却无法打开,弹出"无法访问.您可能没有权限使用网络资源,请与这台服务器的管理员联系以查明您是否有访问权限.指定的 ...

  7. Java1.0的AWT(旧AWT)和Java1.1以后的AWT(新AWT)有着很大的区别

    Java1.0的AWT(旧AWT)和Java1.1以后的AWT(新AWT)有着很大的区别,新的AWT克服了旧AWT的很多缺点,在设计上有较大改进,使用也更方便,这里主要介绍新的AWT, 但在Java1 ...

  8. 关于“在从服务器接收结果时发生传输级错误。 (provider: TCP Provider, error: 0 - 指定的网络名不再可用。)”的解决方法之一

    最近几天发现连sql数据库服务器的时候,总是提示“在从服务器接收结果时发生传输级错误. (provider: TCP Provider, error: 0 - 指定的网络名不再可用.)”的错误. 网上 ...

  9. [qemu] qemu从源码编译安装

    环境:CentOS7-1804 下载最新的源码: ┬─[tong@T7:~/Src/thirdparty/PACKAGES]─[:: AM] ╰─>$ axel https://download ...

随机推荐

  1. 译:3.RabbitMQ Java Client 之 Publish/Subscribe(发布和订阅)

    在上篇 RabbitMQ 之Work Queues (工作队列)教程中,我们创建了一个工作队列,工作队列背后的假设是每个任务都交付给一个工作者. 在这一部分,我们将做一些完全不同的事情 - 我们将向多 ...

  2. 译:4.RabbitMQ Java Client 之 Routing(路由)

    在上篇博文 译:3.RabbitMQ 之Publish/Subscribe(发布和订阅)  我们构建了一个简单的日志系统 我们能够向许多接收者广播日志消息. 在本篇博文中,我们将为其添加一个功能 - ...

  3. pdf 移除密码 去除水印 批量去除水印 编辑文字 批量替换文字

    1.pdf除密码: http://pan.baidu.com/share/link?shareid=308194398&uk=370045712  2.去除水印:http://wenku.ba ...

  4. iOS 版本更新(强制更新)检测问题

    iOS 版本更新(强制更新)检测问题 通常iOS系统中是默认设置再wifi状态,且网络状况良好下自己更新应用的. 但是如果用户设置了不自动更新,但是我们的APP出现重要的版本,一定需要用户更新的情况下 ...

  5. Java知多少(34)final关键字:阻止继承和多态

    在 Java 中,声明类.变量和方法时,可使用关键字 final 来修饰.final 所修饰的数据具有“终态”的特征,表示“最终的”意思.具体规定如下: final 修饰的类不能被继承. final ...

  6. 关于ECMP 等价路由

    1.ECMP简介 Equal-CostMultipathRouting,等价多路径.即存在多条到达同一个目的地址的相同开销的路径.当设备支持等价路由时,发往该目的 IP 或者目的网段的三层转发流量就可 ...

  7. 字符串时间与Unix时间戳相互转换

    字符串时间与Unix时间戳相互转换 /** * @Author: wangkun * @Date : 2016/1/21 13:43 * @Description : 字符串时间转换为Unix时间戳 ...

  8. 年关将至业内警示P2P跑路风险

    年关将近,P2P网贷行业的问题平台亦不断增多,“跑路潮”会否再现,业内人士讨论热烈. “从历年数据统计来看,问题平台接近线性向上的增长趋势,即时间越往后,问题平台占比就越高,而每逢年关,问题平台占比都 ...

  9. 怎样利用Heartbeat与Floating IP在Ubuntu 14.04上创建高可用性设置

    提供 ZStack社区 内容简单介绍 Heartbeat是一款开源程序,负责将集群基础设施容量--包括集群成员与消息收发--交付至客户server. Hearbeat在高可用性server基础设施其中 ...

  10. ethereum发erc20token

    以太坊发币智能合约代码简单介绍: 发币代码如下(https://ethereum.org/token#the-code网站中获得): pragma solidity ^; interface toke ...