Skip to content

Custom Images - TypeError: Unrecognized keyword arguments: launch_options #861

@DoctorD90

Description

@DoctorD90

Im trying to create a Custom Image from an object in a specific bucket, with custom Launch Options.
Based on the link https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/datatypes/CreateImageDetails we should be able to use LaunchOptions, but I cant find any way to use them. How and where should we use "LaunchOptions"?

Below there is the configuration/code.

> pip3 show oci
Name: oci
Version: 2.171.0
Summary: Oracle Cloud Infrastructure Python SDK
Home-page: https://docs.oracle.com/en-us/iaas/tools/python/latest/index.html
Author: Oracle
Author-email: joe.levy@oracle.com
License: Universal Permissive License 1.0 or Apache License 2.0
Requires: certifi, circuitbreaker, cryptography, pyOpenSSL, python-dateutil, pytz, urllib3
> python3 --version
Python 3.11.2

This is my python3 code:

import oci
import os
import json

oci_config_file="./oci_config"
the_profile_name=oci.config.DEFAULT_PROFILE or "DEFAULT"

the_namespace="MyNamespace"
bucket_name="MyBucket"
object_name="debian-13-genericcloud-amd64-20260413-2447.qcow2"

qcow2folder='./qcow2/13-trixie/20260413-2447'
metadata_json_file = os.path.join(qcow2folder, f"{os.path.splitext(object_name)[0]}_python.json")
with open(metadata_json_file, "r") as meta_file:
    metadata_json = json.load(meta_file)

config = oci.config.from_file(file_location=oci_config_file, profile_name=the_profile_name)
compute_client = oci.core.ComputeClient(config)

object_display_name=os.path.splitext(os.path.basename(object_name))[0]

# https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/datatypes/LaunchOptions
launch_options = oci.core.models.LaunchOptions(
    boot_volume_type="PARAVIRTUALIZED",
    firmware="UEFI_64", 
    is_consistent_volume_naming_enabled=False, 
    is_pv_encryption_in_transit_enabled=True, 
    network_type="PARAVIRTUALIZED", 
    remote_data_volume_type="PARAVIRTUALIZED" 
)

# https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/datatypes/ImageSourceViaObjectStorageTupleDetails
image_source_details=oci.core.models.ImageSourceViaObjectStorageTupleDetails(
    source_type="objectStorageTuple", 
    bucket_name=bucket_name,
    namespace_name=the_namespace,
    object_name=object_name,
    operating_system="Debian",
    operating_system_version="20260413-2447",
    source_image_type="QCOW2"
)

# https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/datatypes/CreateImageDetails
create_image_details=oci.core.models.CreateImageDetails(
    compartment_id=config['tenancy'],
    display_name=object_display_name, 
    freeform_tags=metadata_json,
    image_source_details=image_source_details, 
    launch_mode="CUSTOM", 
    launch_options=launch_options
)

But what I get is:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "./venv/lib/python3.11/site-packages/oci/decorators.py", line 25, in init
    raise TypeError('Unrecognized keyword arguments: {}'.format(', '.join(six.iterkeys(kwargs))))
TypeError: Unrecognized keyword arguments: launch_options

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions