python libcloud 在 vAPP 中创建虚拟机

标签 python linux vcloud-director-rest-api libcloud

我能够使用 libcloud 在云中创建一个节点 (vAPP),但是 API 没有提到在现有 vAPP 中创建 VM 的方法。有人试过吗?

http://libcloud.readthedocs.org/en/latest/compute/drivers/vcloud.html

from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver

import libcloud.security  

def testConnection():
    #libcloud.security.VERIFY_SSL_CERT = True
    vcloud = get_driver(Provider.VCLOUD)
    driver = vcloud("user@org", "xxxxx", host='portal.local', api_version='5.1')   

    nodes = driver.list_nodes()    
    for i in nodes:
        print i      
    images = driver.list_images()    
    image = [i for i in images if i.name == "New Base VM vApp"][0]
    print image   

    locations = driver.list_locations()
    print locations

    vdcs = driver.vdcs
    vdc = [i for i in vdcs if "VDC_NAME" in i.name ][0]    
    for i in vdcs:
        if "VDC_NAME" in i.name:
            print "VDC\n"
            print i
            dev_test_vdc = i.name
            print i    
    print "creating node"
    node = driver.create_node(name="test_vAPP", image=image,  ex_vdc=dev_test_vdc, ex_clone_timeout=500)

def main():
    testConnection()

if __name__ == "__main__":
    main()

最佳答案

作为 libcloud 中 vCloud 驱动程序的贡献者,恐怕没有对此的支持。 vApp 以 1:1 的方式映射到 VM。您可以在 github 阅读方法 create_node 的实现。

但是你可以contribute这样的功能。

关于python libcloud 在 vAPP 中创建虚拟机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25104261/

相关文章:

python - 在插值中使用先前配置文件中的值

python - 如何在python中验证root权限的用户密码

python - Flake8 报告 E999 SyntaxError atom Flake 8

linux - 打印 file1 到 file2 的差异而不删除 file2 中的任何内容

javascript - 使用 Websocket 连接到虚拟机

python - 如何获取列表框中选定项目的数量?

c - 应用程序的稳健正常关闭

linux - cSipSimple 应用程序错误 :- 'SL_ANDROID_STREAM_VOICE' undeclared (first use in this function)

java - 数据表搜索和分页的奇怪定位(bootstrap 3)