• nova shelve 的使用


    对于云中的资源我们常有例如以下需求

    1,用户对临时不使用的VM进行停止操作。以节省费用。

    2。对于长时间未使用的VM。管理员想要从hypervisor层面上清除它们从而节省主机资源。


    3。但之前的停止VM,VM仍旧会占用hypervisor上的资源,而且还须要在主机上占用CPU/内存配额来保证重新启动动的成功。


    以上问题当然也能够通过先做一个快照镜像而且重创VM来解决,可是它会又一次分配一个IP,而且之前的VM仍旧存在,而快照、IP资源也相同会计费

    nova shelve 功能非常好满足了需求,unshelve 后的虚拟机信息和shelve 之前保持不变,原理就是做成镜像上传到glance但保留ip,虚拟机名称。元数据等信息 

    shelve (搁置)、shelve-offload (强制搁置)、unshelve (解搁置)

    眼下还没有集成到horizon 上,仅仅能通过命令或api 使用

    sm@controller:~$ nova help shelve
    usage: nova shelve <server>
    
    Shelve a server.
    
    Positional arguments:
      <server>  Name or ID of server.


    搁置一个虚拟机

    先查看资源占用

    运行 nova shelve mq_ha-4b1c2010-3a9e-42b8-971d-86118c108f2d

    sm@controller:~$ nova shelve mq_ha-4b1c2010-3a9e-42b8-971d-86118c108f2d
    sm@controller:~$ nova list --all-tenant --host network
    +--------------------------------------+--------------------------------------------+--------+-------------------------------+-------------+---------------------------+
    | ID                                   | Name                                       | Status | Task State                    | Power State | Networks                  |
    +--------------------------------------+--------------------------------------------+--------+-------------------------------+-------------+---------------------------+
    | 2cc2c651-f948-429e-9d5d-fbe8532efe39 | ArcGIS 10.3.1 for Desktop-2                | ACTIVE | -                             | Running     | sharednet1=192.168.12.99  |
    | a61baff0-89e7-420d-8bd8-8075b80f05db | ArcGIS 10.3.1 for Server                   | ACTIVE | -                             | Running     | sharednet1=192.168.12.101 |
    | 300f0dc6-ac1f-4104-a52f-2132172a3cee | JobWorker                                  | ACTIVE | -                             | Running     | sharednet1=192.168.12.140 |
    | ee91f3c0-ae50-4377-8ecf-59d59bc2e08b | RabbitMQ                                   | ACTIVE | -                             | Running     | sharednet1=192.168.12.138 |
    | 45d77d2b-723f-40c8-a953-13f886a317f8 | hadoop3                                    | ACTIVE | -                             | Running     | sharednet1=192.168.12.127 |
    | 76d401f0-8442-4317-86e3-46e14e5efc64 | hadoop4                                    | ACTIVE | -                             | Running     | sharednet1=192.168.12.132 |
    | 0b298f89-b253-4df4-9184-148e019e4541 | hadoop5                                    | ACTIVE | -                             | Running     | sharednet1=192.168.12.133 |
    | 4b1c2010-3a9e-42b8-971d-86118c108f2d | mq_ha-4b1c2010-3a9e-42b8-971d-86118c108f2d | ACTIVE | shelving_image_pending_upload | Running     | sharednet1=192.168.12.130 |
    +--------------------------------------+--------------------------------------------+--------+-------------------------------+-------------+---------------------------+

    搁置完毕

    sm@controller:~$ nova list --all-tenant --host network
    +--------------------------------------+-----------------------------+--------+------------+-------------+---------------------------+
    | ID                                   | Name                        | Status | Task State | Power State | Networks                  |
    +--------------------------------------+-----------------------------+--------+------------+-------------+---------------------------+
    | 2cc2c651-f948-429e-9d5d-fbe8532efe39 | ArcGIS 10.3.1 for Desktop-2 | ACTIVE | -          | Running     | sharednet1=192.168.12.99  |
    | a61baff0-89e7-420d-8bd8-8075b80f05db | ArcGIS 10.3.1 for Server    | ACTIVE | -          | Running     | sharednet1=192.168.12.101 |
    | 300f0dc6-ac1f-4104-a52f-2132172a3cee | JobWorker                   | ACTIVE | -          | Running     | sharednet1=192.168.12.140 |
    | ee91f3c0-ae50-4377-8ecf-59d59bc2e08b | RabbitMQ                    | ACTIVE | -          | Running     | sharednet1=192.168.12.138 |
    | 45d77d2b-723f-40c8-a953-13f886a317f8 | hadoop3                     | ACTIVE | -          | Running     | sharednet1=192.168.12.127 |
    | 76d401f0-8442-4317-86e3-46e14e5efc64 | hadoop4                     | ACTIVE | -          | Running     | sharednet1=192.168.12.132 |
    | 0b298f89-b253-4df4-9184-148e019e4541 | hadoop5                     | ACTIVE | -          | Running     | sharednet1=192.168.12.133 |
    +--------------------------------------+-----------------------------+--------+------------+-------------+---------------------------+

    查看资源占用



    查看镜像




  • 相关阅读:
    SVM理论之最优超平面
    回归系列之L1和L2正则化
    Logistic回归明明称呼为回归但为什么是分类算法?
    LTE无线接入三层协议体系结构
    80 道大厂算法高频面试题
    linux内核调试技术之printk
    计算机视觉岗常见面试题
    偏差(Bias)和方差(Variance)——机器学习中的模型选择
    正态分布x/y轴
    Python time strftime()方法
  • 原文地址:https://www.cnblogs.com/yangykaifa/p/7066101.html
Copyright © 2020-2023  润新知