查看flavor nova flavor-list 查看镜像 nova image-list glance image-list 查看网络 neutron net-list 查看用zone nova aggregate-list 查看zone下的物理主机 nova aggregate-details qa-zone 创建并启动一台名为adams_test_vm的云主机
创建云主机指定物理主机及密码 nova boot --flavor flavor_name --image image_name --security_group default --nic net-id=net_uuid --availability-zone qa-nova:computer_name vm_host_name --user-data ./passwd.sh --poll
passwd.sh内容如下:
#!/bin/bash
echo qwe123qwe | passwd --stdin root
下载镜像 glance image-download image_id --file Win7 上传镜像 glance image-create --name image_name --disk-format qcow2 --file /root/Win7 --container-format bare --is-public True 卸载云盘 nova volume-detach 云主机uuid 云盘uuid 挂载云盘 nova volume-attach 云主机uuid 云盘uuid 查看用户信息 keystone user-get user_id 查看tenant信息 keystone tenant-get tenant_id 查看compute节点列表 nova hypervisor-list 查看compute节点信息 nova hypervisor-show compute_node_name 查看宿主机节点上的所有云主机信息 nova hypervisor-servers compute_node_name 查看compute节点资源使用情况 nova hypervisor-stats 删除云主机 nova delete uuid 创建云盘 cinder create size_by_G --availability-zone nova --volume-type ceph-sata --display-name harbor-ui-01 --display-description "ui log disk" --metadata create_user_login=jack01.wu readonly=False create_user_id=xxx attached_mode=rw 迁移云主机 nova live-migration uuid compute_node_name (挂载有云硬盘的实例,需要先卸载后操作) 禁用compute节点服务 nova service-disable compute_node_name IP分配信息 neutron port-list 租户列表 keystone tenant-list 配额信息 nova quota-show 变更实例配置 nova resize instance_uuid|instance_name flavor_name|flavor_id 重新配置实例 nova instance_uuid|instance_name flavor_name|flavor_id --rebuild-password test
Openstack超配设置
nova.conf(默认值)
CPU
# Virtual CPU to physical CPU allocation ratio which affects
# all CPU filters. This configuration specifies a global ratio
# for CoreFilter. For AggregateCoreFilter, it will fall back
# to this configuration value if no per-aggregate setting
# found. (floating point value)
#cpu_allocation_ratio=16.0
DISK 磁盘超配如云主机使用宿主机存储易导致灾难事故
# Virtual disk to physical disk allocation ratio (floating
# point value)
#disk_allocation_ratio=1.0
MEM
# Virtual ram to physical ram allocation ratio which affects
# all ram filters. This configuration specifies a global ratio
# for RamFilter. For AggregateRamFilter, it will fall back to
# this configuration value if no per-aggregate setting found.
# (floating point value)
#ram_allocation_ratio=1.5
# Enables dynamic memory allocation (ballooning) when set to a
# value greater than 1. The value expresses the ratio between
# the total RAM assigned to an instance and its startup RAM
# amount. For example a ratio of 2.0 for an instance with
# 1024MB of RAM implies 512MB of RAM allocated at startup
# (floating point value)
#dynamic_memory_ratio=1.0