openstack重置状态

1. cinder volume snapshot 快照

openstack volume snapshot set
    [--name <name>]
    [--description <description>]
    [--no-property]
    [--property <key=value> [...] ]
    [--state <state>]
    <snapshot>

----------------------------------------------------------
--name <name>¶
New snapshot name

--description <description>¶
New snapshot description

--no-property¶
Remove all properties from <snapshot> (specify both --no-property and --property to remove the current properties before setting new properties.)

--property <key=value>¶
Property to add or modify for this snapshot (repeat option to set multiple properties)

--state <state>¶
New snapshot state. (“available”, “error”, “creating”, “deleting”, or “error_deleting”) (admin only) (This option simply changes the state of the snapshot in the database with no regard to actual status, exercise caution when using)

Volume version 2 only

<snapshot>
Snapshot to modify (name or ID)

cinder snapshot-reset-state [--state <state>]  <snapshot> [<snapshot> ...]

------------------------------------------------
--state <state>
 Valid values are “available”, “error”, “creating”, “deleting”, and “error_deleting”. NOTE: This command simply changes the state of the Snapshot in the DataBase with no regard to actual status, exercise caution when using. Default=available.

openstack volume snapshot unset [-h]
                                  [--property <key>]
                                  <snapshot>

2. cinder volume卷

#Change the status using the following command 
openstack volume set --state [desired_state] [volume_uuid]
# Verify if the volume state has changed
openstack volume show [volume_uuid]
OpenStack volumes can be in the following states: "available”, “error”, “creating”, “deleting”, “in-use”, “attaching”, “detaching”, “error_deleting” or “maintenance”.

 

cinder reset-state --attach-status detached $volume-ID  #修改卷状态为detached,解绑
cinder reset-state volume-id --state xxx #设置卷状态
cinder backup-create volume-id --name yy --force #创建全量备份
cinder delete $volume-ID #删除卷,建议从云管操作
cinder set-bootable volume-id True|False #设置卷状态为可启动
cinder backup-restore --volume-id xxx snapshot-id #还原卷备份
cinder upload-to-image --force --disk-format qcow2 volume-id image-name #上传卷到镜像池

 3. nova server 云主机

异常云主机重置状态后,需要硬重启

openstack server set
    [--name <new-name>]
    [--root-password]
    [--property <key=value>]
    [--state <state>]
    <server>
--------------------------------------------------------------
--name <new-name>¶
New server name

--root-password¶
Set new root password (interactive only)

--property <key=value>¶
Property to add/change for this server (repeat option to set multiple properties)

--state <state>¶
New server state (valid value: active, error)

server¶
Server (name or ID)

 

openstack server unset [--property <key>] <server>

openstack server reboot [--hard | --soft] [--wait] <server>

 

openstack server set --state active $vm-UUID/NAME

 

#default active
nova reset-state $vm-UUID
nova reset-state --active $vm-UUID
nova reboot --hard $vm-UUID

 

posted @ 2024-01-30 15:26  咿呀哒喏  阅读(144)  评论(0编辑  收藏  举报