virsh 怎么刷新挂载的储存设备未挂载

flymanhi 的BLOG
用户名:flymanhi
文章数:102
评论数:14
访问量:93136
注册日期:
阅读量:5863
阅读量:12276
阅读量:410396
阅读量:1098532
51CTO推荐博文
原文地址:
使用libvirt管理kvm虚拟机(更新中) ( 15:40)
原文地址:使用libvirt管理kvm虚拟机(更新中) 作者:xjc2694
说明:这篇笔记为更好的管理虚拟化服务,如果仅仅是测试虚拟化,查看另一篇笔记:
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./centos/
yum clean all
yum makecache (一定要做)
yum list kernel
:kernel 2.6.18-238.9.1.el5
yum update kernel kernel-devel.x86_64 kernel-headers.x86_64
一、安装虚拟化管理工具
1、yum install virt-manager libvirt libvirt-python python-virtinst
1、kmod-kvm : kvm kernel module(s)
2、kvm : Kernel-based Virtual Machine
3、kvm-qemu-img : Qemu disk image utility
4、kvm-tools : KVM debugging and diagnostics tools
5、python-virtinst : Python modules and utilities for installing virtual machines
6、virt-manager : Virtual Machine Manager (GUI app, to install and configure VMs)
7、virt-viewer: Virtual Machine Viewer (another lightweight app to view VM console and/or install VMs)
9、bridge-utils : Utilities for configuring the Linux Ethernet bridge (this is recommended for KVM networking)
KVM Package Group RHEL comes with KVM software group which includes full virtualization support with KVM. You can list all packages in the group as follows:
# yum groupinfo KVM
2、Start the libvirtd daemon service
service libvirtd start
关于错误:
注:该错误出现在centos5.4,libvirtd 0.6.3
重启libvirtd后,启动guest时会出现下面的问题。
Apr 22 09:16:20 srv4 kernel: libvirtd[27156]: segfault at e3000 rip 1e161 rsp dfcd0 error 4
Apr 22 09:16:20 srv4 libvirtd: 09:16:20.739: error : internal error Unable to daemonize QEMU process
重启了host,问题解决
原因:/show_bug.cgi?id=505625
Everytime the virGetCapabilities() method is run, it destroys the existing virCapsPtr object and creates it again....without any of the selinux info. virt-manager runs this method. so once virt-manager has run, subsequent calls to get the security info will give the crash you see.
二、有关网络
http://wiki.libvirt.org/page/Networking
1、一般网络(又名NAT):guest可以访问外网,外网不能访问guest。
安装了libvirt后,一个NAT网络即可用。host被设置为192.168.122.1(virbr0),所有的guest将被分配为192.168.122.x
如果看不到virbr0
或者在virsh start &Name of KVM&时出现下面的错误:
Apr 22 08:50:37 srv4 libvirtd: 08:50:37.839: error : internal error Failed to add tap interface 'vnet%d' to bridge 'virbr0' : No such device
查看/var/log/message.log
Apr 22 08:57:10 srv4 dnsmasq[26000]: failed to open pidfile /var/run/libvirt/network/default.pid: Permission denied
Apr 22 08:57:10 srv4 dnsmasq[26000]: FAILED to start up
手动启动default network
virsh net-start default
error: Failed to start network default
error: internal error '/usr/sbin/dnsmasq --strict-order --bind-interfaces --pid-file=/var/run/libvirt/network/default.pid --conf-file=
--listen-address 192.168.122.1 --except-interface lo --dhcp-range 192.168.122.2,192.168.122.254 --dhcp-lease-max=253' exited with non-zero status 3 and signal 0:
dnsmasq: failed to open pidfile /var/run/libvirt/network/default.pid: Permission denied
解决办法:
我的当前系统:selinux-policy.noarch
2.4.6-203.el5
yum updata selinux-policy.noarch
selinux-policy.noarch
2.4.6-279.el5_5.2
service libvirtd restart
注:需要重启host,上面写了原因
# ifconfig virbr0
virbr0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:57 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:1 KiB)
一个故障:
不论是NAT,还是Bridge模式,guest都无法与其他服务器通信,而且NAT模式时无法通过dhcp获取IP。没有查到错误原因。
不使用virsh来启动,按照http://blog.chinaunix.net/space.php?uid=1838361&do=blog&id=234090文章介绍的方法来启动时,NAT及bridge模式都可以正常访问其他服务器。所以按照该文章的方法,在guest的xml文件中定义interface的部分,指定虚拟网卡为tap0,网络正常了,将指定的网卡名去掉,由virsh自动分配为vnet0,网络也是正常的,也可以通过dhcp获取IP了。原因未知。
另:virsh启动的log文件位于:/var/log/libvirt/qemu/
nat方式无法获取IP,service libvirtd restart 重启服务,恢复。
关于NAT方式,guest可以获取ip,但无法与访问公网:
有多个网卡?你的物理机由哪个网卡访问公网?例如,我的物理机由br0访问公网,则,修改default.xml文件,添加forward的dev参数。
virsh # net-dumpxml default
&name&default&/name&
&uuid&8d004490-ee73-4e36-b9ef-821d7e73f9f6&/uuid&
&forward dev='br0' mode='nat'/&
&bridge name='virbr0' stp='on' forwardDelay='0' /&
&ip address='192.168.122.1' netmask='255.255.255.0'&
&range start='192.168.122.2' end='192.168.122.254' /&
&/network&
virsh # net-define /etc/libvirt/qemu/network/default.xml
virsh # net-destroy default
virsh # net-start
2、Bridge网络(又名:共享物理网卡):guest可以访问外网,外网也可以访问guest
# cd /etc/sysconfig/network-scripts/
# cp ifcfg-eth0 ifcfg-br0
两个配置文件内容分别为:
/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BRIDGE=br0
/etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
TYPE=Bridge
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=221.193.136.121
NETMASK=255.255.255.0
ONBOOT=yes
The NM_CONTROLLED=no option was added because both device should not be controlled by the Network Manager for bridge to work.
重启network(当前连接会丢失,确保你总是可以访问host,否则要格外小心)
service network restart
关于错误:Bringing up interface eth0:
tg3 device eth0 does not seem to be present, delaying initialization.
原因:br0里没有加配置 TYPE=Bridge
Disable Netfilter processing in the bridged traffic.
在/etc/sysctl.conf文件中添加:
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
net.bridge.bridge-nf-filter-vlan-tagged = 0
验证是否生效
br0现在扮演eth0的角色。
Link encap:Ethernet
HWaddr 00:14:5E:C2:1E:40
inet addr:221.193.136.121
Bcast:221.193.136.255
Mask:255.255.255.0
inet6 addr: fe80::214:5eff:fec2:1e40/64 Scope:Link
UP BROADCAST RUNNING MULTICAST
RX packets:125 errors:0 dropped:0 overruns:0 frame:0
TX packets:81 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1 KiB)
TX bytes:1 KiB)
Link encap:Ethernet
HWaddr 00:14:5E:C2:1E:40
inet6 addr: fe80::214:5eff:fec2:1e40/64 Scope:Link
UP BROADCAST RUNNING MULTICAST
RX packets:206 errors:0 dropped:0 overruns:0 frame:0
TX packets:58 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2 KiB)
TX bytes:1 KiB)
Interrupt:74 Memory:da000000-da012800
也可以通过下面的命令查看桥接网络,可以看到eth0加到了桥接设备br0中:
# brctl show
bridge name
STP enabled
interfaces
三、创建KVM虚拟机的XML定义文件
关于KVM XML format
http://libvirt.org/formatdomain.html
1.1 用于从磁盘启动的XML文件
1、kvm guest 定义开始
&domain type='kvm'&
2、guest的short name。由字母和数字组成,不能包含空格
&name&centosvm1&/name&
3、uuid,由命令行工具 uuidgen生成。
&uuid&bdbb89fb-57d1-4d01-b3b7-ff33a9346ae6&/uuid&
4、在不reboot guest的情况下,guset可以使用的最大内存,以KB为单位
&memory&2048000&/memory&
5、guest启动时内存,可以通过virsh setmem来调整内存,但不能大于最大可使用内存。
&currentMemory&1024000&/currentMemory&
6、分配的虚拟cpu
&vcpu&2&/vcpu&
x86架构:i686
hvm:全虚拟化
kernel:指定guest使用的内核,如果使用ISO(安装时)或guset系统中(系统已经安装完成)的内核,不需要指定该项
initrd:指定guest使用的ram disk,如果使用ISO(安装时)或guest系统中(系统已经安装完成)的ram disk,不需要指定该项
注:kernel 和initrd文件位于RHEL系统光盘的images/pxeboot目录,拷贝这两个文件到本地磁盘,并指定路径。
注:这两个元素,如果是为了安装guset而指定,在安装完成以后即可以删除。
如果host开启了SELINUX,you also need to change the type of security context for the files to virt_image_t to allow libvirtd to access them for booting:
# chcon -t virt_image_t /tmp/vmlinuz-rhel54
# chcon -t virt_image_t /tmp/initrd-rhel54.img
After you change the security context, verify that the correct security context is assigned to them as shown in the following example:
# ls -Z /tmp|grep virt
-r--r--r-- root root root:object_r:virt_image_t initrd-rhel54.img
-r--r--r-- root root root:object_r:virt_image_t vmlinuz -rhel54
boot:指定启动设备,可以重复多行,指定不同的值,作为一个启动设备列表。
可以在cmdline元素中添加启动参数,例如,使用kickstart文件:
&cmdline&method=http://10.1.1.212/install/rhel5.4/x86_64
ks=http://10.1.1.212/install/autoinst/c20m2n05v3&/cmdline&
&type arch='x86_64' machine='pc'&hvm&/type&
&kernel&/tmp/vmlinuz-rhel54&/kernel&
&initrd&/tmp/initrd-rhel54.img&/initrd&
&boot dev='hd'/&
8、处理器特性
&features&
&/features&
关于处理器特性,查看:
http://blog.chinaunix.net/space.php?uid=1838361&do=blog&id=1753201
9、时钟。使用本地时间:localtime
&clock offset='utc'/&
仍然需要再计划任务中添加时间同步:
*/15 * * * * (/usr/sbin/ntpdate 210.72.145.44 & /dev/null 2&&1;/sbin/hwclock -w)
10、定义了在kvm环境中power off,reboot,或crash时的默认的动作为destroy。其他允许的动作包括:restart,preserve,rename-restart.
在这个例子中,destory之所以也用在了on_reboot元素中,是因为一旦安装完成,期望的guest动作是stop,以便从the installed guest operating system而不是从the installation kernel or ISO编辑guest的定义。
destroy:停止该虚拟机。相当于关闭电源
&on_poweroff&destroy&/on_poweroff&
&on_reboot&destroy&/on_reboot&
&on_crash&destroy&/on_crash&
11、设备定义开始
12、模拟元素,此处写法用于kvm的guest(xen怎么写?)
&emulator&/usr/libexec/qemu-kvm&/emulator&
13、用于kvm存储的文件。在这个例子中,在guest中显示为IDE设备。
使用qemu-img命令创建该文件,kvm image的默认目录为:/var/lib/libvirt/images/
&disk type='file' device='disk'&
&driver name='qemu' type='raw' cache='none'/&
&source file='/var/lib/libvirt/images/kvm3.img'/&
&target dev='hda' bus='ide'/&
这里需要注意:使用libvirt 0.6.3写的xml,没有&driver name='qemu' type='qcow2'/&参数,当将该xml放到libvirt 0.8版本时,该参数会默认为raw,所以会造成在0.6中可以启动的guest无法启动,更改参数即可
使用virtio:
采用普通的驱动,即硬盘和网卡都采用默认配置情况下,硬盘是 ide 模式,而网卡工作在 模拟的rtl 8139 网卡下,速度为100M 全双工。采用 virtio 驱动后,网卡工作在 1000M 的模式下,硬盘工作是SCSI模式下。
&disk type='file' device='disk'&
&driver name='qemu' type='raw' cache='none'/&
&source file='/usr/local/kvm/vmsample/disk.os'/&
&target dev='vda' bus='virtio'/&
硬盘采用 virtio 后,安装windows 系统,将不能正常的识别硬盘,解决的方法是:
从kvm 的官网下载virtio的驱动iso。
1. 先采用ide模式安装系统。
2. 安装完成后,添加一个virtio模式的硬盘。
3. 启动vm后,系统会自动搜索 SCSI的驱动,找到下载的virtio 驱动后,安装即可。
4. 修改vm 配置文件,删除掉添加的 vitro 硬盘后,修改ide硬盘为 virtio模式即可。
A Note About Virtio Drivers
Virtio is paravirtualized drivers for kvm/Linux. With this you can can run multiple virtual machines running unmodified Linux or Windows VMs. Each virtual machine has private virtualized hardware a network card, disk, graphics adapter, etc. According to Redhat:
Para-virtualized drivers enhance the performance of fully virtualized guests. With the para-virtualized drivers guest I/O latency decreases and throughput increases to near bare-metal levels. It is recommended to use the para-virtualized drivers for fully virtualized guests running I/O heavy tasks and applications.
关于cache=none
如果不加该参数,默认cache policy为write through。
kvm官方及IBM都推荐使用raw,设置cache为none,以关闭kvm磁盘的cache策略,让数据可以直接落在实体硬盘上(实体机上其实也有磁盘cache的,并不需要kvm为cache操心)
For the best storage performance on guest operating systems that use raw disk volumes or partitions,completely avoid the page cache on the host.
下面的帖子中有一段关于cache的内容:
/forum/viewthread.php?tid=205581&extra=&page=3
补充:可以定义多个磁盘,其他可行的磁盘定义:
Logical volume device:
&disk type='block' device='disk'&
&source 'dev=/dev/mapper/VolGroup01-LVM1'/&
&target dev='hdb'/&
Disk partition:
&disk type='block' device='disk'&
&source dev='/dev/sda4'/&
&target dev='hdb' bus='ide'/&
CD-ROM device:
&disk type='block' device='cdrom'&
&source 'dev=/dev/sde'&
&target dev='hdb'/&
&readonly/&
14、使用网桥类型。确保每个kvm guest的mac地址唯一。将创建tun设备,名称为vnetx(x为0,1,2...)
&interface type='bridge'&
&source bridge='br0'/&
&mac address=&3B:6E:01:69:3A:11&/&
&/interface&
补充:使用默认的虚拟网络代替网桥,即guest为NAT模式。也可以省略mac地址元素,这样将自动生成mac地址。
&interface type='network'&
&source network='default'/&
&mac address=&3B:6E:01:69:3A:11&/&
&/interface&
默认分配192.168.122.x/24的地址,也可以手动指定。网关为192.168.122.1
使用virtio:
采用普通的驱动,即硬盘和网卡都采用默认配置情况下,硬盘是 ide 模式,而网卡工作在 模拟的rtl 8139 网卡下,速度为100M 全双工。采用 virtio 驱动后,网卡工作在 1000M 的模式下,硬盘工作是SCSI模式下。
rhel5.6 guest with virtio interface can not boot successfully if the system installation would use the ide interface
/show_bug.cgi?id=647387
&interface type='bridge'&
&source bridge='br1'/&
&model type='virtio' /&
&/interface&
性能:通过物理机上拷贝
普通驱动:26.1M
virtio驱动:44.7M
因为交换机为100M,无法测试从其他物理机上拷贝。
15、输入设备
&input type='mouse' bus='ps2'/&
16、定义与guset交互的图形设备。在这个例子中,使用vnc协议。listen的地址为host的地址。prot为-1,表示自动分配端口号,通过以下的命令查找端口号:
virsh vncdisplay &KVM Guest Name&
注意:是passwd 而不是password
VNC is configured to listen on 127.0.0.1 by default. To make it listen on all public interfaces, edit /etc/libvirt/qemu.conf file.
&graphics type='vnc' listen='221.191.134.123' passwd='123456' port='-1' autoport='yes' keymap='en-us'/&
17、设备定义结束
&/devices&
18、KVM定义结束
&domain type='kvm'&
&name&centoskvm3&/name&
&uuid&bdbb89fb-57d1-4d01-b3b7-ff33a9346ae6&/uuid&
&memory&2048000&/memory&
&currentMemory&1024000&/currentMemory&
&vcpu&2&/vcpu&
&type arch='x86_64' machine='pc'&hvm&/type&
&boot dev='hd'/&
&features&
&/features&
&clock offset='localtime'/&
&on_poweroff&destroy&/on_poweroff&
&on_reboot&destroy&/on_reboot&
&on_crash&destroy&/on_crash&
&emulator&/usr/libexec/qemu-kvm&/emulator&
&disk type='file' device='disk' cache='none'&
&source file='/usr/local/kvm/centvm3.img'/&
&target dev='vda' bus='virtio'/&
&interface type='bridge'&
&mac address='3b:6e:01:69:3a:11'/&
&source bridge='br0'/&
&model type='virtio'/&
&/interface&
&input type='mouse' bus='ps2'/&
&graphics type='vnc' port='-1' autoport='yes' listen='221.196.131.121' keymap='en-us' passwd='123456'/&
&/devices&
1.2 用于从ISO启动的XML文件
virt-install --name vm1 --ram 512 --disk path=/usr/local/kvm/vm1/disk.os,size=10 --accelerate --cdrom=/usr/local/centos5.6/CentOS-5.6-x86_64-bin-DVD-1of2.iso --vnc 0.0.0.0:3
&domain type='kvm'&
&name&vmsample&/name&
&uuid&fee1dfbb-a8f8-2dbc175219&/uuid&
&memory&2677721&/memory&
&currentMemory&2677312&/currentMemory&
&vcpu&2&/vcpu&
&type arch='x86_64' machine='rhel5.4.0'&hvm&/type&
&boot dev='cdrom'/&
&features&
&/features&
&clock offset='localtime'&
&timer name='pit' tickpolicy='delay'/&
&on_poweroff&destroy&/on_poweroff&
&on_reboot&destroy&/on_reboot&
&on_crash&destroy&/on_crash&
&emulator&/usr/libexec/qemu-kvm&/emulator&
&disk type='file' device='disk'&
&driver name='qemu' type='raw' cache='none'/&
&source file='/usr/local/kvm/vmsample/disk.os'/&
&target dev='vda' bus='virtio'/&
&disk type='file' device='cdrom'&
&source file='/usr/local/centos5.6/CentOS-5.6-x86_64-bin-DVD-1of2.iso'/&
&target dev='hdb' bus='ide'/&
&readonly/&
&interface type='bridge'&
&source bridge='br0'/&
&/interface&
&interface type='bridge'&
&source bridge='br1'/&
&model type='virtio' /&
&/interface&
&input type='mouse' bus='ps2'/&
&graphics type='vnc' port='-1' autoport='yes' listen='1.1.1.1' passwd='11111v' keymap='en-us'/&
&model type='cirrus' vram='9216' heads='1'/&
&/devices&
启动后,磁盘空间为0?进入virsh ,etdi 虚拟机.xml,查看磁盘类型,为raw?你创建的磁盘是qcow2?
四、 使用virsh创建一个kvm虚拟机
当创建或编辑了一个kvm xml文件后,使用virsh tool创建kvm。
1、定义KVM
virsh define &Name of XML definition file&
For example:
# virsh define /usr/local/kvm/centvm3.xml
在后台,这个命令拷贝该xml文件到/etc/libvirt/qemu目录,文件名为xml里定义的kvm名称。并且正式定义一个新的kvm。
如何修改?
virsh edit &Name of KVM&
virsh define &Name of XML definition file&
virsh undefine &Name of KVM&
virsh define &Name of XML definition file&
2、启动KVM
virsh start &Name of KVM&
For example:
# virsh start centosvm3
查看vnc信息:
virsh vncdisplay centosvm3
也可以通过virt-viewer查看
virt-viewer &Name of KVM&
关闭kvm虚拟机:virsh destory &Name of KVM&
查看运行中的虚拟机:
virsh list
3、克隆虚拟机
virt-clone -o vm1 -n vm2 -f /usr/local/kvm/vm2/disk.os /usr/local/kvm/vm2/disk.data -d --prompt
因为我的vm1虚拟机有两个磁盘,所以,在克隆时需要制定两个磁盘文件,如果你不清楚顺序,可以将-f部分去掉,后面的--prompt,交互式,可以根据提示输入磁盘文件。
注意:克隆的xml文件会丢失vnc的passwd参数,需要手动添加。
克隆后,某个磁盘变为实际使用的大小?
qemu-img create -F qcow2 -b ./disk.data.1 -f raw disk.data 80G
在convert 或 create时,报错:
qemu-img could not open 磁盘文件
问题:当 qemu-img info 磁盘文件存在backing file 项时,会报这个错误。
backing file 来源:当使用qemu-img create创建磁盘时,会创建这个项
另外:当虚拟机正在使用该磁盘时,qemu-img info 磁盘文件时,也会出现这个错误。
关于qemu-img convert:
会创建新格式的磁盘,旧格式的磁盘仍然存在。
关于error: unknown OS type hvm
kernel没有加载模块,检查bios里是否开启了虚拟化
1、关闭guest的磁盘监控
# service smartd stop # chkconfig --del smartd
一篇不错的文章:
http://www.cyberciti.biz/faq/centos-rhel-linux-kvm-virtulization-tutorial/
了这篇文章
类别:┆阅读(0)┆评论(0)本篇记录在使用libvirt的时候遇到的一些情况,即解决方法.
出现Permission denied
[root@localhost vm]# virsh start centos
error: Failed to start domain centos
error: internal error process exited while connecting to monitor: qemu-system-x86_64: -drive file=/home/d/shixun/vm/vdisk.img,if=none,id=drive-ide0-0-0,format=qcow2: could not
open disk image /home/d/shixun/vm/vdisk.img: Permission denied
解决:/etc/libvirt/qemu.conf
# Some examples of valid values are:
# user = &qemu& # A user named &qemu&
# user = &+0& # Super user (uid=0)
# user = &100& # A user named &100& or a user with uid=100
user = &root&
# The group for QEMU processes run by the system instance. It can be
# specified in a similar way to user.
group = &root&
# Whether libvirt should dynamically change file ownership
# to match the configured user/group above. Defaults to 1.
# Set to 0 to disable file ownership changes.
dynamic_ownership = 0
我的这个没能解决问题
/etc/init.d/libvirtd restart 不管用
libvirt遇到死锁
在使用virsh对虚拟机进行动态迁移时,虚拟机没有开启.于是就去开启虚拟机,但是却发现无法运行.
Error starting domain: Timed out during operation: cannot acquire state change lock
libvirtError: Timed out during operation: cannot acquire state change lock
我进行了以下的步骤
virsh undefine centos
####Login as a root user and kill the libvirtd.
killall -9 libvirtd
rm /var/run/libvirtd.pid&& ##### Remove the libvirtd pid file.
/etc/init.d/libvirtd& restart&& #### Restart libvirtd.
在尝试上面的操作后,不起作用.
修改一下的domain的xml文件中的name标签,给虚拟机改个名字,期间我还删除了domain的xml文件里的qemu:commandline里面信息,重新define后就可以运行了.
迁移需要FQDN
在进行迁移的时候使用命令 virsh migrate –live ubuntu qemu+ssh://dest_ip/system
error: internal hostname on destination resolved to localhost, but migration requires an FQDN
解决:ssh进入到dest host机器,运行hostname domain 就好了.其中domian是一个域名.将接下来就可以进行迁移了.
启动nfs出现问题
启动NFS服务,出现问题
Failed to issue method call: Unit nfsserver.service failed to load: No such file or directory. See system logs and 'systemctl status nfsserver.service' for details.
解决:按照教程来就好了
# vim /etc/exports
/var/lib/libvirt/images *.(rw,no_root_squash,sync)
# service nfs start
# mount -t nfs storage_host:/var/lib/libvirt/images /var/lib/libvirt/images
挂载nfs出现问题
当去mount远程的nfs服务器,出现问题了.
mount.nfs: access denied by server while mounting 211.87.***.53:/mnt/nfs
解决:原来发现,在/etc/exports中,没有将/mnt/nfs添加进去,只能将里面有的文件夹才能mount到本机来.
可以先umoutn /mnt/nfs ,然后在mount看看能否成功
virsh关闭虚拟机
virsh shutdown 关闭虚拟机没起作用
解决:需要在虚拟机里安装一些东西
yum install acpid
chkconfig acpid on
service acpid start
virsh无法使用ssh协议访问远程机器
当我去远程查询信息的时候,virsh -c qemu+ssh://211.87.***.88/system
list&的时候出现了下面的问题.
error: failed to connect to the hypervisor
error: no valid connection
error: End of file while reading data: : Input/output error
查看日志&cat /var/log/secure | grep sshd&发现是我这里主动发出断开的.难道是检测到libvirtd有些问题导致的?
当时使用virt-manage可以查询到远程的信息.估计是sshd出现的问题把.
解决:我没有重新安装sshd,我是通过tcp协议进行迁移的,因为是做测试,所以没有考虑安全的问题.具体使用tcp进行迁移,查看&.
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:110853次
积分:2729
积分:2729
排名:第11551名
原创:162篇
转载:61篇
评论:15条

我要回帖

更多关于 i2c可以挂载多少设备 的文章

 

随机推荐