本文整理汇总了Python中cloudmesh_client.common.ConfigDict.ConfigDict.lower方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigDict.lower方法的具体用法?Python ConfigDict.lower怎么用?Python ConfigDict.lower使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cloudmesh_client.common.ConfigDict.ConfigDict
的用法示例。
在下文中一共展示了ConfigDict.lower方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: boot_vm
# 需要导入模块: from cloudmesh_client.common.ConfigDict import ConfigDict [as 别名]
# 或者: from cloudmesh_client.common.ConfigDict.ConfigDict import lower [as 别名]
def boot_vm(self,
name,
group=None,
image=None,
flavor=None,
cloud=None,
cert_thumbprint=None,
pub_key_path=None,
cert_path=None,
pfx_path=None,
secgroup=None,
meta=None,
nics=None,
**kwargs):
"""
Boots up a new VM Instance.
Steps involved: creating a hosted(Cloud) Service, adding the PFX certificate file,
get default storage name, creating a configuration set, adding an endpoint(SSH by default),
and finally creating a VM deployment
:param name: Hosted Service Name and VM instance name
:param group:
:param image:
:param flavor:
:param cloud:
:param cert_thumbprint:
:param pub_key_path:
:param cert_path:
:param pfx_path:
:param secgroup:
:param meta:
:param nics:
:param kwargs:
:return:
"""
location = ConfigDict(filename="cloudmesh.yaml")["cloudmesh"]["clouds"]["azure"]["default"]["location"] or 'Central US'
try:
self.provider.create_hosted_service(service_name=name,
label=name,
location=location)
except:
Console.error("Failed to create hosted service in Azure: {0}".format(traceback.format_exc()))
try:
Console.info("service name: " + name)
Console.info("location name: " + location)
Console.info("cert_thumbprint: " + cert_thumbprint)
Console.info("pub_key_path: " + pub_key_path)
Console.info("cert_path: " + cert_path)
Console.info("pfx_path:" + pfx_path)
Console.info("Image:" + image)
Console.info("Flavor:" + flavor)
#Console.info("Certificate adding")
# Disabled - not required to start Virtual Machine
#self.add_certificate(name, pfx_path)
#Console.info("Certificate added")
except Exception as e:
Console.warning("Console.info error: {0}".format(traceback.format_exc()))
storage_name = self._get_storage_name()
if storage_name is None:
self._create_storage_account()
storage_name = self._get_storage_name()
media_link = 'https://{0}.blob.core.windows.net/vhds/{1}.vhd'.format(
storage_name, name)
os_hd = OSVirtualHardDisk(image, media_link)
username = ConfigDict(filename="cloudmesh.yaml")["cloudmesh"]["clouds"]["azure"]["default"]["username"]
password = ConfigDict(filename="cloudmesh.yaml")["cloudmesh"]["clouds"]["azure"]["default"]["password"]
# Auto-generated Password in case of TBD
if username.lower() in ["tbd"]:
username = "azure";
if password.lower() in ["tbd"]:
password = generate_password(16)
Console.info("Username: "+username)
Console.info("password: "+password)
# TODO: current case handles only for linux guest VMs, implementation needed for Windows VMs
# SSH key configuration does not work properly - DISABLED
linux_config = LinuxConfigurationSet(name, username, password, False)
linux_config.ssh = SSH()
public_key = PublicKey(cert_thumbprint, pub_key_path)
#linux_config.ssh.public_keys.public_keys.append(public_key)
pair = KeyPair(cert_thumbprint, cert_path)
#linux_config.ssh.key_pairs.key_pairs.append(pair)
# Endpoint configuration
network = ConfigurationSet()
network.configuration_set_type = 'NetworkConfiguration'
network.input_endpoints.input_endpoints.append(
ConfigurationSetInputEndpoint('SSH', 'tcp', '22', '22'))
Console.info("blob storage location: {0} ".format(media_link))
try:
vm_create_result = self.provider.create_virtual_machine_deployment(service_name=name,
deployment_name=name,
deployment_slot='production',
label=name,
role_name=name,
#.........这里部分代码省略.........