def __init__(self, plugins=None): """User preference for each service. :param plugins: List of entry point namespaces to load. Create a new :class:`~openstack.profile.Profile` object with no preferences defined, but knowledge of the services. Services are identified by their service type, e.g.: 'identity', 'compute', etc. """ self._services = {} self._add_service(anti_ddos_service.AntiDDosService(version="v1")) self._add_service(block_store_service.BlockStoreService(version="v2")) self._add_service(compute_service.ComputeService(version="v2")) self._add_service(cts_service.CTSService(version="v1")) self._add_service(dms_service.DMSService(version="v1")) self._add_service(identity_service.IdentityService(version="v3")) self._add_service(image_service.ImageService(version="v2")) self._add_service(kms_service.KMSService(version="v1")) self._add_service(maas_service.MaaSService(version="v1")) self._add_service(network_service.NetworkService(version="v2.0")) self._add_service( orchestration_service.OrchestrationService(version="v1")) self._add_service(smn_service.SMNService(version="v2")) # QianBiao.NG HuaWei Services self._add_service(dns_service.DNSService(version="v2")) self._add_service(cloud_eye_service.CloudEyeService(version="v1")) ass = auto_scaling_service.AutoScalingService(version="v1") self._add_service(ass) vbs_v2 = volume_backup_service.VolumeBackupService(version="v2") self._add_service(vbs_v2) self._add_service(map_reduce_service.MapReduceService(version="v1")) self._add_service(evs_service.EvsServiceV2_1(version='v2.1')) self._add_service(evs_service.EvsService(version='v2')) self._add_service(ecs_service.EcsService(version='v1')) self._add_service(ecs_service.EcsServiceV1_1(version='v1.1')) self._add_service(vpc_service.VpcService(version='v2.0')) self._add_service(bms_service.BmsService(version='v1')) self._add_service(lb_service.LoadBalancerService(version='v1')) # not support below service # self._add_service(message_service.MessageService(version="v1")) # self._add_service(cluster_service.ClusterService(version="v1")) # self._add_service(database_service.DatabaseService(version="v1")) # self._add_service(alarm_service.AlarmService(version="v2")) # self._add_service(bare_metal_service.BareMetalService(version="v1")) # self._add_service(key_manager_service.KeyManagerService(version="v1")) # self._add_service( # object_store_service.ObjectStoreService(version="v1")) self._add_service(rds_service.RDSService(version="v1")) self._add_service(cdn_service.CDNService(version='v1')) # self._add_service(rds_os_service.RDSService(version="v1")) # self._add_service(telemetry_service.TelemetryService(version="v2")) # self._add_service(workflow_service.WorkflowService(version="v2")) if plugins: for plugin in plugins: self._load_plugin(plugin) self.service_keys = sorted(self._services.keys())
class Job(resource2.Resource): """Define a Job class.""" base_path = '/jobs' service = bms_service.BmsService() allow_get = True # job's status: SUCCESS, RUNNING, FAIL, INIT. status = resource2.Body('status') # job's operation object entities = resource2.Body('entities', type=dict) # job's id job_id = resource2.Body('job_id') # job's type job_type = resource2.Body('job_type') # begin time begin_time = resource2.Body('begin_time') # end time end_time = resource2.Body('end_time') # the error code when the job execution failed error_code = resource2.Body('error_code') # the fail reason when the job execution failed fail_reason = resource2.Body('fail_reason') # the error message returned when an error occurs message = resource2.Body('message') # the error code returned when an error occurs code = resource2.Body('code') # number of subtasks sub_jobs_total = resource2.Body('sub_jobs_total', type=int) # execution information for each subtask sub_jobs = resource2.Body('sub_jobs', type=list)
class VolumeDetach(resource2.Resource): """Define a VolumeDetach class.""" base_path = '/baremetalservers/%(server_id)s/detachvolume' service = bms_service.BmsService() allow_delete = True # The id of the server to operate on. server_id = resource2.URI('server_id')
class Servers(resource2.Resource): base_path = "/baremetalservers" resource_key = "server" resources_key = 'servers' service = bms_service.BmsService() allow_create = True # string type BMS server name name = resource2.Body('name') # availability zone name availability_zone = resource2.Body('availability_zone') # server size flavorRef = resource2.Body('flavorRef') # image id for create bms server imageRef = resource2.Body('imageRef') # system volume root_volume = resource2.Body('root_volume', type=dict) # data volume data_volumes = resource2.Body('data_volumes', type=list) # file inspect for personal personality = resource2.Body('personality', type=list) # vpc id used for bms server vpcid = resource2.Body('vpcid') # user data inspect to create bms server user_data = resource2.Body('user_data') # project id project_id = resource2.Body('tenant_id') # subnet id used for bms server nics = resource2.Body('nics') # eip configed for bms server publicip = resource2.Body('publicip') # use Cloud-init or Cloudbase-init to set user password admin_password = resource2.Body('adminPass') # whether server name will be renamed isAutoRename = resource2.Body('isAutoRename') # ssh key name to login bms server key_name = resource2.Body('key_name') # created server number count = resource2.Body('count', type=int) # metadata for bms server metadata = resource2.Body('metadata', type=dict) # extend server info extendparam = resource2.Body('extendparam', type=dict) # security groups id security_groups = resource2.Body('security_groups', type=list) # info for schedule server based host scheduler_hints = resource2.Body('os:scheduler_hints', type=dict) # tags for identify bms servers tags = resource2.Body('tags') # task id job_id = resource2.Body('job_id') # order id order_id = resource2.Body('order_id') error = resource2.Body('error') message = resource2.Body('message') code = resource2.Body('code')
class VolumeAttach(resource2.Resource): """Define a VolumeAttach class.""" base_path = '/baremetalservers/%(server_id)s/attachvolume' resource_key = 'volumeAttachment' service = bms_service.BmsService() allow_create = True # The id of the server to operate on. server_id = resource2.URI('server_id') # The volume ID of the volume to be mounted. volumeId = resource2.Body('volumeId') # Disk mount point. device = resource2.Body('device')
class Servers(resource2.Resource): base_path = "/baremetalservers" resource_key = "server" resources_key = 'servers' service = bms_service.BmsService() allow_create = True allow_get = True allow_update = True # string type BMS server name name = resource2.Body('name') # availability zone name availability_zone = resource2.Body('availability_zone') # server size flavorRef = resource2.Body('flavorRef') # image id for create bms server imageRef = resource2.Body('imageRef') # system volume root_volume = resource2.Body('root_volume', type=dict) # data volume data_volumes = resource2.Body('data_volumes', type=list) # file inspect for personal personality = resource2.Body('personality', type=list) # vpc id used for bms server vpcid = resource2.Body('vpcid') # user data inspect to create bms server user_data = resource2.Body('user_data') # project id project_id = resource2.Body('tenant_id') # subnet id used for bms server nics = resource2.Body('nics') # eip configed for bms server publicip = resource2.Body('publicip') # use Cloud-init or Cloudbase-init to set user password admin_password = resource2.Body('adminPass') # whether server name will be renamed isAutoRename = resource2.Body('isAutoRename') # ssh key name to login bms server key_name = resource2.Body('key_name') # created server number count = resource2.Body('count', type=int) # metadata for bms server metadata = resource2.Body('metadata', type=dict) # extend server info extendparam = resource2.Body('extendparam', type=dict) # security groups id security_groups = resource2.Body('security_groups', type=list) # info for schedule server based host scheduler_hints = resource2.Body('os:scheduler_hints', type=dict) # tags for identify bms servers tags = resource2.Body('tags') # # task id # job_id = resource2.Body('job_id') # # order id # order_id = resource2.Body('order_id') # error = resource2.Body('error') # message = resource2.Body('message') # code = resource2.Body('code') # Get the properties of the server. # Bare metal server unique ID. id = resource2.Body('id') # Bare metal server current status information. status = resource2.Body('status') # Bare metal server creation time. created = resource2.Body('created') # Bare metal server last update time. updated = resource2.Body('updated') # The bare metal server corresponds to the bare metal server specification information flavor = resource2.Body('flavor', type=dict) # Bare metal server image information. image = resource2.Body('image', type=dict) # The tenant ID of the bare metal server. tenant_id = resource2.Body('tenant_id') # The user ID of the bare metal server. user_id = resource2.Body('user_id') # The host ID corresponding to the bare metal server. hostId = resource2.Body('hostId') # Network address information corresponding to the bare metal server. addresses = resource2.Body('addresses', type=dict) # Bare metal server related quick link information. links = resource2.Body('links', type=list) # Extended attributes, disk configuration. OS_DCF_diskConfig = resource2.Body('OS-DCF:diskConfig') # Extended attributes, available partition coding. OS_EXT_AZ_availability_zone = resource2.Body('OS-EXT-AZ:availability_zone') # Extended attributes, bare metal server service status. OS_EXT_SERVICE_service_state = resource2.Body( 'OS-EXT-SERVICE:service_state') # Extended attribute, bare metal server host name. OS_EXT_SRV_ATTR_host = resource2.Body('OS-EXT-SRV-ATTR:host') # Extended attributes, hypervisor host name, provided by the Nova virt driver. OS_EXT_SRV_ATTR_hypervisor_hostname = resource2.Body( 'OS-EXT-SRV-ATTR:hypervisor_hostname') # Extended attribute, bare metal server instance ID. OS_EXT_SRV_ATTR_instance_name = resource2.Body( 'OS-EXT-SRV-ATTR:instance_name') # Extended attributes, bare metal server power state. # eg: # 0: 'NO STATE', 1: 'RUNNING', 4: 'SHUTDOWN'. OS_EXT_STS_power_state = resource2.Body('OS-EXT-STS:power_state') # Extended attributes, bare metal server task status. # eg: # rebooting, reboot_started, reboot_started_hard, # powering-off, powering-on, rebuilding, scheduling, deleting. OS_EXT_STS_task_state = resource2.Body('OS-EXT-STS:task_state') # Extended attributes, bare metal server status. # eg: # RUNNING, SHUTOFF, SUSPENDED, REBOOT. OS_EXT_STS_vm_state = resource2.Body('OS-EXT-STS:vm_state') # Extended attributes, bare metal server startup time. OS_SRV_USG_launched_at = resource2.Body('OS-SRV-USG:launched_at') # Extended attributes, bare metal server shutdown time. OS_SRV_USG_terminated_at = resource2.Body('OS-SRV-USG:terminated_at') # The information about the cloud drive mounted on the bare metal server. os_extended_volumes_volumes_attached = resource2.Body( 'os-extended-volumes:volumes_attached', type=list) # Reserved attribute. accessIPv4 = resource2.Body('accessIPv4') # Reserved attribute. accessIPv6 = resource2.Body('accessIPv6') # Optional returned attributes, the cause of the failure. fault = resource2.Body('fault', type=dict) # Reserved attribute. config_drive = resource2.Body('config_drive') # Reserved attribute. progress = resource2.Body('progress') # Bare metal server description. description = resource2.Body('description') # Nova-compute status: UP, UNKNOWN, DOWN, MAINTENANCE, Empty string. host_status = resource2.Body('host_status')