大家好,又见面了,我是你们的朋友全栈君。
环境说明
配置说明
Centos 6下通过virt-p2v进行虚拟化转化(For Linux Server)这篇Blog中写过在Centos6下通过virt-p2v进行虚拟化服务器,但是发现在Centos7中,virt-p2v client的客户端
客户端配置
Centos 6下通过virt-p2v进行虚拟化转化(For Linux Server)的操作步骤,将该iso文件写入U盘。
服务器配置
#yum -y install virt-v2v
#virsh pool-create-as pool-1 dir --target=/home/pool1
在Centos6中virt-v2v的版本还有virt-v2v.conf文件进行需要配置,但是在Centos7中virt-v2v没有这个文件,所以不需要配置,在客户端直接指定pool就可以了。
虚拟化服务器
<!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
virsh edit Centos7-2
or other application using the libvirt API.
-->
<domain type='kvm'>
<name>Centos7-2</name>
<uuid>107049bd-5a50-4442-a72b-297dc9420684</uuid>
<memory unit='KiB'>2097152</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='pc-i440fx-rhel7.2.0'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type='volume' device='disk'>
<driver name='qemu' type='raw' cache='none'/>
<source pool='pool-1' volume='Centos7-2-sda'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<target dev='hda' bus='ide'/>
<readonly/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<controller type='usb' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='pci' index='0' model='pci-root'/>
<controller type='ide' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<interface type='network'>
<mac address='00:0c:29:5c:30:d0'/>
<source network='default'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='tablet' bus='usb'/>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes'/>
<video>
<model type='cirrus' vram='16384' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</memballoon>
</devices>
</domain>
主要查看network选项为default,先查看virt-p2v server的network列表
[root@ovirt-host-227 qemu]# virsh net-list
Name State Autostart Persistent
----------------------------------------------------------
;vdsmdummy; active no no
vdsm-ovirtmgmt active yes yes
在这里我们需要将default修改为vdsm-ovirtmgmt
<interface type='network'>
<mac address='00:0c:29:5c:30:d0'/>
<source network='vdsm-ovirtmgmt'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
启动vm
[root@ovirt-host-227 qemu]# virsh define Centos7-2.xml
Domain Centos7-2 defined from Centos7-2.xml
[root@ovirt-host-227 qemu]# virsh start Centos7-2
Domain Centos7-2 started
查看Centos7-2所使用的vnc port,为10.10.200.227:0
[root@ovirt-host-227 qemu]# ps -ef | grep vnc
root 2705 1 1 20:58 ? 00:00:43 /usr/libexec/qemu-kvm -name windows2008 -S -machine pc-i440fx-rhel7.2.0,accel=kvm,usb=off -cpu Westmere,hv_time,hv_relaxed,hv_vapic,hv_spinlocks=0x1fff -m 2048 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid 5a5cb94a-c508-46fc-9aa5-9e9f6add36cb -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-windows2008/monitor.sock,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=localtime,driftfix=slew -global kvm-pit.lost_tick_policy=discard -no-hpet -no-shutdown -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 -boot strict=on -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x5.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x5 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x5.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x5.0x2 -drive file=/root/virt-p2v-livecd-1.28.1-1.49.1.el7.iso,if=none,id=drive-ide0-0-0,readonly=on,format=raw -device ide-cd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -drive file=/home/windows2008.img,if=none,id=drive-virtio-disk0,format=qcow2 -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0 -netdev tap,fd=24,id=hostnet0 -device rtl8139,netde
v=hostnet0,id=net0,mac=52:54:00:fd:0d:1f,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -device usb-tablet,id=input0 -vnc 10.10.200.227:92 -device VGA,id=video0,vgamem_mb=16,bus=pci.0,addr=0x2 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6 -msg timestamp=on
root 16347 1 92 21:54 ? 00:00:31 /usr/libexec/qemu-kvm -name Centos7-2 -S -machine pc-i440fx-rhel7.2.0,accel=kvm,usb=off -m 2048 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid 107049bd-5a50-4442-a72b-297dc9420684 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-Centos7-2/monitor.sock,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -boot strict=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive file=/home/pool1/Centos7-2-sda,if=none,id=drive-virtio-disk0,format=raw,cache=none -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -drive if=none,id=drive-ide0-0-0,readonly=on,format=raw -device ide-cd,bus=ide.0,unit=0,drive=drive
-ide0-0-0,id=ide0-0-0 -netdev tap,fd=26,id=hostnet0,vhost=on,vhostfd=27 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:0c:29:5c:30:d0,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -device usb-tablet,id=input0 -vn
c <span style="color:#ff6666;">10.10.200.227:0 </span>-device cirrus-vga,id=video0,bus=pci.0,addr=0x2 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 -msg timestamp=on
root 16893 7466 0 21:54 pts/1 00:00:00 grep --color=auto vnc
在windows pc端通过vnc view连接10.10.200.227:0,就可以连接上虚拟化后的服务器了。
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/160456.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...