Task #5944
closedDocument how we can migrate a VM (with IP change) from a place to another
Added by Nico Schottelius about 6 years ago. Updated about 6 years ago.
70%
Description
- Document in this ticket
- Include all steps with opennebula, rbd, etc.
- Write the documentation in this ticket and when good, we port it to the wiki
Updated by Nico Schottelius about 6 years ago
- Status changed from New to In Progress
Starting right now
Updated by Jin-Guk Kwon about 6 years ago
<Move host>
if you want to move monitoring host, you can do that as below sequence.
ex) from server2.place5 to server3.place5
You can check VM's ID on web site(opennebula.ungleich.ch by only IPV6)
VM'ID = 22779
1 onevm poweroff 22779
# for changing host and it need to complete time.(a few seconds)
2 onevm show 22779 | grep STATE
#for checking poweroff
3 onevm migrate 22779 server1.place5.ungleich.ch
#migrate temp host
4 onevm show 22779 | grep HOST
#for checking changed HOST
5 onevm resume 22779
#restart VM
6 onevm show 22779
#for checking alive and checking IP address
7 ping6 2a0a:e5c0:0:2:400:b3ff:fe39:79ff
#checking alive (if IPV6)
8 onevm migrate 22779 server3.place5.ungleich.ch --live
# for changing destination host
10 onevm show 22779
# for checking status
[06:07:05] server1.place5:~# onevm poweroff 21730 [06:07:42] server1.place5:~# onevm show 21730 | grep "HOST\|STAT\|ETH0_IP6=" STATE : POWEROFF LCM_STATE : LCM_INIT HOST : server1 SEQ UID REQ HOST ACTION DS START TIME PROLOG ETH0_IP6="2a0a:e5c0:0:2:400:b3ff:fe39:7984", [06:07:54] server1.place5:~# onevm migrate 21730 server2.place5.ungleich.ch [06:08:10] server1.place5:~# onevm show 21730 | grep "HOST\|STAT\|ETH0_IP6=" STATE : POWEROFF LCM_STATE : LCM_INIT HOST : server2.place5.ungleich.ch SEQ UID REQ HOST ACTION DS START TIME PROLOG ETH0_IP6="2a0a:e5c0:0:2:400:b3ff:fe39:7984", [06:08:20] server1.place5:~# onevm resume 21730 [06:08:44] server1.place5:~# onevm show 21730 | grep "HOST\|STAT\|ETH0_IP6=" STATE : ACTIVE LCM_STATE : RUNNING HOST : server2.place5.ungleich.ch SEQ UID REQ HOST ACTION DS START TIME PROLOG ETH0_IP6="2a0a:e5c0:0:2:400:b3ff:fe39:7984", [06:09:04] server1.place5:~# ping6 2a0a:e5c0:0:2:400:b3ff:fe39:7984 PING 2a0a:e5c0:0:2:400:b3ff:fe39:7984(2a0a:e5c0:0:2:400:b3ff:fe39:7984) 56 data bytes 64 bytes from 2a0a:e5c0:0:2:400:b3ff:fe39:7984: icmp_seq=1 ttl=63 time=0.465 ms 64 bytes from 2a0a:e5c0:0:2:400:b3ff:fe39:7984: icmp_seq=2 ttl=63 time=0.463 ms 64 bytes from 2a0a:e5c0:0:2:400:b3ff:fe39:7984: icmp_seq=3 ttl=63 time=0.426 ms ^C --- 2a0a:e5c0:0:2:400:b3ff:fe39:7984 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2045ms rtt min/avg/max/mdev = 0.426/0.451/0.465/0.024 ms [06:09:16] server1.place5:~# onevm migrate 21730 server3.place5.ungleich.ch --live [06:09:33] server1.place5:~# onevm show 21730 | grep "HOST\|STAT\|ETH0_IP6=" STATE : ACTIVE LCM_STATE : RUNNING HOST : server3.place5.ungleich.ch SEQ UID REQ HOST ACTION DS START TIME PROLOG ETH0_IP6="2a0a:e5c0:0:2:400:b3ff:fe39:7984",
Updated by Jin-Guk Kwon about 6 years ago
<Move image>
if you want to migrate a VM from one place to another
1. onevm list
#for finding "SOURCE-VMID" at opennebula server
2. onevm power off <SOURCE-VMID>
#poweroff VM
3. ceph ssd lspools
#for checking "SOURCE-POOL" at Locate the disk in ceph
4. rbd list -p <SOURCE-POOL> | grep <SOURCE-VMID>
#for checking SOURCE-IMAGE-NAME
5. Login to the destination place
6. ceph osd lspools
#for checking "TARGET-POOL"
TARGET-IMAGE-NAME = import-SOURCE-VMID
7. rbd export <SOURCE-POOL>/<SOURCE-IMAGE-NAME> - | ssh <ANY SERVER IN OTHER PLACE> "rbd import - <TARGET-POOL>/<TARGET-IMAGE-NAME>"
#Transfer the disk into the other place ceph cluster
8. Create a new VM in target place with the same parameters as the original VM
new VM ID = TARGET-VMID
9. onevm poweroff <new VM ID>
#poweroff the new VM
10. rbd list -p <TARGET-POOL> | grep <TARGET-VMID>
#for checking Targer image at Locate the disk of the new VM
image name = NEW-DISK-ID
11. rbd rm <TARGET-POOL>/<NEW-DISK-ID>
#Delete the disk of the new VM
12. rbd mv <TARGET-POOL>/<TARGET-IMAGE-NAME> <TARGET-POOL>/<NEW-DISK-ID>
#Move the imported image to replace the disk we deleted
13. resume <new VM ID>
#Start the VM
14. ping <IP address>
#Checkout the network configuration, update the customer with the new network details
[06:49:33] server1.place5:~# onevm show 19027 | grep "HOST\|STAT" STATE : ACTIVE LCM_STATE : RUNNING HOST : server3.place5.ungleich.ch SEQ UID REQ HOST ACTION DS START TIME PROLOG [07:11:49] server1.place5:~# onevm poweroff 19027 [07:12:01] server1.place5:~# onevm show 19027 | grep "HOST\|STAT" STATE : POWEROFF LCM_STATE : LCM_INIT HOST : server3.place5.ungleich.ch SEQ UID REQ HOST ACTION DS START TIME PROLOG [07:12:29] server1.place5:~# rbd list -p one |grep 19027 one-31-19027-0 [07:14:07] server1.place5:~# rbd export one/one-31-19027-0 - | ssh black2.place6.ungleich.ch "rbd import - ssd/19027" Exporting image: 100% complete...done. Importing image: 100% complete...done.
[06:35:16] black2.place6:~# rbd list -p ssd | grep 23741 one-331-23741-0 [07:29:02] black2.place6:~# rbd rm ssd/one-331-23741-0 Removing image: 100% complete...done. [07:31:50] black2.place6:~# rbd mv ssd/19027 ssd/one-331-23741-0 [07:32:46] black2.place6:~#
[07:30:44] server1.place5:~# onevm resume 23741 [07:34:09] server1.place5:~# onevm show 23741 | grep "HOST\|STAT" STATE : ACTIVE LCM_STATE : RUNNING HOST : ciara4.place6.ungleich.ch SEQ UID REQ HOST ACTION DS START TIME PROLOG
Updated by Jin-Guk Kwon about 6 years ago
<add new IPV4>
1. onevm poweroff <VM ID> or click poweroff on opennebula web
2. click attach IP config on opennebula web(newtwork tab)
3. select IPV4 among the template
#fit to place
4. onevm resuem <VM ID> or click resume at VM on opennebula web
5. ping <new IP address>
Updated by Jin-Guk Kwon about 6 years ago
- Status changed from In Progress to Feedback
- Assignee changed from Jin-Guk Kwon to Nico Schottelius
- % Done changed from 0 to 70
Updated by Nico Schottelius about 6 years ago
- Status changed from Feedback to Closed
- Assignee changed from Nico Schottelius to Jin-Guk Kwon