OpenStack动态迁移相关Shell命令

本文档详细介绍了OpenStack环境中虚拟机迁移的步骤与常见问题解决方法,包括更改UIDGID、调整NFS权限及解决迁移过程中遇到的具体错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

***********************************************************************************
其他命令:
chmod o+x /var/lib/nova/instances
ly-controller:/ /var/lib/nova/instances nfs4 defaults 0 0
ls -ld /var/lib/nova/instances/
***********************************************************************************
1. 首先批量更改UID GID
find / -uid 117 -exec chown -h 120 '{}' \+
find / -gid 127 -exec chgrp -h 130 '{}' \+
***********************************************************************************
2. 修改NFS权限
gedit /etc/libvirt/qemu.conf
去掉user = "root"的注释
usermod -u 140 nova
groupmod -g 150 nova
***********************************************************************************
3. 运行迁移命令时遇到错误
Live Migration failure: operation failed: Failed to connect to remote libvirt URI qemu+tcp://ly-compute2/system: unable to connect to server at 'ly-compute2:16509': Connection refused

解决:
https://www.mirantis.com/blog/tutorial-openstack-live-migration-with-kvm-hypervisor-and-nfs-shared-storage/

迁移日志:
2014-12-21 05:13:19.668 2105 INFO nova.compute.manager [-] [instance: c2093336-f9fe-470c-aef6-e10e34e3eba8] VM Paused (Lifecycle Event)
2014-12-21 05:13:19.781 2105 INFO nova.compute.manager [-] [instance: c2093336-f9fe-470c-aef6-e10e34e3eba8] During sync_power_state the instance has a pending task (migrating). Skip.
2014-12-21 05:13:19.783 2105 INFO nova.compute.manager [-] [instance: c2093336-f9fe-470c-aef6-e10e34e3eba8] VM Paused (Lifecycle Event)
2014-12-21 05:13:19.854 2105 INFO nova.compute.manager [-] [instance: c2093336-f9fe-470c-aef6-e10e34e3eba8] During sync_power_state the instance has a pending task (migrating). Skip.
2014-12-21 05:13:22.307 2105 INFO nova.compute.manager [-] [instance: c2093336-f9fe-470c-aef6-e10e34e3eba8] VM Stopped (Lifecycle Event)
2014-12-21 05:13:22.314 2105 INFO nova.compute.manager [-] [instance: c2093336-f9fe-470c-aef6-e10e34e3eba8] _post_live_migration() is started..
2014-12-21 05:13:22.400 2105 INFO nova.compute.manager [-] [instance: c2093336-f9fe-470c-aef6-e10e34e3eba8] During sync_power_state the instance has a pending task (migrating). Skip.
2014-12-21 05:13:22.447 2105 WARNING nova.virt.libvirt.utils [-] systool is not installed
2014-12-21 05:13:22.493 2105 WARNING nova.virt.libvirt.utils [-] systool is not installed
2014-12-21 05:13:23.022 2105 INFO nova.compute.manager [-] [instance: c2093336-f9fe-470c-aef6-e10e34e3eba8] Migrating instance to ly-compute2 finished successfully.
2014-12-21 05:13:23.023 2105 INFO nova.compute.manager [-] [instance: c2093336-f9fe-470c-aef6-e10e34e3eba8] You may see the error "libvirt: QEMU error: Domain not found: no domain with matching name." This error can be safely ignored.
***********************************************************************************
迁移前查看命令:
nova list
nova service-list
nova-manage vm list

动态迁移命令:
nova live-migration test1 ly-compute2
nova live-migration test1 ly-compute1

调试命令:
import pydevd
pydevd.settrace('192.168.0.124', port=13768, stdoutToServer=True, stderrToServer=True)

指定配置文件运行compute:
/usr/bin/nova-compute --config-file=/etc/nova/nova.conf --config-file=/etc/nova/nova-compute.conf

重启nova服务命令:
service nova-api restart
service nova-compute restart

cinder块存储删除命令:
lvdisplay
ls /dev/cinder-volumes/
lvremove /dev/cinder-volumes/volume-63992eab-e922-4ede-9c86-cb33f1d0f60c

虚拟机上cinder磁盘挂载命令:
mkfs.ext4 /dev/vdb
mkdir–p /vol1
mount /dev/vdb /vol1
(可能会提示error:couldn't mount because of unsupported optional features(240) 不过不影响使用

创建镜像命令:
glance image-create --name cirros-0.3.0-i386 --disk-format vmdk --container-format bare --file /root/Desktop/cirros-0.3.0-i386-disk.vmdk --is-public True --is-protected False --progress

***********************************************************************************
Ubuntu进入Recovery模式后,无法修改文件的问题

mount -o remount rw /

注释掉/etc/fstab中的NFS配置命令

***********************************************************************************
查看连接命令
lsof -i

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Casbin开源社区

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值