OpenStack对虚拟机开机,关机,删除虚机,重置虚机状态,对虚机进行硬重启

2020-06-15 06:16:11 浏览数 (1)

[root@controller ~]# . admin-openrc

[root@controller ~]# nova list

ID

Name

Status

Task State

Power State

Networks

1fef3e0d-c640-4164-b868-6b9dbcdcc7df

Ke'Hu-1

ACTIVE

-

Running

public=42.51.77.20; private=10.0.0.17

b4500423-62fc-455e-b0f5-13fa4c4f5d58

Ke'Hu-2

ACTIVE

-

Running

public=42.51.77.12; private=10.0.0.10

3b7120d9-579b-4910-9301-6e6364656e53

Ke'Hu-3

ACTIVE

-

Running

public=42.51.77.15; private=10.0.0.20

7b383073-5f0c-43ab-8991-421eb2bac3e8

Ke'Hu-4

ACTIVE

-

Running

public=42.51.77.4; private=10.0.0.9

748a2e6d-083b-4965-a616-170d1a2bc0d4

Ke'Hu-5

ACTIVE

-

Running

public=42.51.77.21; private=10.0.0.26

cb2d19fa-c214-4782-b5be-95e565f35bd5

ROLY-1

PAUSED

-

Paused

public=42.51.77.5; private=10.0.0.19

b8095ceb-005c-4ca8-88be-dbdd7bec39ac

ROLY-3

ACTIVE

-

Running

public=42.51.77.16; private=10.0.0.3

0a6a2d71-38d0-4a30-8f36-92886dcf980c

ROLY-5

ACTIVE

-

Running

public=42.51.77.3; private=10.0.0.16

439fa0e0-c747-42e5-9abd-80c8e1e20776

ROLY-7

ACTIVE

-

Running

public=42.51.77.19; private=10.0.0.11

8a425d87-f53a-4a37-9365-b98daae062bb

ROLY-9

ACTIVE

-

Running

public=42.51.77.18; private=10.0.0.38

nova stop uuid 关机 [root@controller ~]# nova stop 8a425d87-f53a-4a37-9365-b98daae062bb Request to stop server 8a425d87-f53a-4a37-9365-b98daae062bb has been accepted. 查看以下对应UUID的机器已经关机

[root@controller ~]# openstack server list

ID

Name

Status

Networks

Image

Flavor

748a2e6d-083b-4965-a616-170d1a2bc0d4

Ke'Hu-5

ACTIVE

public=42.51.77.21; private=10.0.0.26

基础型

1fef3e0d-c640-4164-b868-6b9dbcdcc7df

Ke'Hu-1

ACTIVE

public=42.51.77.20; private=10.0.0.17

基础型

3b7120d9-579b-4910-9301-6e6364656e53

Ke'Hu-3

ACTIVE

public=42.51.77.15; private=10.0.0.20

基础型

7b383073-5f0c-43ab-8991-421eb2bac3e8

Ke'Hu-4

ACTIVE

public=42.51.77.4; private=10.0.0.9

基础型

b4500423-62fc-455e-b0f5-13fa4c4f5d58

Ke'Hu-2

ACTIVE

public=42.51.77.12; private=10.0.0.10

基础型

439fa0e0-c747-42e5-9abd-80c8e1e20776

ROLY-7

ACTIVE

public=42.51.77.19; private=10.0.0.11

基础型

8a425d87-f53a-4a37-9365-b98daae062bb

ROLY-9

SHUTOFF

public=42.51.77.18; private=10.0.0.38

基础型

0a6a2d71-38d0-4a30-8f36-92886dcf980c

ROLY-5

ACTIVE

public=42.51.77.3; private=10.0.0.16

基础型

b8095ceb-005c-4ca8-88be-dbdd7bec39ac

ROLY-3

ACTIVE

public=42.51.77.16; private=10.0.0.3

基础型

cb2d19fa-c214-4782-b5be-95e565f35bd5

ROLY-1

PAUSED

public=42.51.77.5; private=10.0.0.19

基础型

nova start uuid 开机 [root@controller ~]# nova start 8a425d87-f53a-4a37-9365-b98daae062bb Request to start server 8a425d87-f53a-4a37-9365-b98daae062bb has been accepted. 查看对应UUID的机器已经开机

[root@controller ~]# openstack server list

ID

Name

Status

Networks

Image

Flavor

748a2e6d-083b-4965-a616-170d1a2bc0d4

Ke'Hu-5

ACTIVE

public=42.51.77.21; private=10.0.0.26

基础型

1fef3e0d-c640-4164-b868-6b9dbcdcc7df

Ke'Hu-1

ACTIVE

public=42.51.77.20; private=10.0.0.17

基础型

3b7120d9-579b-4910-9301-6e6364656e53

Ke'Hu-3

ACTIVE

public=42.51.77.15; private=10.0.0.20

基础型

7b383073-5f0c-43ab-8991-421eb2bac3e8

Ke'Hu-4

ACTIVE

public=42.51.77.4; private=10.0.0.9

基础型

b4500423-62fc-455e-b0f5-13fa4c4f5d58

Ke'Hu-2

ACTIVE

public=42.51.77.12; private=10.0.0.10

基础型

439fa0e0-c747-42e5-9abd-80c8e1e20776

ROLY-7

ACTIVE

public=42.51.77.19; private=10.0.0.11

基础型

8a425d87-f53a-4a37-9365-b98daae062bb

ROLY-9

ACTIVE

public=42.51.77.18; private=10.0.0.38

基础型

0a6a2d71-38d0-4a30-8f36-92886dcf980c

ROLY-5

ACTIVE

public=42.51.77.3; private=10.0.0.16

基础型

b8095ceb-005c-4ca8-88be-dbdd7bec39ac

ROLY-3

ACTIVE

public=42.51.77.16; private=10.0.0.3

基础型

cb2d19fa-c214-4782-b5be-95e565f35bd5

ROLY-1

PAUSED

public=42.51.77.5; private=10.0.0.19

基础型

nova reboot --hard uuid 对虚机进行硬重启 [root@controller ~]# nova reboot --hard 8a425d87-f53a-4a37-9365-b98daae062bb Request to reboot server <Server: ROLY-9> has been accepted.

[root@controller ~]# openstack server list

ID

Name

Status

Networks

Image

Flavor

748a2e6d-083b-4965-a616-170d1a2bc0d4

Ke'Hu-5

ACTIVE

public=42.51.77.21; private=10.0.0.26

基础型

1fef3e0d-c640-4164-b868-6b9dbcdcc7df

Ke'Hu-1

ACTIVE

public=42.51.77.20; private=10.0.0.17

基础型

3b7120d9-579b-4910-9301-6e6364656e53

Ke'Hu-3

ACTIVE

public=42.51.77.15; private=10.0.0.20

基础型

7b383073-5f0c-43ab-8991-421eb2bac3e8

Ke'Hu-4

ACTIVE

public=42.51.77.4; private=10.0.0.9

基础型

b4500423-62fc-455e-b0f5-13fa4c4f5d58

Ke'Hu-2

ACTIVE

public=42.51.77.12; private=10.0.0.10

基础型

439fa0e0-c747-42e5-9abd-80c8e1e20776

ROLY-7

ACTIVE

public=42.51.77.19; private=10.0.0.11

基础型

8a425d87-f53a-4a37-9365-b98daae062bb

ROLY-9

ACTIVE

public=42.51.77.18; private=10.0.0.38

基础型

0a6a2d71-38d0-4a30-8f36-92886dcf980c

ROLY-5

ACTIVE

public=42.51.77.3; private=10.0.0.16

基础型

b8095ceb-005c-4ca8-88be-dbdd7bec39ac

ROLY-3

ACTIVE

public=42.51.77.16; private=10.0.0.3

基础型

cb2d19fa-c214-4782-b5be-95e565f35bd5

ROLY-1

PAUSED

public=42.51.77.5; private=10.0.0.19

基础型

nova reset-state --active uuid 将虚机状态重置为active,对于部分error虚机无法删除时,运行该命令再删除一般能将虚机删除

[root@controller ~]# openstack server list

ID

Name

Status

Networks

Image

Flavor

748a2e6d-083b-4965-a616-170d1a2bc0d4

Ke'Hu-5

ACTIVE

public=42.51.77.21; private=10.0.0.26

基础型

1fef3e0d-c640-4164-b868-6b9dbcdcc7df

Ke'Hu-1

ACTIVE

public=42.51.77.20; private=10.0.0.17

基础型

3b7120d9-579b-4910-9301-6e6364656e53

Ke'Hu-3

ACTIVE

public=42.51.77.15; private=10.0.0.20

基础型

7b383073-5f0c-43ab-8991-421eb2bac3e8

Ke'Hu-4

ACTIVE

public=42.51.77.4; private=10.0.0.9

基础型

b4500423-62fc-455e-b0f5-13fa4c4f5d58

Ke'Hu-2

ACTIVE

public=42.51.77.12; private=10.0.0.10

基础型

439fa0e0-c747-42e5-9abd-80c8e1e20776

ROLY-7

ACTIVE

public=42.51.77.19; private=10.0.0.11

基础型

8a425d87-f53a-4a37-9365-b98daae062bb

ROLY-9

ACTIVE

public=42.51.77.18; private=10.0.0.38

基础型

0a6a2d71-38d0-4a30-8f36-92886dcf980c

ROLY-5

ACTIVE

public=42.51.77.3; private=10.0.0.16

基础型

b8095ceb-005c-4ca8-88be-dbdd7bec39ac

ROLY-3

ACTIVE

public=42.51.77.16; private=10.0.0.3

基础型

cb2d19fa-c214-4782-b5be-95e565f35bd5

ROLY-1

PAUSED

public=42.51.77.5; private=10.0.0.19

基础型

[root@controller ~]# nova reset-state --active cb2d19fa-c214-4782-b5be-95e565f35bd5 Reset state for server cb2d19fa-c214-4782-b5be-95e565f35bd5 succeeded; new state is active 我们已经看到ROLY-1 的状态已经重置为开启

[root@controller ~]# openstack server list

ID

Name

Status

Networks

Image

Flavor

748a2e6d-083b-4965-a616-170d1a2bc0d4

Ke'Hu-5

ACTIVE

public=42.51.77.21; private=10.0.0.26

基础型

1fef3e0d-c640-4164-b868-6b9dbcdcc7df

Ke'Hu-1

ACTIVE

public=42.51.77.20; private=10.0.0.17

基础型

3b7120d9-579b-4910-9301-6e6364656e53

Ke'Hu-3

ACTIVE

public=42.51.77.15; private=10.0.0.20

基础型

7b383073-5f0c-43ab-8991-421eb2bac3e8

Ke'Hu-4

ACTIVE

public=42.51.77.4; private=10.0.0.9

基础型

b4500423-62fc-455e-b0f5-13fa4c4f5d58

Ke'Hu-2

ACTIVE

public=42.51.77.12; private=10.0.0.10

基础型

439fa0e0-c747-42e5-9abd-80c8e1e20776

ROLY-7

ACTIVE

public=42.51.77.19; private=10.0.0.11

基础型

8a425d87-f53a-4a37-9365-b98daae062bb

ROLY-9

ACTIVE

public=42.51.77.18; private=10.0.0.38

基础型

0a6a2d71-38d0-4a30-8f36-92886dcf980c

ROLY-5

ACTIVE

public=42.51.77.3; private=10.0.0.16

基础型

b8095ceb-005c-4ca8-88be-dbdd7bec39ac

ROLY-3

ACTIVE

public=42.51.77.16; private=10.0.0.3

基础型

cb2d19fa-c214-4782-b5be-95e565f35bd5

ROLY-1

ACTIVE

public=42.51.77.5; private=10.0.0.19

基础型

nova reset-state uuid 重置虚机状态 [root@controller ~]# nova reset-state cb2d19fa-c214-4782-b5be-95e565f35bd5 Reset state for server cb2d19fa-c214-4782-b5be-95e565f35bd5 succeeded; new state is error

[root@controller ~]# openstack server list

ID

Name

Status

Networks

Image

Flavor

748a2e6d-083b-4965-a616-170d1a2bc0d4

Ke'Hu-5

ACTIVE

public=42.51.77.21; private=10.0.0.26

基础型

1fef3e0d-c640-4164-b868-6b9dbcdcc7df

Ke'Hu-1

ACTIVE

public=42.51.77.20; private=10.0.0.17

基础型

3b7120d9-579b-4910-9301-6e6364656e53

Ke'Hu-3

ACTIVE

public=42.51.77.15; private=10.0.0.20

基础型

7b383073-5f0c-43ab-8991-421eb2bac3e8

Ke'Hu-4

ACTIVE

public=42.51.77.4; private=10.0.0.9

基础型

b4500423-62fc-455e-b0f5-13fa4c4f5d58

Ke'Hu-2

ACTIVE

public=42.51.77.12; private=10.0.0.10

基础型

439fa0e0-c747-42e5-9abd-80c8e1e20776

ROLY-7

ACTIVE

public=42.51.77.19; private=10.0.0.11

基础型

8a425d87-f53a-4a37-9365-b98daae062bb

ROLY-9

ACTIVE

public=42.51.77.18; private=10.0.0.38

基础型

0a6a2d71-38d0-4a30-8f36-92886dcf980c

ROLY-5

ACTIVE

public=42.51.77.3; private=10.0.0.16

基础型

b8095ceb-005c-4ca8-88be-dbdd7bec39ac

ROLY-3

ACTIVE

public=42.51.77.16; private=10.0.0.3

基础型

cb2d19fa-c214-4782-b5be-95e565f35bd5

ROLY-1

ERROR

public=42.51.77.5; private=10.0.0.19

基础型

nova delete uuid 删除虚机

[root@controller ~]# openstack server list

ID

Name

Status

Networks

Image

Flavor

748a2e6d-083b-4965-a616-170d1a2bc0d4

Ke'Hu-5

ACTIVE

public=42.51.77.21; private=10.0.0.26

基础型

1fef3e0d-c640-4164-b868-6b9dbcdcc7df

Ke'Hu-1

ACTIVE

public=42.51.77.20; private=10.0.0.17

基础型

3b7120d9-579b-4910-9301-6e6364656e53

Ke'Hu-3

ACTIVE

public=42.51.77.15; private=10.0.0.20

基础型

7b383073-5f0c-43ab-8991-421eb2bac3e8

Ke'Hu-4

ACTIVE

public=42.51.77.4; private=10.0.0.9

基础型

b4500423-62fc-455e-b0f5-13fa4c4f5d58

Ke'Hu-2

ACTIVE

public=42.51.77.12; private=10.0.0.10

基础型

439fa0e0-c747-42e5-9abd-80c8e1e20776

ROLY-7

ACTIVE

public=42.51.77.19; private=10.0.0.11

基础型

8a425d87-f53a-4a37-9365-b98daae062bb

ROLY-9

ACTIVE

public=42.51.77.18; private=10.0.0.38

基础型

0a6a2d71-38d0-4a30-8f36-92886dcf980c

ROLY-5

ACTIVE

public=42.51.77.3; private=10.0.0.16

基础型

b8095ceb-005c-4ca8-88be-dbdd7bec39ac

ROLY-3

ACTIVE

public=42.51.77.16; private=10.0.0.3

基础型

cb2d19fa-c214-4782-b5be-95e565f35bd5

ROLY-1

ERROR

public=42.51.77.5; private=10.0.0.19

基础型

[root@controller ~]# nova delete cb2d19fa-c214-4782-b5be-95e565f35bd5 Request to delete server cb2d19fa-c214-4782-b5be-95e565f35bd5 has been accepted. 我们已经看到ROLY-1已经被删除

[root@controller ~]# openstack server list

ID

Name

Status

Networks

Image

Flavor

748a2e6d-083b-4965-a616-170d1a2bc0d4

Ke'Hu-5

ACTIVE

public=42.51.77.21; private=10.0.0.26

基础型

1fef3e0d-c640-4164-b868-6b9dbcdcc7df

Ke'Hu-1

ACTIVE

public=42.51.77.20; private=10.0.0.17

基础型

3b7120d9-579b-4910-9301-6e6364656e53

Ke'Hu-3

ACTIVE

public=42.51.77.15; private=10.0.0.20

基础型

7b383073-5f0c-43ab-8991-421eb2bac3e8

Ke'Hu-4

ACTIVE

public=42.51.77.4; private=10.0.0.9

基础型

b4500423-62fc-455e-b0f5-13fa4c4f5d58

Ke'Hu-2

ACTIVE

public=42.51.77.12; private=10.0.0.10

基础型

439fa0e0-c747-42e5-9abd-80c8e1e20776

ROLY-7

ACTIVE

public=42.51.77.19; private=10.0.0.11

基础型

8a425d87-f53a-4a37-9365-b98daae062bb

ROLY-9

ACTIVE

public=42.51.77.18; private=10.0.0.38

基础型

0a6a2d71-38d0-4a30-8f36-92886dcf980c

ROLY-5

ACTIVE

public=42.51.77.3; private=10.0.0.16

基础型

b8095ceb-005c-4ca8-88be-dbdd7bec39ac

ROLY-3

ACTIVE

public=42.51.77.16; private=10.0.0.3

基础型

0 人点赞