CentOS7云镜像:注入实例的root密码

本文介绍如何在OpenStack中启用设置虚拟机密码的功能。首先需要在Dashboard中配置can_set_password选项为True,并重启httpd服务。然后在计算节点上编辑nova.conf文件,将inject_password设为true并设置适当的inject_partition值,最后重启相关服务即可实现。

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

默认OpenStack的Dashboard修改虚拟机的密码的功能是关闭的,你需要enable。
1.
配置 can_set_password :
[root@controller ~]# vim /etc/openstack-dashboard/local_settings
......
OPENSTACK_HYPERVISOR_FEATURES = {
    'can_set_mount_point': False,
    'can_set_password': True,
    'requires_keypair': False,
}
......
重启 httpd 服务:
[root@controller ~]# systemctl restart httpd.service memcached.service

这时候你就可以看到设置管理员密码的地方:

不过这个时候,你可能还是不能修改密码。你需要修改计算节点的nova.conf文件
[root@compute2 ~]# vi /etc/nova/nova.conf
......
[libvirt]
......
# Inject the admin password at boot time, without an agent. (boolean value)
inject_password=true
......
# The partition to inject to : -2 => disable, -1 => inspect (libguestfs only),
# 0 => not partitioned, >0 => partition number (integer value)
inject_partition=-1
......
重启服务:
[root@compute2 ~]# systemctl restart libvirtd.service openstack-nova-compute.service

这样,就可以在创建instance时,在‘管理员密码’处设置root的密码了。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值