zoukankan      html  css  js  c++  java
  • openstack 用nova API 指定 compute node 创建 instance

    感谢朋友支持本博客,欢迎共同探讨交流,因为能力和时间有限,错误之处在所难免,欢迎指正!


    假设转载,请保留作者信息。


    博客地址:http://blog.csdn.net/qq_21398167

    原博文地址:http://blog.csdn.net/qq_21398167/article/details/46924597

    我们在博客中能够知道  能用命令行定向创建虚拟机到指定计算节点

    http://blog.csdn.net/qq_21398167/article/details/46710175


    nova boot --image fedora  --flavor 1  test1  --availability-zone nova:node-1

    为此我想看看是否能通过API  创建这种instance

    通过查看 官网中的开源API   能够看到

    http://blog.csdn.net/qq_21398167/article/details/46530305

    中有这样一个API:

    create(name,image,flavor,meta=None, files=None, reservation_id=None,min_count=None,max_count=None,security_groups=None, userdata=None, key_name=None, availability_zone=None, block_device_mapping=None,block_device_mapping_v2=None,nics=None,scheduler_hints=None,config_drive=None, disk_config=None,**kwargs)

    Create (boot) a new server.

    Parameters:
    • name – Something to name the server.
    • image – The Image to boot with.
    • flavor – The Flavor to boot onto.
    • meta – A dict of arbitrary key/value metadata to store for thisserver. Both keys and values must be <=255 characters.
    • files – A dict of files to overrwrite on the server upon boot.Keys are file names (i.e./etc/passwd) and valuesare the file contents (either as a string or as afile-like object). A maximum of five entries is allowed,and each file must be 10k or less.
    • reservation_id – a UUID for the set of servers being requested.
    • min_count – (optional extension) The minimum number ofservers to launch.
    • max_count – (optional extension) The maximum number ofservers to launch.
    • security_groups – A list of security group names
    • userdata – user data to pass to be exposed by the metadataserver this can be a file type object as well or astring.
    • key_name – (optional extension) name of previously createdkeypair to inject into the instance.
    • availability_zone – Name of the availability zone for instanceplacement.
    • block_device_mapping – (optional extension) A dict of blockdevice mappings for this server.
    • block_device_mapping_v2 – (optional extension) A dict of blockdevice mappings for this server.
    • nics – (optional extension) an ordered list of nics to beadded to this server, with information aboutconnected networks, fixed IPs, port etc.
    • scheduler_hints – (optional extension) arbitrary key-value pairsspecified by the client to help boot an instance
    • config_drive – (optional extension) value for config driveeither boolean, or volume-id
    • disk_config – (optional extension) control how the disk ispartitioned when the server is created. possiblevalues are ‘AUTO’ or ‘MANUAL’.
    这个API 中有同样參数   --availability-zone


    所以直接在使用这个API 的时候将默认參数 None  替换成你想定向的那个计算节点名就Ok了!


  • 相关阅读:
    32位IP地址
    我们必须知道,我们终将知道。
    【Java 小白菜入门笔记 2.1】面向对象相关
    【Java 小白菜入门笔记 1.3】流程控制、数组和输入输出
    【Java 小白菜入门笔记 1.2】运算符、方法和语句
    【Java 小白菜入门笔记 1.1】常量和变量
    【论文笔记】PyTorch-BigGraph: A Large-scale Graph Embedding Framework(大规模图嵌入)
    【Java 小白菜入门笔记 1.0】简介与HelloWorld
    【NLP模型笔记】GloVe模型简介
    Python中的defaultdict函数
  • 原文地址:https://www.cnblogs.com/yutingliuyl/p/6773532.html
Copyright © 2011-2022 走看看