Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2809140
  • 博文数量: 587
  • 博客积分: 6356
  • 博客等级: 准将
  • 技术积分: 6410
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-23 10:54
个人简介

器量大者,福泽必厚

文章分类

全部博文(587)

文章存档

2019年(3)

2018年(1)

2017年(29)

2016年(39)

2015年(66)

2014年(117)

2013年(136)

2012年(58)

2011年(34)

2010年(50)

2009年(38)

2008年(16)

分类: LINUX

2012-07-16 20:14:05

1:[root@ungeovirtual ~]# sh install.sh 
ERROR    Error creating cdrom disk: Checking installer location failed: Could not find media '--bridge=xenbr0'.
[root@ungeovirtual ~]# ls
 anaconda-ks.cfg  CentOS-5.8-x86_64-bin-DVD-1of2.iso  install.log  install.log.syslog  install.sh  shopex
[root@ungeovirtual ~]# cat install.sh 
virt-install -n vm01 -r 512 --vcpus=1 -f /data/vm01 -s 20 -p -l  --bridge=xenbr0      --nographics  ##红色字体有问题
[root@ungeovirtual ~]# vi  install.sh 
virt-install -n vm01 -r 512 --vcpus=1 -f /data/vm01 -s 20 -p -l    --bridge=xenbr0  --nographics
~
原因:-l 是--location的意思,如果指定--bridge=xenbr0   显然找不到media!
解决方法: -l   放在一起就可以了

2:2:[root@ungeovirtual ~]# sh install.sh 

Starting install...
ERROR    Could not find an installable distribution at ''
Domain installation may not have been
 successful.  If it was, you can restart your domain
 by running 'virsh start vm01'; otherwise, please
 restart your installation.
ERROR    Could not find an installable distribution at ''
Traceback (most recent call last):
  File "/usr/sbin/virt-install", line 895, in ?
    main()
......

原因:仅仅是开启了apache服务,没有将iso文件挂载到/usr/local/apache/htdocs,
查找原因:在windows客户端上的浏览器中使用  发现it works
显然没有挂载,只需要挂载iso到htdocs目录下即可!即mount -o loop /root/rhel.iso /usr/local/apache2/htdocs

3:kvm安装虚拟机时提示不支持full virtualization
我的cpu支持vmx,见输出如下:
[root@ungeokvm ~]# cat /proc/cpuinfo  | grep vmx
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx lm constant_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr lahf_lm
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx lm constant_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr lahf_lm
[root@ungeokvm ~]# 
BIOS中开启了VT  
但使用kvm安装虚拟机时,full virtualization按钮灰显,提示不支持虚拟化!
而且[root@h4 xen]# lsmod  | grep kvm没有输出,显然kvm相关模块没有被加载!如果kvm相关模板被加载正常的输入如下:

  1. [root@h4 xen]# lsmod | grep kvm
  2. kvm_intel 85256 1
  3. kvm 226080 2 ksm,kvm_intel
  4. [root@h4 xen]#
也可以通过demsg来查找kvm模块不能被加载的原因:
如果kvm正常工作,输入类似如下:

  1. [root@h4 xen]# dmesg | grep kvm
  2. kvm: virtualization flags detected on this hardware: vmx tpr_shadow vnmi flexpriority
  3. loaded kvm module (kvm-83-249.el5.centos.4)
  4. kvm模块的位置如下:
  5. [root@h4 kmod-kvm]# find  / -name "kvm*"
  6. /usr/bin/kvm_stat
  7. /usr/bin/kvmtrace_format
  8. /usr/bin/kvmtrace
  9. /usr/lib/python2.4/site-packages/sos/plugins/kvm.pyo
  10. /usr/lib/python2.4/site-packages/sos/plugins/kvm.pyc
  11. /usr/lib/python2.4/site-packages/sos/plugins/kvm.py
  12. /usr/src/kernels/2.6.18-308.el5-xen-x86_64/include/asm-x86_64/kvm_para.h
  13. /usr/src/kernels/2.6.18-308.el5-xen-x86_64/include/linux/kvm_para.h
  14. /usr/src/kernels/2.6.18-308.el5-xen-x86_64/include/asm-i386/kvm_para.h
  15. /usr/share/kvm
  16. /sys/module/kvm_intel
  17. /sys/module/kvm
  18. /sys/class/misc/kvm
  19. /sys/devices/system/kvm
  20. /sys/devices/system/kvm/kvm0
  21. /var/log/libvirt/qemu/kvm01.log
  22. /lib/modules/2.6.18-308.el5/weak-updates/kmod-kvm/kvm.ko
  23. /lib/modules/2.6.18-308.el5/weak-updates/kmod-kvm/kvm-intel.ko
  24. /lib/modules/2.6.18-308.el5/weak-updates/kmod-kvm/kvm-amd.ko
  25. /lib/modules/2.6.18-308.4.1.el5/extra/kmod-kvm/kvm.ko
  26. /lib/modules/2.6.18-308.4.1.el5/extra/kmod-kvm/kvm-intel.ko
  27. /lib/modules/2.6.18-308.4.1.el5/extra/kmod-kvm/kvm-amd.ko
  28. /root/Desktop/kvminstall.png
  29. /etc/libvirt/qemu/kvm01.xml
  30. /etc/sysconfig/modules/kvm.modules
  31. /data/kvm02.img
  32. /data/kvm01.img
  33. /dev/kvm
  34. [root@h4 kmod-kvm]# uname  -r
  35. 2.6.18-308.el5
  36. [root@h4 kmod-kvm]# cd /lib/modules/2.6.18-308.el5/weak-updates/
  37. [root@h4 weak-updates]# ll
  38. total 24
  39. drwxr-xr-x 2 root root 4096 Feb 25  2011 cmirror
  40. drwxr-xr-x 2 root root 4096 Feb 25  2011 gnbd
  41. drwxr-xr-x 2 root root 4096 Feb 25  2011 kmod-kvm
  42. [root@h4 weak-updates]# cd kmod-kvm/
  43. [root@h4 kmod-kvm]# ls
  44. ksm.ko  kvm-amd.ko  kvm-intel.ko  kvm.ko
  45. [root@h4 kmod-kvm]# ll
  46. total 16
  47. lrwxrwxrwx 1 root root 53 Feb 25  2011 ksm.ko -> /lib/modules/2.6.18-308.4.1.el5/extra/kmod-kvm/ksm.ko
  48. lrwxrwxrwx 1 root root 57 Feb 25  2011 kvm-amd.ko -> /lib/modules/2.6.18-308.4.1.el5/extra/kmod-kvm/kvm-amd.ko
  49. lrwxrwxrwx 1 root root 59 Feb 25  2011 kvm-intel.ko -> /lib/modules/2.6.18-308.4.1.el5/extra/kmod-kvm/kvm-intel.ko
  50. lrwxrwxrwx 1 root root 53 Feb 25  2011 kvm.ko -> /lib/modules/2.6.18-308.4.1.el5/extra/kmod-kvm/kvm.ko
  51. [root@h4 kmod-kvm]# 

故障原因:在centos5安装时同时安装了xen和kvm,默认启动linux的内核为 kernel /xen.gz-2.6.18-308.el5 
只需要修改为普通内核启动就可以了!
[root@ungeokvm ~]# cat /etc/grub.conf 
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/hda2
#          initrd /initrd-version.img
#boot=/dev/hda
#default=0 ##默认为0
default=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-308.el5xen)
        root (hd0,0)
        kernel /xen.gz-2.6.18-308.el5 
        module /vmlinuz-2.6.18-308.el5xen ro root=LABEL=/ rhgb quiet
        module /initrd-2.6.18-308.el5xen.img
title CentOS-base (2.6.18-308.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-308.el5 ro root=LABEL=/ rhgb quiet
        initrd /initrd-2.6.18-308.el5.img
[root@ungeokvm ~]# 
将0修改为1即可! ##这个问题困扰了我很长的时间!

 

4:在使用kvm安装windows vm时,安装过程中提示window 2003时找不到硬盘!
原因:在选择安装os和类型的时候,选择了linux和rhel5.4以后的版本!
 而实际上是安装的windows机器!换成windows和window2003 就可以了


5:xen虚拟机上在线添加一块硬盘:


  1. [root@ungeovirtual data]# dd if=/dev/zero of=/data/vm01add.img bs=1M count=5000
  2. [root@ungeovirtual data]# xm block-attach vm01 tap:aio:/data/vm01add.img xvdb w
  3. [root@ungeovirtual data]# xm console vm01
  4. [root@ungeo198 ~]# fdisk -l
  5. Disk /dev/xvda: 21.4 GB, 21474836480 bytes
  6. 255 heads, 63 sectors/track, 2610 cylinders
  7. Units = cylinders of 16065 * 512 = 8225280 bytes
  8. Device Boot Start End Blocks Id System
  9. /dev/xvda1 * 1 13 104391 83 Linux
  10. /dev/xvda2 14 140 1020127+ 82 Linux swap / Solaris
  11. /dev/xvda3 141 2610 19840275 83 Linux
  12. Disk /dev/xvdb: 5242 MB, 5242880000 bytes
  13. 255 heads, 63 sectors/track, 637 cylinders
  14. Units = cylinders of 16065 * 512 = 8225280 bytes
  15. Disk /dev/xvdb doesn't contain a valid partition table
  16. [root@ungeo198 ~]# sync
  17. [root@ungeo198 ~]# sync
  18. [root@ungeo198 ~]# reboot

点击(此处)折叠或打开

  1. CentOS release 5.8 (Final)
  2. Kernel 2.6.18-308.el5xen on an x86_64
  3. ungeo198 login: root
  4. Password:
  5. Last login: Thu Jul 19 17:09:50 on xvc0
  6. [root@ungeo198 ~]# df -h
  7. Filesystem Size Used Avail Use% Mounted on
  8. /dev/xvda3 19G 2.7G 15G 16% /
  9. /dev/xvda1 99M 14M 81M 15% /boot
  10. tmpfs 256M 0 256M 0% /dev/shm
  11. [root@ungeo198 ~]# fdisk -l
  12. Disk /dev/xvda: 21.4 GB, 21474836480 bytes
  13. 255 heads, 63 sectors/track, 2610 cylinders
  14. Units = cylinders of 16065 * 512 = 8225280 bytes
  15. Device Boot Start End Blocks Id System
  16. /dev/xvda1 * 1 13 104391 83 Linux
  17. /dev/xvda2 14 140 1020127+ 82 Linux swap / Solaris
  18. /dev/xvda3 141 2610 19840275 83 Linux
  19. Disk /dev/xvdb: 5242 MB, 5242880000 bytes
  20. 255 heads, 63 sectors/track, 637 cylinders
  21. Units = cylinders of 16065 * 512 = 8225280 bytes
  22. Disk /dev/xvdb doesn't contain a valid partition table ##显然硬盘已经添加

第二种方法添加一块硬盘:

查看vm01的硬盘情况:

[root@ungeovirtual data]# xm block-list vm01
Vdev  BE handle state evt-ch ring-ref BE-path
51712    0    0     4      6      8     /local/domain/0/backend/tap/2/51712 

手动修改/etc/xen/vm01配置文件,然后重启vm ,然后显示如下:

添加后的配置文件:

[root@ungeovirtual xen]# cat vm01  | grep tap
disk = [ "tap:aio:/data/vm01,xvda,w","tap:aio:/data/vm01add,xvdb,w" ] #红色字体为添加部分

然后重启虚拟机,我在虚拟机中直接reboot,但vm重启后,硬盘还没没有被添加上,后来poweroff后,重新再启动,就发现新硬盘了!

  1. [root@ungeovirtual xen]# xm block-list vm01
  2. Vdev BE handle state evt-ch ring-ref BE-path
  3. 51712 0 0 4 6 8 /local/domain/0/backend/tap/4/51712
  4. 51728 0 0 4 7 9 /local/domain/0/backend/tap/4/51728

xm console vm01 后输出的结果如下:

  1. [root@ungeo198 ~]# fdisk -l
  2. Disk /dev/xvda: 21.4 GB, 21474836480 bytes
  3. 255 heads, 63 sectors/track, 2610 cylinders
  4. Units = cylinders of 16065 * 512 = 8225280 bytes
  5. Device Boot Start End Blocks Id System
  6. /dev/xvda1 * 1 13 104391 83 Linux
  7. /dev/xvda2 14 140 1020127+ 82 Linux swap / Solaris
  8. /dev/xvda3 141 2610 19840275 83 Linux
  9. Disk /dev/xvdb: 5242 MB, 5242880000 bytes
  10. 255 heads, 63 sectors/track, 637 cylinders
  11. Units = cylinders of 16065 * 512 = 8225280 bytes
  12. Disk /dev/xvdb doesn't contain a valid partition table  #显然已经被添加


6:虚拟机destroy后出现了问题


  1. [root@ungeovirtual data]# xm console vm01 #执行后不能进入系统,提示如下:
  2. *** An error occurred during the file system check.
  3. *** Dropping you to a shell; the system will reboot
  4. *** when you leave the shell.
  5. *** Warning -- SELinux is active
  6. *** Disabling security enforcement for system recovery.
  7. *** Run 'setenforce 1' to reenable.
  8. Give root password for maintenance
  9. (or type Control-D to continue):
  10. (Repair filesystem) 2 # fdisk -l
  11. Disk /dev/xvda: 21.4 GB, 21474836480 bytes
  12. 255 heads, 63 sectors/track, 2610 cylinders
  13. Units = cylinders of 16065 * 512 = 8225280 bytes
  14. Device Boot Start End Blocks Id System
  15. /dev/xvda1 * 1 13 104391 83 Linux
  16. /dev/xvda2 14 140 1020127+ 82 Linux swap / Solaris
  17. /dev/xvda3 141 2610 19840275 83 Linux
  18. (Repair filesystem) 3 # umount /dev/xvda3
  19. (Repair filesystem) 4 # fsck -y /dev/xvda3
  20. fsck 1.39 (29-May-2006)
  21. e2fsck 1.39 (29-May-2006)
  22. / contains a file system with errors, check forced.
  23. Pass 1: Checking inodes, blocks, and sizes
  24. Extended attribute block 984272 has reference count 1024, should be 1023. Fix? yes
  25. Extended attribute block 984064 has reference count 1023, should be 1024. Fix? yes
  26. Extended attribute block 4260863 has reference count 2, should be 6. Fix? yes
  27. Pass 2: Checking directory structure
  28. Pass 3: Checking directory connectivity
  29. Pass 4: Checking reference counts
  30. Unattached inode 1765440
  31. Connect to /lost+found? yes
  32. Inode 1765440 ref count is 2, should be 1. Fix? yes
  33. Unattached inode 1765441
  34. Connect to /lost+found? yes
  35. Inode 1765441 ref count is 2, should be 1. Fix? yes
  36. Unattached inode 1765442
  37. Connect to /lost+found? yes
  38. Inode 1765442 ref count is 2, should be 1. Fix? yes
  39. Unattached inode 1765443
  40. Connect to /lost+found? yes
  41. Inode 1765443 ref count is 2, should be 1. Fix? yes
  42. Pass 5: Checking group summary information
  43. Block bitmap differences: -(1836030--1836031) +(1836032--1836033) +1839104 -1847296 +1859584 -1859585 +2032707 -2043910
  44. Fix? yes
  45. Free blocks count wrong for group #63 (20762, counted=20759).
  46. Fix? yes
  47. Free blocks count wrong (4102368, counted=4102365).
  48. Fix? yes
  49. Inode bitmap differences: +(1765440--1765443)
  50. Fix? yes
  51. /: ***** FILE SYSTEM WAS MODIFIED *****
  52. /: ***** REBOOT LINUX *****
  53. /: 110685/4961280 files (0.5% non-contiguous), 857703/4960068 blocks
  54. (Repair filesystem) 5 # exit
  55. exit
  56. Unmounting file systems
  57. Automatic reboot in progress.
  58. Restarting system.  ##重启后再次执行xm console即可正常!

7:xm mem-set修改vm的内存:

  1. [root@ungeovirtual xen]# xm console vm02 ##登录虚拟机
  2. CentOS release 5.8 (Final)
  3. Kernel 2.6.18-308.el5xen on an x86_64
  4. ungeo199 login: root
  5. Password:
  6. Last login: Wed Jul 25 10:47:34 on xvc0
  7. [root@ungeo199 ~]# free -m ##查看虚拟机的内存大小
  8. total used free shared buffers cached
  9. Mem: 512 240 271 0 16 151
  10. -/+ buffers/cache: 72 439
  11. Swap: 996 0 996
  12. [root@ungeo199 ~]#
  13. [root@ungeovirtual xen]# xm mem-set vm02 400 ##在另一个端口中执行此命令
  14. [root@ungeo199 ~]# free -m #在虚拟机中再次执行free -m 显然已经修改为400m了!
  15. total used free shared buffers cached
  16. Mem: 400 240 159 0 16 151
  17. -/+ buffers/cache: 72 327
  18. Swap: 996 0 996
  19. xm mem-set:使用过程中遇到的问题:
  20. root@ungeovirtual demos]# xm mem-set vm02 768
  21. Error: Memory size too large. Limit is 512 MiB
  22. Usage: xm mem-set

  23. Set the current memory usage for a domain.

8:xm vcpu-list:查域的vcpu个数
[root@ungeovirtual xen]# xm vcpu-list  Domain-0
Name                              ID VCPUs   CPU State   Time(s) CPU Affinity
Domain-0                           0     0     0   -b-     747.4 0
Domain-0                           0     1     1   r--     256.0 1
[root@ungeovirtual xen]# xm vcpu-list vm02
Name                              ID VCPUs   CPU State   Time(s) CPU Affinity
vm02                              10     0     1   -b-       6.8 any cpu


9:xm info:

[root@ungeovirtual xen]# xm info vm02
Error: 'xm info' requires 0 arguments.

Usage: xm info 

Get information about Xen host.
[root@ungeovirtual xen]# xm info
host                   : ungeovirtual  #物理机器的名称
release                : 2.6.18-308.el5xen
version                : #1 SMP Tue Feb 21 20:47:10 EST 2012
machine                : x86_64
nr_cpus                : 2
nr_nodes               : 1
sockets_per_node       : 1
cores_per_socket       : 2
threads_per_core       : 1
cpu_mhz                : 3066
hw_caps                : bfebfbff:20100800:00000000:00000940:0400e3bd:00000000:00000001
total_memory           : 4061
free_memory            : 112
node_to_cpu            : node0:0-1
xen_major              : 3
xen_minor              : 1
xen_extra              : .2-308.el5
xen_caps               : xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64 
xen_pagesize           : 4096
platform_params        : virt_start=0xffff800000000000
xen_changeset          : unavailable
cc_compiler            : gcc version 4.1.2 20080704 (Red Hat 4.1.2-52)
cc_compile_by          : mockbuild
cc_compile_domain      : centos.org
cc_compile_date        : Tue Feb 21 19:58:22 EST 2012
xend_config_format     : 2


10:xm log查看日志:
[root@ungeovirtual xen]# xm log | more
[2011-02-20 22:39:37 xend 3089] INFO (SrvDaemon:283) Xend Daemon started
[2011-02-20 22:39:37 xend 3089] INFO (SrvDaemon:287) Xend changeset: unavailable.
[2011-02-20 22:39:37 xend.XendDomainInfo 3089] DEBUG (XendDomainInfo:283) XendDomainInfo.recreate({\047paused\047: 0, \047cpu_time\047: 121788541196L, \047ssidref\047: 0, \047hv
m\047: 0, \047shutdown_reason\047: 0, \047dying\047: 0, \047mem_kb\047: 3650224L, \047domid\047: 0, \047max_vcpu_id\047: 1, \047crashed\047: 0, \047running\047: 1, \047maxmem_kb
\047: 17179869180L, \047shutdown\047: 0, \047online_vcpus\047: 2, \047handle\047: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], \047blocked\047: 0})
[2011-02-20 22:39:37 xend.XendDomainInfo 3089] INFO (XendDomainInfo:295) Recreating domain 0, UUID 00000000-0000-0000-0000-000000000000.
[2011-02-20 22:39:37 xend.XendDomainInfo 3089] WARNING (XendDomainInfo:317) No vm path in store for existing domain 0
[2011-02-20 22:39:37 xend.XendDomainInfo 3089] DEBUG (XendDomainInfo:1439


11: xm create 提示出错:
[root@ungeovirtual data]# pwd
/data
[root@ungeovirtual data]# ls vm02
vm02
[root@ungeovirtual data]# 
[root@ungeovirtual data]# xm create vm02
Using config file "./vm02".
/usr/lib64/python2.4/site-packages/xen/xm/opts.py:522: DeprecationWarning: Non-ASCII character '\xeb' in file ./vm02 on line 1, but no encoding declared; see for details
  execfile(defconfig, globs, locs)
Error: Errors were found at line 1 while processing ./vm02:
        際?幮荐聙勱f1襢鱰圱
                             塂
                               ;}<奣
显然出错
原因:Sometimes Python will generate a message like the one below, 
these are often caused by either an invalid or incorrect configuration file.
 A configuration file containing non-ascii characters will cause these errors.The solution is to correct the configuration file or generate a new one. ##这个显然不是,因为我使用xm create -c /etc/xen/vm02 启动是正常的,显然配置文件是正确的!

Another cause is an incorrect configuration file in your current working directory.
“xm create” will look in the current directory for a configuration file and then in /etc/xen
##这个才是真正的原因! 换到不是/data的目录下,xm create vm02 就可以正常启动!


12:现在Domain-0使用的内存:
[root@ungeovirtual xen]# cat /etc/grub.conf 
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/hda2
#          initrd /initrd-version.img
#boot=/dev/hda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-308.el5xen)
        root (hd0,0)
  kernel /xen.gz-2.6.18-308.el5 dom0_mem=1024MB ##固化宿主机使用的内存,以防止出现内存挤压bug
        module /vmlinuz-2.6.18-308.el5xen ro root=LABEL=/ rhgb quiet
        module /initrd-2.6.18-308.el5xen.img
title CentOS-base (2.6.18-308.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-308.el5 ro root=LABEL=/ rhgb quiet
        initrd /initrd-2.6.18-308.el5.img
同时修改配置文件/etc/xen/xend-config.sxp 中的dom-min-mem使之于grub.conf中的值一致!
更改的数值为:
(dom0-min-mem 256)---->(dom0-min-mem 1024)
[root@ungeovirtual xen]# free -m #登录进系统后,显然现在显示的内存是1024m
             total       used       free     shared    buffers     cached
Mem:          1024        356        667          0         10         65
-/+ buffers/cache:        280        743
Swap:         8001          0       8001
 
[root@qht02 ~]# xm info | grep memory
total_memory           : 4096
free_memory            : ****
当xend进程启动的时候,会根据配置文件和系统现状将一部分资源划入到domain-0中,然后domain-0再把资源分配给虚拟机来使用,它其实就是vmm管理接口!


13:xen迁移(这个不是live migration,是手动的迁移),手动将192.168.1.2上的vm02的配置文件(/etc/xen/vm02)scp到192.168.1.3下/etc/xen目录下,手动将192.168.1.2:/xen目录下的vm02 img文件复制到192.168.1.3下的/xen下,在192.168.1.3下启动vm02(xm create vm02) 报错如下:
原因:我的物理内存只有211m, 而vm虚机分配300内存,就会出现上面的错误!
只需增大物理内存超出300m即可!
14:机器上有几个虚拟机,查看各个虚拟机使用的vif,
[root@ungeovirtual ~]# xm list
Name                                      ID Mem(MiB) VCPUs State   Time(s)
Domain-0                                   0     1024     2 r-----   1919.0
vm01                                       5      512     1 -b----      8.9
vm02                                       4      512     1 -b----      9.1
vm03                                       6      512     1 -b----      8.6
[root@ungeovirtual ~]# xm network-list vm01
Idx BE     MAC Addr.     handle state evt-ch tx-/rx-ring-ref BE-path
0   0  00:16:3e:3d:bc:c9    0     4      8     778  /779     /local/domain/0/backend/vif/5/0  
[root@ungeovirtual ~]# xm network-list vm02
Idx BE     MAC Addr.     handle state evt-ch tx-/rx-ring-ref BE-path
0   0  00:16:3e:19:da:65    0     4      7     768  /769     /local/domain/0/backend/vif/4/0  
[root@ungeovirtual ~]# xm network-list vm03
Idx BE     MAC Addr.     handle state evt-ch tx-/rx-ring-ref BE-path
0   0  00:16:3e:31:f2:36    0     4      7     768  /769     /local/domain/0/backend/vif/6/0  

15:xen虚拟机上增加一个网卡:

  1. [root@host012 xen]# cat vm01_bak
  2. name = "vm01"
  3. uuid = "d717ba45-8487-8e57-1cbc-0458a5cfb6cb"
  4. maxmem = 2048
  5. memory = 2048
  6. vcpus = 2
  7. bootloader = "/usr/bin/pygrub"
  8. on_poweroff = "destroy"
  9. on_reboot = "restart"
  10. on_crash = "restart"
  11. disk = [ "tap:aio:/data/vm01.img,xvda,w" ]
  12. vif = [ "mac=00:16:3e:33:fd:2e,bridge=xenbr0,script=vif-bridge" ]
  13.  
  14. [root@host012 xen]# cat vm01
  15. name = "vm01"
  16. uuid = "d717ba45-8487-8e57-1cbc-0458a5cfb6cb"
  17. maxmem = 2048
  18. memory = 2048
  19. vcpus = 2
  20. bootloader = "/usr/bin/pygrub"
  21. on_poweroff = "destroy"
  22. on_reboot = "restart"
  23. on_crash = "restart"
  24. disk = [ "tap:aio:/data/vm01.img,xvda,w" ]
  25. vif = [ "mac=00:16:3e:33:fd:2e,bridge=xenbr0,script=vif-bridge","mac=00:16:3e:33:fd:2f,bridge=xenbr1,script=vif-bridge" ] ##红色字体为添加的部分! 我的物理机器上有两个xenbr,一个为xenbr0 ,另外一个为xenbr1 ,虚拟机上所有外网都链接到xenbr0 ,内网都链接到xenbr1 
  26. 我用这种方式添加了6个虚拟机,到第六个出现了问题, 认不得网卡! 修改ip地址后,ifup eth1,ip地址可以看到,但就是不能ping通物理机器上的内网!
  27. 故障原因:hwaddr为:00:00:00:00:00:00
  28. 解决方法:修改/etc/xen/vm01中新增的mac,然后在ifcfg-eth1中指定:HWADDR=00:**:**:**:**:**
  29. xm shutdown vm06   然后xm create vm06   , 不要xm  reboot vm06!


阅读(4400) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~