Create Virtual Machine #22010/05/28 |
Create a Virtual Machine from template. |
|
[1] | Create a Virtual Machine from template that is made in Create Virtual Machine #1. |
# copy disk image and XML file for a new Virtual Machine [root@dlp ~]# cp guest.img /var/kvm/images/mail.img [root@dlp ~]# cp guest.xml /etc/libvirt/qemu/mail.xml [root@dlp ~]# uuidgen -t # generate UUID 101dea3a-6b02-11df-add6-001a4d459f57 # remember [root@dlp ~]# vi /etc/libvirt/qemu/mail.xml <domain type='kvm'> # change name <name> mail </name># change UUID generated above <uuid> 101dea3a-6b02-11df-add6-001a4d459f57 </uuid><memory>1048576</memory> <currentMemory>1048576</currentMemory> <vcpu>2</vcpu> <os> <type arch='x86_64' machine='fedora-13'>hvm</type> <boot dev='hd'/> </os> <features> <acpi/> <apic/> <pae/> </features> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/bin/qemu-kvm</emulator> <disk type='file' device='disk'> <driver name='qemu' type='raw'/> # change disk <source file='/var/kvm/images/ mail.img '/><target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' unit='0'/> </disk> <controller type='ide' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> <interface type='bridge'> # remove the line for mac address <mac address='52:54:00:bc:8f:f3'/> <source bridge='br0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </interface> <interface type='bridge'> # remove the line for mac address <mac address='52:54:00:59:da:9d'/> <source bridge='br1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </interface> <serial type='pty'> <target port='0'/> </serial> <console type='pty'> <target port='0'/> </console> </devices> </domain> [root@dlp ~]# virsh define /etc/libvirt/qemu/mail.xml # define new settings Domain mail defined from /etc/libvirt/qemu/mail.xml [root@dlp ~]# virsh start mail --console Domain mail started Connected to domain mail Fedora release 13 (Goddard) Kernel 2.6.33.4-95.fc13.x86_64 on an x86_64 (/dev/ttyS0) localhost.localdomain login: # completed to boot |
[2] | News GuestOS' network is failed to boot because it is the same to existing GuestOS's one. So Change network settings for new one. |
# failed to boot networking like below Bringing up interface eth0: Device eth0 does not seem to be present, delaying initialization. [FAILED] Bringing up interface eth1: Device eth1 does not seem to be present, delaying initialization. [FAILED] [root@localhost ~]# ifconfig -a eth2 Link encap:Ethernet HWaddr 52:54:00:46:CA:E3 BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) Interrupt:11 eth3 Link encap:Ethernet HWaddr 52:54:00:F0:2D:7F BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) Interrupt:10 Base address:0xe000 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:0 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:0 (0.0 b) TX bytes:0 (0.0 b) [root@localhost ~]# cd /etc/sysconfig/network-scripts [root@localhost network-scripts]# mv ifcfg-eth0 ifcfg-eth2 [root@localhost network-scripts]# mv ifcfg-eth1 ifcfg-eth3 [root@localhost network-scripts]# vi ifcfg-eth2 # change name and MAC address to correct one # If you set static IP address, See initial config DEVICE= eth2 BOOTPROTO=dhcp HWADDR= 52:54:00:46:CA:E3 ONBOOT=yes OPTIONS=layer2=1 [root@localhost network-scripts]# vi ifcfg-eth3 # change name and MAC address to correct one # If you set static IP address, See initial config DEVICE= eth3 BOOTPROTO=dhcp HWADDR= 52:54:00:F0:2D:7F ONBOOT=yes OPTIONS=layer2=1 [root@localhost network-scripts]# /etc/rc.d/init.d/network restart Shutting down loopback interface: [ OK ] Bringing up loopback interface: [ OK ] Bringing up interface eth2: Determining IP information for eth2... done. [ OK ] Bringing up interface eth3: Determining IP information for eth3... done. [ OK ] [root@localhost network-scripts]# eth2 Link encap:Ethernet HWaddr 52:54:00:46:CA:E3 inet addr:10.0.0.205 Bcast:10.0.0.255 Mask:255.255.255.0 inet6 addr: fe80::5054:ff:fe46:cae3/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:12 errors:0 dropped:0 overruns:0 frame:0 TX packets:10 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1216 (1.1 KiB) TX bytes:1277 (1.2 KiB) Interrupt:11 Base address:0xc000 eth3 Link encap:Ethernet HWaddr 52:54:00:F0:2D:7F inet addr:192.168.1.5 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::5054:ff:fef0:2d7f/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:32 errors:0 dropped:0 overruns:0 frame:0 TX packets:36 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:3195 (3.1 KiB) TX bytes:3366 (3.2 KiB) Interrupt:10 Base address:0xc000 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:6 errors:0 dropped:0 overruns:0 frame:0 TX packets:6 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:828 (828.0 b) TX bytes:828 (828.0 b) |
Sponsored Link |