openstack使用nfs作为nova的后端存储

当你的openstack主机没有可用空间了,而你又不能添加硬盘,或许nfs服务可以帮到你。

目标:

用nfs作为nove的后端存储。

过程:

运行一个可用的nfs服务:

[root@controller ~]# showmount -e 192.168.100.10
Export list for controller:
/nfs *

查看openstack当前nova的后端存储位置:
我修改了默认云主机存储路径

[root@node1 ~]# cat /etc/nova/nova.conf | grep instances_path | grep -v "#"
instances_path=/data/nova/instances

如果是下面这样:

[root@controller ~]# cat /etc/nova/nova.conf | grep "instances_path"              
#instances_path=$state_path/instances
那么就是默认路径:/var/lib/nova/instances

找到了路径就简单了,挂载nfs到后端路径:

[root@node1 ~]# mount -t nfs 192.168.100.10:/nfs /data/nova/instances/

设置目录属性:

[root@node1 ~]# chown -R nova:nova /data/nova/instances/

验证:
重启openstack-nova-compute服务
创建一个虚拟机,查看ID:

[root@node1 ~]# nova boot --image cirros --flavor 1 --nic net-name=sharednet1 cirros
[root@node1 ~]# nova list
+--------------------------------------+--------+--------+------------+-------------+---------------------+
| ID                                   | Name   | Status | Task State | Power State | Networks            |
+--------------------------------------+--------+--------+------------+-------------+---------------------+
| f684f8df-3526-4a6b-bc21-f9a67ed4b9f0 | cirros | ACTIVE | -          | Running     | sharednet1=10.0.0.9 |
+--------------------------------------+--------+--------+------------+-------------+---------------------+

查看云主机所在目录:

[root@node1 ~]# ll /data/nova/instances/
total 0
drwxr-xr-x. 2 nova nova 53 May 17 11:24 _base
drwxr-xr-x. 2 nova nova 69 May 17 11:36 f684f8df-3526-4a6b-bc21-f9a67ed4b9f0
drwxr-xr-x. 2 nova nova 58 May 17 11:24 locks

到nfs服务端查看:

[root@controller ~]# ll -d /nfs/
drwxr-xr-x. 6 nova nova 89 May 17 07:36 /nfs/
[root@controller ~]# ll /nfs/
total 0
drwxr-xr-x. 2 nova nova 53 May 17 07:24 _base
drwxr-xr-x. 2 nova nova 69 May 17 07:36 f684f8df-3526-4a6b-bc21-f9a67ed4b9f0
drwxr-xr-x. 2 nova nova 58 May 17 07:24 locks

成功!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

小小之食人魔

学习技术是为了早点下班!

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

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

打赏作者

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

抵扣说明:

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

余额充值