英文:
How do I set custom boot_volume_size_in_gbs value in my Python Script while using the Oracle Cloud Core Services API
问题
我决定创建一个用于自动化创建过程的Python脚本。该脚本基本上每分钟尝试创建一个实例。一切都运行正常,除了我无法找到分配自定义的boot_volume_size_in_gbs 的方法。我多次查阅了文档 ,但仍然找不到任何信息。
我尝试在launch_instance对象内分配boot_volume_size_in_gbs的值:
compute_client = oci.core.ComputeClient(config)
instance = compute_client.launch_instance(
oci.core.models.LaunchInstanceDetails(
compartment_id=compartment_id,
shape=shape,
image_id=image_id,
subnet_id=subnet_id,
display_name=display_name,
availability_domain=availability_domain,
shape_config=oci.core.models.LaunchInstanceShapeConfigDetails(
memory_in_gbs=memory_in_gb,
ocpus=ocpus
),
create_vnic_details=oci.core.models.CreateVnicDetails(
subnet_id=subnet_id,
assign_public_ip=assign_public_ip
),
metadata={
"ssh_authorized_keys": public_key
},
boot_volume_size_in_gbs=boot_volume_size_in_gb
)
).data
我期望它能工作,但实际上出现了以下错误:
Unrecognized keyword arguments: boot_volume_size_in_gbs
英文:
I decided to create a Python script for automating the creation process. The script basically tries to create an instance every minute. Everything is working fine except I cant find a way assign custom boot_volume_size_in_gbs. I went through the docs multiple times. Still can't find anything
I tried assigning boot_volume_size_in_gbs value inside launch_instance object
compute_client = oci.core.ComputeClient(config)
instance = compute_client.launch_instance(
oci.core.models.LaunchInstanceDetails(
compartment_id=compartment_id,
shape=shape,
image_id=image_id,
subnet_id=subnet_id,
display_name=display_name,
availability_domain=availability_domain,
shape_config=oci.core.models.LaunchInstanceShapeConfigDetails(
memory_in_gbs=memory_in_gb,
ocpus=ocpus
),
create_vnic_details=oci.core.models.CreateVnicDetails(
subnet_id=subnet_id,
assign_public_ip=assign_public_ip
),
metadata={
"ssh_authorized_keys": public_key
},
boot_volume_size_in_gbs=boot_volume_size_in_gb
)
).data
I expected it to work but instead got this error:
Unrecognized keyword arguments: boot_volume_size_in_gbs
答案1
得分: 1
以下是翻译的部分:
"Can you please point out the API doc that lists the above parameter? AFAIK, that parameter is no longer supported. The parameter that is supported is memory_in_gbs
. Can you try that and see?"
"能否指出列出上述参数的API文档?据我所知,不再支持该参数。支持的参数是 memory_in_gbs
。您可以尝试使用它吗?"
"Here is the API doc link: https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/datatypes/LaunchInstanceShapeConfigDetails"
"这是API文档链接:https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/datatypes/LaunchInstanceShapeConfigDetails"
"And here is the Python SDK sample for the API operation: https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/Instance/LaunchInstance:~:text=Java%20SDK-,Python,-SDK"
"以下是用于API操作的Python SDK示例:https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/Instance/LaunchInstance:~:text=Java%20SDK-,Python,-SDK"
英文:
Can you please point out the API doc that lists the above parameter? AFAIK, that parameter is no longer supported. The parameter that is supported is memory_in_gbs
. Can you try that and see?
Here is the API doc link: https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/datatypes/LaunchInstanceShapeConfigDetails
And here is the Python SDK sample for the API operation: https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/Instance/LaunchInstance:~:text=Java%20SDK-,Python,-SDK
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论