网站地图    收藏   

主页 > 系统 > 虚拟机 >

solusvm xen虚拟机offline无法远程 - 虚拟机教程文章

来源:自学PHP网    时间:2015-04-14 13:34 作者: 阅读:

[导读] 创建的VG为 xenLVg1,查看vgdisplay有======================================--- Volume group --- VG Name xenLVg1 System ID Format lvm2...=====================================创建的虚拟机为L......

创建的VG为 xenLVg1,
查看
 vgdisplay

======================================
--- Volume group ---
  VG Name               xenLVg1
  System ID            
  Format                lvm2
.
.
.
=====================================
创建的虚拟机为LVM
产看LVM
lvdisplay
===============================
--- Logical volume ---
  LV Name                /dev/xenLVg1/vm101_img
  VG Name                xenLVg1
  LV UUID                TzrbBV-o3dr-fJ52-jVle-5d2y-8ZXd-CjCt9u
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                30.00 GB
  Current LE             7680
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
  
  --- Logical volume ---
  LV Name                /dev/xenLVg1/vm101_swap
  VG Name                xenLVg1
  LV UUID                6YUot1-2uv2-c4ls-zBgQ-dHfp-rgOY-36Ifvx
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                1000.00 MB
  Current LE             250
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

==================================
虚拟机创建在 /dev/xenLVg1/vm101_img 里面
虚拟机的配置文件在/home/xen/vm101/vm101.cfg
/home/xen/vm101/ 下还有ifcfg-eth0,以及mnt文件夹

手动启动虚拟机:
 xm create /home/xen/vm101/vm101.cfg
错误:
Error: Kernel image does not exist: /boot/solus-vmlinuz


还需要:
All set! needed to run: php /usr/local/solusvm/includes/xenkernel.php

===================================================
php /usr/local/solusvm/includes/xenkernel.php
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/dbase.so' - /usr/lib/php/modules/dbase.so: cannot open shared object file: No such file or directory in Unknown on line 0

Making SolusVM initrd...

Modulefile is /etc/modprobe.conf
Setting kernel links...

Kernel setup completed.
================================================================================

在solusvm里 Boot 虚拟机就可以了。

无法远程 ssh

进入 console 查看IP:
系统启动不起来
ERROR opening /dev/console: No such file or directory
Trying to use fd 0 instead.
WARNING: can't access (null)
exec of init ((null)) failed!!!: Bad address
Kernel panic - not syncing: Attempted to kill init!

查看vm101.cfg
===========================
less vm101.cfg
kernel     = '/boot/solus-vmlinuz'
ramdisk    = '/boot/solus-initrd.img'
#bootloader = '/usr/bin/pygrub'
extra      = ''
memory     = 512
hostname   = 'Centos'
cpu_weight = 256
name       = 'vm101'
vif        = ['ip=173.231.59.83, vifname=vifvm101.0, mac=00:16:3e:ed:d6:76']
vnc        = 0
vcpus      = 4
vncviewer  = 0
serial     = 'pty'
disk       = ['phy:/dev/xenLVg1/vm101_img,sda1,w', 'phy:/dev/xenLVg1/vm101_swap,sda2,w']
root       = '/dev/sda1 ro'
vm101.cfg (END)
=========================================================================

看到一个问题,0 字节的template
到 slave 的/home/solusvm/xen/template 看到与maste同名的系统 CentOS-XX.tar.gz 为0字节
手动下载,改为与maste同名。
在solusvm面板中重装系统试试。
console 可以连得上了。
远程依然不行。

在console 中看到 IP是正确绑定的。

在xen的主机,即slave查看IP信息
================================================

ifconfig
eth0      Link encap:Ethernet  HWaddr XXXX
          inet addr:X.X.X.X  Bcast:X.X.X.  Mask:255.255.255.248
          inet6 addr: X::X:X:X:X/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3974 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3591 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:512181 (500.1 KiB)  TX bytes:779228 (760.9 KiB)

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:560 (560.0 b)  TX bytes:560 (560.0 b)

peth0     Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF 
          inet6 addr: X::X:X:X:X/64 Scope:Link
          UP BROADCAST RUNNING NOARP  MTU:1500  Metric:1
          RX packets:119923 errors:0 dropped:0 overruns:0 frame:0
          TX packets:89809 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:139299326 (132.8 MiB)  TX bytes:9798431 (9.3 MiB)
          Interrupt:16 Memory:fb5e0000-fb600000

vifvm101.0 Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF 
          inet6 addr: X::X:X:X:X/64 Scope:Link
          UP BROADCAST RUNNING NOARP  MTU:1500  Metric:1
          RX packets:13 errors:0 dropped:0 overruns:0 frame:0
          TX packets:566 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500
          RX bytes:580 (580.0 b)  TX bytes:29432 (28.7 KiB)

vif0.0    Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF 
          inet6 addr: X::X:X:X:X/64 Scope:Link
          UP BROADCAST RUNNING NOARP  MTU:1500  Metric:1
          RX packets:89737 errors:0 dropped:0 overruns:0 frame:0
          TX packets:119902 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:9791693 (9.3 MiB)  TX bytes:139234160 (132.7 MiB)

virbr0    Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF 
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          inet6 addr: X::X:X:X:X/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:13 errors:0 dropped:0 overruns:0 frame:0
          TX packets:31 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:580 (580.0 b)  TX bytes:6582 (6.4 KiB)

xenbr0    Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF 
          UP BROADCAST RUNNING NOARP  MTU:1500  Metric:1
          RX packets:1989 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:651213 (635.9 KiB)  TX bytes:0 (0.0 b)
==========================================================================
经查知:xenbr0默认应该是和eth0绑定
/etc/xen/scripts/network-bridge start bridge=xenbr0 netdev=eth0 vifnum=0

 虚拟机里的 防火墙? 查证,关了

xm list               #查看各个域状态
xm shutdown web_001   #关闭web_001这个虚拟机
xm console web_001    连接web_001控制台,连接到虚拟机上面可以用组合键  ctrl + ] 键切换到物理机

XM命令:
    xm create vm1 #其中vm1 为虚拟机的配置文件,位于/etc/xen/vm/vm1
    xm create -c vm1 #如果需要启动控制台,则可以运行命令
    xm list #可以列出所有的虚拟机
    xm console <domid> #可以显示某虚拟机的控制台
    xm reboot|shutdown <domid> #可以重起和关闭id 为domid 的虚拟机
    xm destroy <domid> #可以销毁id 为domid 的虚拟机
    xm console fc5 #从终端或控制台登录正在运行的虚拟操作系统
    xm save <DomId> <File> # 存储正在运行的虚拟操作系统的状态
    xm restore <File> # 唤醒虚拟操作系统
    xm pause <DomId> #停止正在运行的虚拟操作系统
    xm unpause <DomId> #激活停止的虚拟操作系统
    xm mem-set <DomId> <Mem> #调整虚拟平台/虚拟操作系统的占用内存
    xm shutdown 虚拟操作系统的Name或DomID #关闭被虚拟的系统
    xm destroy <DomId> #立即停止虚拟的系统 (重要);
    xm vcpu-set <DomId> <VCPUs> #调整虚拟平台及虚拟操作系统的虚拟CPU个数
    xm top 或 xentop # 查看虚拟系统运行的状态
    xm save VM1 VM1.chk # stop the domain and save its current state into a file called VM1.chk
    xm restore VM1.chk #resume execution of this domain

ISO 上传到  solusvm的
master 和 slave 的  /home/solusvm/xen/iso下。

自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号-1@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com

添加评论