├── .coveragerc ├── .gitignore ├── .gitreview ├── .stestr.conf ├── .zuul.yaml ├── CONTRIBUTING.rst ├── HACKING.rst ├── LICENSE ├── README.rst ├── api-ref └── source │ ├── capsules.inc │ ├── conf.py │ ├── containers.inc │ ├── hosts.inc │ ├── images.inc │ ├── index.rst │ ├── parameters.yaml │ ├── quota_classes.inc │ ├── quotas.inc │ ├── samples │ ├── capsule-create-req.json │ ├── capsule-create-resp.json │ ├── capsule-get-all-resp.json │ ├── capsule-show-resp.json │ ├── container-action-get-resp.json │ ├── container-actions-list-resp.json │ ├── container-commit-resp.json │ ├── container-create-req.json │ ├── container-create-resp.json │ ├── container-execute-resize-resp.json │ ├── container-execute-resp-2.json │ ├── container-execute-resp.json │ ├── container-get-all-resp.json │ ├── container-get-archive-resp.json │ ├── container-logs-req.json │ ├── container-network-list-resp.json │ ├── container-put-archive-req.json │ ├── container-rename-resp.json │ ├── container-show-resp.json │ ├── container-stats-resp.json │ ├── container-top-resp.json │ ├── container-update-req.json │ ├── container-update-resp.json │ ├── host-get-all-resp.json │ ├── host-get-resp.json │ ├── quota-classes-get-resp.json │ ├── quota-classes-update-req.json │ ├── quota-classes-update-resp.json │ ├── quotas-get-defaults-resp.json │ ├── quotas-get-resp.json │ ├── quotas-update-req.json │ ├── quotas-update-resp.json │ ├── service-disable-resp.json │ ├── service-enable-resp.json │ ├── service-forcedown-resp.json │ └── service-get-resp.json │ ├── services.inc │ ├── status.yaml │ └── urls.inc ├── bindep.txt ├── contrib ├── legacy-ubuntu-init │ ├── README.rst │ └── etc │ │ └── init │ │ ├── zun-api.conf │ │ ├── zun-compute.conf │ │ └── zun-wsproxy.conf ├── nova-docker │ ├── devstack │ │ └── lib │ │ │ └── nova │ ├── etc │ │ └── nova │ │ │ └── rootwrap.d │ │ │ └── docker.filters │ └── nova │ │ ├── __init__.py │ │ └── virt │ │ ├── __init__.py │ │ ├── hostutils.py │ │ └── zun │ │ ├── __init__.py │ │ ├── client.py │ │ ├── driver.py │ │ ├── hostinfo.py │ │ ├── network.py │ │ ├── opencontrail.py │ │ └── vifs.py ├── quick-start │ ├── Dockerfile │ └── README.md └── vagrant │ ├── README.md │ ├── Vagrantfile │ ├── config │ └── localrc │ ├── install_devstack.sh │ └── provision.sh ├── devstack ├── README.rst ├── files │ ├── debs │ │ └── zun │ └── rpms │ │ └── zun ├── lib │ └── zun ├── local.conf.sample ├── local.conf.subnode.sample ├── plugin.sh └── settings ├── doc ├── requirements.txt └── source │ ├── admin │ ├── README.rst │ ├── clear-containers.rst │ ├── index.rst │ ├── keep-containers-alive.rst │ ├── osprofiler.rst │ ├── private_registry.rst │ └── security-groups.rst │ ├── cli │ ├── README.rst │ ├── index.rst │ └── zun-status.rst │ ├── conf.py │ ├── configuration │ ├── README.rst │ ├── index.rst │ ├── policy.rst │ └── sample-config.rst │ ├── contributor │ ├── README.rst │ ├── api-microversion.rst │ ├── capsule.rst │ ├── contributing.rst │ ├── documentation.rst │ ├── gerrit.rst │ ├── index.rst │ ├── jenkins.rst │ ├── launchpad.rst │ ├── mod-wsgi.rst │ ├── multinode-devstack.rst │ ├── objects.rst │ ├── quickstart.rst │ ├── releasenotes.rst │ ├── tempest-tests.rst │ ├── unit-tests.rst │ └── vision-reflection.rst │ ├── index.rst │ ├── install │ ├── README.rst │ ├── compute-install.rst │ ├── controller-install.rst │ ├── get_started.rst │ ├── index.rst │ ├── launch-container.rst │ ├── next-steps.rst │ ├── overview.rst │ └── verify.rst │ ├── reference │ ├── api-microversion-history.rst │ └── index.rst │ └── user │ └── filter-scheduler.rst ├── etc ├── apache2 │ └── zun.conf.template ├── cni │ └── net.d │ │ └── 10-zun-cni.conf └── zun │ ├── api-paste.ini │ ├── rootwrap.conf │ ├── rootwrap.d │ └── zun.filters │ ├── zun-config-generator.conf │ └── zun-policy-generator.conf ├── playbooks ├── fullstack │ ├── post.yaml │ └── run.yaml └── zun-tempest-base │ └── post.yaml ├── releasenotes ├── notes │ ├── .placeholder │ ├── add-cni-plugin-fd5bf4e9abbe6683.yaml │ ├── add-support-for-cri-runtime-2c549a85fe795361.yaml │ ├── add-support-for-requested_host-0ea7e317234c3d0c.yaml │ ├── add-upgrade-check-framework-4729fcb4ecd31221.yaml │ ├── container_driver-e82fe9c64c9b994b.yaml │ ├── deprecate-CPU-Ram-Disk-filter-fa8ed0d10b0bd92a.yaml │ ├── deprecate-json-formatted-policy-file-1c77a54f9a043c25.yaml │ ├── drop-py-2-7-c475cf37ff3476d8.yaml │ ├── introduce-CNI-plugin-for-docker-07d6a78cd281a508.yaml │ ├── placement-integration-d701f64c584981d6.yaml │ ├── support-entrypoint-option-5127ab5044025380.yaml │ └── zuul-v3-native-gates-a46ef4c168f9362e.yaml └── source │ ├── 2023.1.rst │ ├── 2023.2.rst │ ├── 2024.1.rst │ ├── 2024.2.rst │ ├── 2025.1.rst │ ├── _static │ └── .placeholder │ ├── _templates │ └── .placeholder │ ├── conf.py │ ├── index.rst │ ├── pike.rst │ ├── queens.rst │ ├── rocky.rst │ ├── stein.rst │ ├── train.rst │ ├── unreleased.rst │ ├── ussuri.rst │ ├── victoria.rst │ ├── wallaby.rst │ ├── xena.rst │ ├── yoga.rst │ └── zed.rst ├── requirements.txt ├── roles ├── fetch_containerd_log │ └── tasks │ │ └── main.yaml └── fetch_docker_log │ └── tasks │ └── main.yaml ├── setup.cfg ├── setup.py ├── specs ├── cinder-integration.rst ├── container-SRIOV-networking.rst ├── container-composition.rst ├── container-interactive-mode.rst ├── container-sandbox.rst ├── container-snapshot.rst ├── cpuset-container.rst ├── kuryr-integration.rst ├── local-volume-integration.rst ├── pci-device-model.rst └── zun-api-validation.rst ├── template └── capsule │ ├── capsule-init-containers.yaml │ ├── capsule-volume.yaml │ └── capsule.yaml ├── test-requirements.txt ├── tools ├── README-zun.conf.txt ├── fast8.sh ├── flake8wrap.sh ├── gen-config ├── gen-criapi ├── test-setup.sh └── zun-config-generator.conf ├── tox.ini └── zun ├── MANIFEST.in ├── __init__.py ├── api ├── __init__.py ├── app.py ├── app.wsgi ├── config.py ├── controllers │ ├── __init__.py │ ├── base.py │ ├── link.py │ ├── root.py │ ├── v1 │ │ ├── __init__.py │ │ ├── availability_zone.py │ │ ├── capsules.py │ │ ├── collection.py │ │ ├── containers.py │ │ ├── hosts.py │ │ ├── images.py │ │ ├── networks.py │ │ ├── quota_classes.py │ │ ├── quotas.py │ │ ├── registries.py │ │ ├── schemas │ │ │ ├── __init__.py │ │ │ ├── capsules.py │ │ │ ├── containers.py │ │ │ ├── images.py │ │ │ ├── network.py │ │ │ ├── parameter_types.py │ │ │ ├── quota_classes.py │ │ │ ├── quotas.py │ │ │ ├── registries.py │ │ │ └── services.py │ │ ├── views │ │ │ ├── __init__.py │ │ │ ├── actions_view.py │ │ │ ├── availability_zone_view.py │ │ │ ├── capsules_view.py │ │ │ ├── containers_view.py │ │ │ ├── hosts_view.py │ │ │ ├── images_view.py │ │ │ ├── network_view.py │ │ │ ├── registries_view.py │ │ │ └── services_view.py │ │ └── zun_services.py │ └── versions.py ├── hooks.py ├── http_error.py ├── middleware │ ├── __init__.py │ ├── auth_token.py │ └── parsable_error.py ├── rest_api_version_history.rst ├── servicegroup.py ├── utils.py ├── validation │ ├── __init__.py │ └── validators.py ├── versioned_method.py └── wsgi.py ├── cmd ├── __init__.py ├── api.py ├── compute.py ├── db_manage.py ├── status.py └── wsproxy.py ├── cni ├── __init__.py ├── api.py ├── binding │ ├── __init__.py │ ├── base.py │ └── bridge.py ├── cmd │ ├── __init__.py │ ├── cni.py │ └── cni_daemon.py ├── daemon │ ├── __init__.py │ └── service.py ├── plugins │ ├── __init__.py │ └── zun_cni_registry.py └── utils.py ├── common ├── __init__.py ├── clients.py ├── config.py ├── consts.py ├── context.py ├── crypt.py ├── docker_image │ ├── __init__.py │ ├── digest.py │ ├── reference.py │ └── regexp.py ├── exception.py ├── i18n.py ├── keystone.py ├── mount.py ├── name_generator.py ├── paths.py ├── policies │ ├── __init__.py │ ├── availability_zone.py │ ├── base.py │ ├── capsule.py │ ├── container.py │ ├── container_action.py │ ├── host.py │ ├── image.py │ ├── network.py │ ├── quota.py │ ├── quota_class.py │ ├── registry.py │ └── zun_service.py ├── policy.py ├── privileged.py ├── profiler.py ├── quota.py ├── rpc.py ├── rpc_service.py ├── service.py ├── short_id.py ├── singleton.py ├── utils.py └── yamlutils.py ├── compute ├── __init__.py ├── api.py ├── claims.py ├── compute_node_tracker.py ├── container_actions.py ├── manager.py ├── provider_tree.py └── rpcapi.py ├── conf ├── __init__.py ├── api.py ├── availability_zone.py ├── cinder_client.py ├── cni_daemon.py ├── compute.py ├── container_driver.py ├── database.py ├── docker.py ├── glance_client.py ├── image_driver.py ├── keystone.py ├── netconf.py ├── network.py ├── neutron.py ├── neutron_client.py ├── opts.py ├── path.py ├── pci.py ├── placement_client.py ├── profiler.py ├── quota.py ├── scheduler.py ├── services.py ├── ssl.py ├── utils.py ├── volume.py ├── websocket_proxy.py └── zun_client.py ├── container ├── __init__.py ├── cri │ ├── __init__.py │ └── driver.py ├── docker │ ├── __init__.py │ ├── driver.py │ ├── host.py │ └── utils.py ├── driver.py └── os_capability │ ├── __init__.py │ ├── host_capability.py │ └── linux │ ├── __init__.py │ └── os_capability_linux.py ├── criapi ├── __init__.py ├── api_pb2.py ├── api_pb2_grpc.py └── gogo_pb2.py ├── db ├── __init__.py ├── api.py ├── etcd │ └── __init__.py ├── migration.py └── sqlalchemy │ ├── __init__.py │ ├── alembic.ini │ ├── alembic │ ├── README │ ├── env.py │ ├── script.py.mako │ └── versions │ │ ├── 012a730926e8_add_quota_usage.py │ │ ├── 02134de8e7d3_add_exposed_ports_to_container.py │ │ ├── 04ba87af76bb_add_container_host_operating_system_info.py │ │ ├── 09f196622a3f_create_inventory_table.py │ │ ├── 105626c4f972_add_privileged_to_container.py │ │ ├── 10c9668a816d_add_volumes_info_and_addresses_to_.py │ │ ├── 10d65e285a59_create_volume_mapping_table.py │ │ ├── 1192ba19a6e9_add_cpu_workdir_ports_hostname_labels_.py │ │ ├── 157a0595e13e_drop_capsule_table.py │ │ ├── 174cafda0857_add_security_groups.py │ │ ├── 17ab8b533cc8_add_container_hosts_label_info.py │ │ ├── 1bc34e18180b_add_registry_id_to_container.py │ │ ├── 21fa080c818a_add_enable_cpu_pinning_to_compute_node.py │ │ ├── 238f94009eab_add_disk_quota_supported_to_compute_node.py │ │ ├── 26896d5f9053_create_exec_instance_table.py │ │ ├── 271c7f45982d_add_started_at_to_container.py │ │ ├── 2b045cb595db_create_quota_quota_class_tables.py │ │ ├── 2b129060baff_support_container_cpuset.py │ │ ├── 2fb377a5a519_add_healthcheck_to_container.py │ │ ├── 3298c6a5c3d9_create_network_table.py │ │ ├── 33cdd98bb9b2_split_volume_mapping_table.py │ │ ├── 35cb52c5553f_rename_volume_id_to_cinder_volume_id_in_.py │ │ ├── 372433c0afd2_add_auto_heal_to_container.py │ │ ├── 37bce72463e3_add_pci_device.py │ │ ├── 3e80bbfd8da7_convert_type_of_command_from_string_to_.py │ │ ├── 3f2b36231bee_add_host_to_zunnetwork.py │ │ ├── 3f49fa520409_add_availability_zone_to_service.py │ │ ├── 43e1088c3389_add_image_pull_policy_column.py │ │ ├── 47d79ffdc582_add_cni_metadata_to_container.py │ │ ├── 4a0c4f7a4a33_add_meta_addresses_to_container.py │ │ ├── 4bf34495d060_add_container_number_info_to_compute_.py │ │ ├── 50829990c965_add_ondelete_to_container_actions_.py │ │ ├── 531e4a890480_add_host_to_container.py │ │ ├── 5359d23b2322_add_websocket_url_and_websocket_token.py │ │ ├── 53a8b515057e_add_memory_info_to_compute_node.py │ │ ├── 5458f8394206_add_image_driver_field.py │ │ ├── 54bcb75afb32_add_init_containers_uuids_to_capsule.py │ │ ├── 5971a6844738_add_container_id_column_to_container.py │ │ ├── 5ffc1cabe6b4_add_registry_table.py │ │ ├── 63a08e32cc43_add_task_state_to_container.py │ │ ├── 648c25faa0be_add_mem_used_to_compute_node.py │ │ ├── 6fd4f7582eb0_add_resource_provider_table.py │ │ ├── 6ff4d35f4334_change_property_of_restart_policy_in_.py │ │ ├── 71f8b4cf1dbf_upgrade.py │ │ ├── 72c6947c6636_create_table_image.py │ │ ├── 74c97dca93d0_add_missing_index_and_foreign_key.py │ │ ├── 75315e219cfb_add_auto_remove_to_container.py │ │ ├── 7975b7f0f792_add_resource_class_table.py │ │ ├── 8192905fd835_add_uuid_to_resource_class.py │ │ ├── 8b0082d9e7c1_drop_foreign_key_of_container_actions.py │ │ ├── 8c3d80e18eb5_add_container_cpus_cpu_used_to_compute_.py │ │ ├── 93fbb05b77b9_add_memory_field_to_container.py │ │ ├── 945569b3669f_add_runtime_column.py │ │ ├── 9fe371393a24_create_table_container.py │ │ ├── a019998b09b5_add_host_to_image.py │ │ ├── a251f1f61217_create_capsule_table.py │ │ ├── a9a92eebd9a8_create_table_zun_service.py │ │ ├── a9c9fb54274a_add_contents_to_volume_mapping_table.py │ │ ├── ad43a2179cf2_add_status_detail.py │ │ ├── b2bda272f4dd_add_tty_to_container.py │ │ ├── b6bfca998431_add_container_actions_events_table.py │ │ ├── bbcfa910a8a5_add_restart_policy_column.py │ │ ├── bc56b9932dd9_add_runtime_to_compute_node.py │ │ ├── bcd6410d645e_add_host_to_capsule.py │ │ ├── c2052ead4f95_remove_meta_from_container.py │ │ ├── c5565cbaa3de_insert_status_reason_to_container_table.py │ │ ├── ce9944b346cb_combine_tty_and_stdin_open.py │ │ ├── cf46a28f46bc_add_container_actions_table.py │ │ ├── cff60402dd86_add_capsule_id_to_containers.py │ │ ├── d0c606fdec3c_add_disk_info_to_compute_node.py │ │ ├── d1ef05fd92c8_add_tty_stdin_open.py │ │ ├── d2affd5b4172_add_auto_remove_to_volume_mapping.py │ │ ├── d502ce8fb705_add_rp_uuid_to_compute_node.py │ │ ├── d73b72ab7cc6_add_container_type_to_container.py │ │ ├── d9714eadbdc2_add_disk_to_container.py │ │ ├── df87dbd4846c_add_annotations_to_container.py │ │ ├── e4d145e195f4_create_allocation_table.py │ │ ├── eeac0d191f5a_add_compute_node_table.py │ │ ├── f046346d1d87_add_timestamp_to_pci_device.py │ │ ├── f746cd28bcac_add_host_to_volume_mapping.py │ │ ├── f979327df44b_add_entrypoint_to_container.py │ │ ├── fb9ad4a050f8_drop_container_actions_foreign_key.py │ │ ├── fc27c7415d9c_change_the_properties_of_meta_labels.py │ │ └── ff7b9665d504_add_pci_stats_to_compute_node.py │ ├── api.py │ ├── migration.py │ └── models.py ├── hacking ├── __init__.py └── checks.py ├── image ├── __init__.py ├── docker │ ├── __init__.py │ └── driver.py ├── driver.py └── glance │ ├── __init__.py │ ├── driver.py │ └── utils.py ├── network ├── __init__.py ├── cni_network.py ├── kuryr_network.py ├── linux_net.py ├── model.py ├── network.py ├── neutron.py └── os_vif_util.py ├── objects ├── __init__.py ├── base.py ├── compute_node.py ├── container.py ├── container_action.py ├── container_pci_requests.py ├── exec_instance.py ├── fields.py ├── image.py ├── numa.py ├── pci_device.py ├── pci_device_pool.py ├── quota.py ├── quota_class.py ├── registry.py ├── request_group.py ├── resource_class.py ├── resource_provider.py ├── vif.py ├── volume.py ├── volume_mapping.py ├── zun_network.py └── zun_service.py ├── pci ├── __init__.py ├── devspec.py ├── manager.py ├── request.py ├── stats.py ├── utils.py └── whitelist.py ├── scheduler ├── __init__.py ├── base_filters.py ├── chance_scheduler.py ├── client │ ├── __init__.py │ ├── query.py │ └── report.py ├── driver.py ├── filter_scheduler.py ├── filters │ ├── __init__.py │ ├── availability_zone_filter.py │ ├── compute_filter.py │ ├── cpu_filter.py │ ├── cpuset_filter.py │ ├── disk_filter.py │ ├── label_filter.py │ ├── pci_passthrough_filter.py │ ├── ram_filter.py │ └── runtime_filter.py ├── host_state.py ├── loadables.py ├── request_filter.py └── utils.py ├── servicegroup ├── __init__.py └── zun_service_periodic.py ├── tests ├── __init__.py ├── base.py ├── conf_fixture.py ├── fullstack │ ├── __init__.py │ ├── base.py │ ├── test_containers.py │ └── utils.py ├── migration │ ├── __init__.py │ └── test_migrations.py ├── policy_fixture.py ├── unit │ ├── __init__.py │ ├── api │ │ ├── __init__.py │ │ ├── base.py │ │ ├── controllers │ │ │ ├── __init__.py │ │ │ ├── auth-paste.ini │ │ │ ├── auth-root-access.ini │ │ │ ├── auth-v1-access.ini │ │ │ ├── noauth-paste.ini │ │ │ ├── test_base.py │ │ │ ├── test_link.py │ │ │ ├── test_root.py │ │ │ └── v1 │ │ │ │ ├── __init__.py │ │ │ │ ├── test_availability_zones.py │ │ │ │ ├── test_capsules.py │ │ │ │ ├── test_containers.py │ │ │ │ ├── test_hosts.py │ │ │ │ ├── test_images.py │ │ │ │ ├── test_networks.py │ │ │ │ ├── test_quota_classes.py │ │ │ │ ├── test_quotas.py │ │ │ │ ├── test_registries.py │ │ │ │ └── test_zun_service.py │ │ ├── test_utils.py │ │ ├── test_validations.py │ │ └── utils.py │ ├── cmd │ │ ├── __init__.py │ │ └── test_status.py │ ├── common │ │ ├── __init__.py │ │ ├── docker_image │ │ │ ├── __init__.py │ │ │ ├── test_reference.py │ │ │ └── test_regexp.py │ │ ├── test_clients.py │ │ ├── test_context.py │ │ ├── test_mount.py │ │ ├── test_profiler.py │ │ ├── test_rpc.py │ │ └── test_utils.py │ ├── compute │ │ ├── __init__.py │ │ ├── test_compute_api.py │ │ ├── test_compute_manager.py │ │ ├── test_compute_node_tracker.py │ │ ├── test_compute_rpcapi.py │ │ └── test_provider_tree.py │ ├── conf │ │ ├── __init__.py │ │ └── test_conf.py │ ├── container │ │ ├── __init__.py │ │ ├── base.py │ │ ├── docker │ │ │ ├── __init__.py │ │ │ ├── test_docker_driver.py │ │ │ └── test_utils.py │ │ ├── fake_driver.py │ │ └── os_capability │ │ │ ├── __init__.py │ │ │ └── linux │ │ │ ├── __init__.py │ │ │ └── os_capability_linux │ │ │ ├── __init__.py │ │ │ └── test_os_capability_linux.py │ ├── db │ │ ├── __init__.py │ │ ├── base.py │ │ ├── test_allocation.py │ │ ├── test_compute_host.py │ │ ├── test_container.py │ │ ├── test_container_action.py │ │ ├── test_exec_instance.py │ │ ├── test_image.py │ │ ├── test_inventory.py │ │ ├── test_network.py │ │ ├── test_pci_device.py │ │ ├── test_quota_classes.py │ │ ├── test_quotas.py │ │ ├── test_registry.py │ │ ├── test_resource_class.py │ │ ├── test_resource_provider.py │ │ ├── test_volume.py │ │ ├── test_volume_mapping.py │ │ ├── test_zun_service.py │ │ └── utils.py │ ├── fake_pci_device_pools.py │ ├── fake_requests.py │ ├── image │ │ ├── __init__.py │ │ ├── docker │ │ │ ├── __init__.py │ │ │ └── test_driver.py │ │ ├── glance │ │ │ ├── __init__.py │ │ │ └── test_driver.py │ │ └── test_driver.py │ ├── network │ │ ├── __init__.py │ │ └── test_kuryr_network.py │ ├── objects │ │ ├── __init__.py │ │ ├── test_capsule.py │ │ ├── test_compute_node.py │ │ ├── test_container.py │ │ ├── test_container_action.py │ │ ├── test_exec_instance.py │ │ ├── test_fields.py │ │ ├── test_image.py │ │ ├── test_network.py │ │ ├── test_numa.py │ │ ├── test_objects.py │ │ ├── test_pci_device_pool.py │ │ ├── test_quota.py │ │ ├── test_quota_class.py │ │ ├── test_registry.py │ │ ├── test_resource_class.py │ │ ├── test_resource_provider.py │ │ ├── test_volume_mapping.py │ │ ├── test_zun_service.py │ │ └── utils.py │ ├── pci │ │ ├── __init__.py │ │ ├── fakes.py │ │ ├── test_devspec.py │ │ ├── test_manager.py │ │ ├── test_stats.py │ │ ├── test_utils.py │ │ └── test_whitelist.py │ ├── scheduler │ │ ├── __init__.py │ │ ├── client │ │ │ ├── __init__.py │ │ │ ├── test_query.py │ │ │ └── test_report.py │ │ ├── fake_loadables │ │ │ ├── __init__.py │ │ │ ├── fake_loadable1.py │ │ │ └── fake_loadable2.py │ │ ├── fakes.py │ │ ├── filters │ │ │ ├── __init__.py │ │ │ ├── test_availability_zone_filter.py │ │ │ ├── test_compute_filter.py │ │ │ ├── test_cpu_filter.py │ │ │ ├── test_cpuset_filter.py │ │ │ ├── test_disk_filter.py │ │ │ ├── test_label_filter.py │ │ │ ├── test_pci_passthrough_filters.py │ │ │ ├── test_ram_filter.py │ │ │ └── test_runtime_filter.py │ │ ├── test_base_filter.py │ │ ├── test_chance_scheduler.py │ │ ├── test_filter_scheduler.py │ │ ├── test_loadables.py │ │ └── test_scheduler.py │ ├── servicegroup │ │ ├── __init__.py │ │ └── test_zun_service.py │ ├── test_hacking.py │ ├── test_zun.py │ └── volume │ │ ├── __init__.py │ │ ├── test_cinder_api.py │ │ ├── test_cinder_workflow.py │ │ └── test_driver.py └── uuidsentinel.py ├── version.py ├── volume ├── __init__.py ├── cinder_api.py ├── cinder_workflow.py └── driver.py └── websocket ├── __init__.py ├── websocketclient.py └── websocketproxy.py /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | branch = True 3 | source = zun 4 | omit = zun/tests/* 5 | 6 | [report] 7 | ignore_errors = True 8 | exclude_lines = 9 | pass 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.py[cod] 2 | 3 | # C extensions 4 | *.so 5 | 6 | # Packages 7 | *.egg* 8 | dist 9 | build 10 | eggs 11 | parts 12 | bin 13 | var 14 | sdist 15 | develop-eggs 16 | .installed.cfg 17 | lib64 18 | 19 | # Installer logs 20 | pip-log.txt 21 | 22 | # Unit test / coverage reports 23 | .coverage 24 | cover 25 | cover-master 26 | .tox 27 | nosetests.xml 28 | .testrepository 29 | .venv 30 | .stestr 31 | 32 | # Translations 33 | *.mo 34 | 35 | # Mr Developer 36 | .mr.developer.cfg 37 | .project 38 | .pydevproject 39 | .idea 40 | 41 | # Complexity 42 | output/*.html 43 | output/*/index.html 44 | 45 | # Sphinx 46 | doc/build 47 | doc/source/_static/ 48 | 49 | # pbr generates these 50 | AUTHORS 51 | ChangeLog 52 | 53 | # Editors 54 | *~ 55 | .*.swp 56 | .*sw? 57 | *.DS_Store 58 | 59 | # Files created by releasenotes build 60 | releasenotes/build 61 | 62 | # generated config file 63 | etc/zun/zun.conf.sample 64 | 65 | # generated policy file 66 | etc/zun/policy.yaml.sample 67 | -------------------------------------------------------------------------------- /.gitreview: -------------------------------------------------------------------------------- 1 | [gerrit] 2 | host=review.opendev.org 3 | port=29418 4 | project=openstack/zun.git 5 | -------------------------------------------------------------------------------- /.stestr.conf: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | test_path=${OS_TEST_PATH:-./zun/tests/unit} 3 | top_dir=./ 4 | -------------------------------------------------------------------------------- /CONTRIBUTING.rst: -------------------------------------------------------------------------------- 1 | The source repository for this project can be found at: 2 | 3 | https://opendev.org/openstack/zun 4 | 5 | Pull requests submitted through GitHub are not monitored. 6 | 7 | To start contributing to OpenStack, follow the steps in the contribution guide 8 | to set up and use Gerrit: 9 | 10 | https://docs.openstack.org/contributors/code-and-documentation/quick-start.html 11 | 12 | Bugs should be filed on Launchpad: 13 | 14 | https://bugs.launchpad.net/zun 15 | 16 | For more specific information about contributing to this repository, see the 17 | zun contributor guide: 18 | 19 | https://docs.openstack.org/zun/latest/contributor/contributing.html 20 | -------------------------------------------------------------------------------- /HACKING.rst: -------------------------------------------------------------------------------- 1 | Zun Style Commandments 2 | ====================== 3 | 4 | Read the OpenStack Style Commandments https://docs.openstack.org/hacking/latest/ 5 | 6 | Zun Specific Commandments 7 | ------------------------- 8 | 9 | - [Z302] Change assertEqual(A is not None) by optimal assert like 10 | assertIsNotNone(A). 11 | - [Z310] timeutils.utcnow() wrapper must be used instead of direct calls to 12 | datetime.datetime.utcnow() to make it easy to override its return value. 13 | - [Z316] Change assertTrue(isinstance(A, B)) by optimal assert like 14 | assertIsInstance(A, B). 15 | - [Z322] Method's default argument shouldn't be mutable. 16 | - [Z323] Change assertEqual(True, A) or assertEqual(False, A) by optimal assert 17 | like assertTrue(A) or assertFalse(A) 18 | - [Z336] Must use a dict comprehension instead of a dict constructor 19 | with a sequence of key-value pairs. 20 | - [Z338] Use assertIn/NotIn(A, B) rather than assertEqual(A in B, True/False). 21 | - [Z339] Don't use xrange() 22 | - [Z352] LOG.warn is deprecated. Enforce use of LOG.warning. 23 | - [Z353] Don't translate logs. 24 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | ======================== 2 | Team and repository tags 3 | ======================== 4 | 5 | .. image:: https://governance.openstack.org/tc/badges/zun.svg 6 | :target: https://governance.openstack.org/tc/reference/tags/index.html 7 | 8 | .. image:: https://www.openstack.org/themes/openstack/images/project-mascots/Zun/OpenStack_Project_Zun_mascot.jpg 9 | 10 | .. Change things from this point on 11 | 12 | === 13 | Zun 14 | === 15 | 16 | OpenStack Containers service 17 | 18 | Zun (ex. Higgins) is the OpenStack Containers service. It aims to provide an 19 | API service for running application containers without the need to manage 20 | servers or clusters. 21 | 22 | * Free software: Apache license 23 | * Get Started: https://docs.openstack.org/zun/latest/contributor/quickstart.html 24 | * Documentation: https://docs.openstack.org/zun/latest/ 25 | * Source: https://opendev.org/openstack/zun 26 | * Bugs: https://bugs.launchpad.net/zun 27 | * Blueprints: https://blueprints.launchpad.net/zun 28 | * REST Client: https://opendev.org/openstack/python-zunclient 29 | 30 | Features 31 | -------- 32 | 33 | * TODO 34 | -------------------------------------------------------------------------------- /api-ref/source/images.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/api-ref/source/images.inc -------------------------------------------------------------------------------- /api-ref/source/index.rst: -------------------------------------------------------------------------------- 1 | :tocdepth: 2 2 | 3 | ======================= 4 | Containers Service API 5 | ======================= 6 | 7 | .. rest_expand_all:: 8 | 9 | .. include:: urls.inc 10 | .. include:: capsules.inc 11 | .. include:: containers.inc 12 | .. include:: images.inc 13 | .. include:: services.inc 14 | .. include:: hosts.inc 15 | .. include:: quotas.inc 16 | .. include:: quota_classes.inc 17 | -------------------------------------------------------------------------------- /api-ref/source/samples/container-action-get-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "action": "create", 3 | "events": [ 4 | { 5 | "event": "container__do_container_start", 6 | "finish_time": "2018-03-04T17:03:07.000000", 7 | "result": "Success", 8 | "start_time": "2018-03-04T17:02:57.000000", 9 | "traceback": null 10 | } 11 | ], 12 | "container_uuid": "b48316c5-71e8-45e4-9884-6c78055b9b13", 13 | "message": null, 14 | "project_id": "853719b303ef4858a195535eb520e58d", 15 | "request_id": "req-3293a3f1-b44c-4609-b8d2-d81b105636b8", 16 | "start_time": "2018-03-04T17:02:54.000000", 17 | "finish_time": "2018-03-04T17:02:57.000000", 18 | "user_id": "22e81669093742b7a74b1d715a9a5813" 19 | } 20 | -------------------------------------------------------------------------------- /api-ref/source/samples/container-actions-list-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "containerActions": [ 3 | { 4 | "action": "create", 5 | "container_uuid": "b48316c5-71e8-45e4-9884-6c78055b9b13", 6 | "message": null, 7 | "project_id": "853719b303ef4858a195535eb520e58d", 8 | "request_id": "req-25517360-b757-47d3-be45-0e8d2a01b36a", 9 | "start_time": "2018-03-04T19:48:49.000000", 10 | "finish_time": "2018-03-04T19:48:55.000000", 11 | "user_id": "22e81669093742b7a74b1d715a9a5813" 12 | }, 13 | { 14 | "action": "stop", 15 | "container_uuid": "b48316c5-71e8-45e4-9884-6c78055b9b13", 16 | "message": null, 17 | "project_id": "853719b303ef4858a195535eb520e58d", 18 | "request_id": "req-3293a3f1-b44c-4609-b8d2-d81b105636b8", 19 | "start_time": "2018-03-04T17:02:54.000000", 20 | "finish_time": "2018-03-04T17:02:58.000000", 21 | "user_id": "22e81669093742b7a74b1d715a9a5813" 22 | } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /api-ref/source/samples/container-commit-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "uuid": "64281d85-e9a3-4c54-8d30-9ee72a596d8a" 3 | } 4 | -------------------------------------------------------------------------------- /api-ref/source/samples/container-create-req.json: -------------------------------------------------------------------------------- 1 | { 2 | "environment":{ 3 | "foo": "bar" 4 | }, 5 | "labels":{ 6 | "app": "hello" 7 | }, 8 | "image": "ubuntu", 9 | "command": [ 10 | "/bin/sh", 11 | "-c", 12 | "'echo hello'" 13 | ], 14 | "name": "test", 15 | "cpu": 2, 16 | "memory": 500, 17 | "workdir": "/home/ubuntu", 18 | "restart_policy":{ 19 | "Name": "no", 20 | "MaximumRetryCount": 0 21 | }, 22 | "interactive": false, 23 | "tty": false, 24 | "image_driver": "docker", 25 | "security_groups": [ 26 | "default" 27 | ], 28 | "nets": [ 29 | { 30 | "v4-fixed-ip": "", 31 | "network": "", 32 | "v6-fixed-ip": "", 33 | "port": "890699a9-4690-4bd6-8b70-3a9c1be77ecb" 34 | } 35 | ], 36 | "runtime": "runc", 37 | "hostname": "testhost", 38 | "auto_remove": false, 39 | "auto_heal": false, 40 | "availability_zone": "nova", 41 | "hints": { 42 | "foo": "bar" 43 | }, 44 | "mounts": [ 45 | { 46 | "source": "myvol", 47 | "destination": "/data" 48 | } 49 | ], 50 | "privileged": false, 51 | "healthcheck": { 52 | "cmd": "stat /etc/passwd || exit 1", 53 | "interval": 3, 54 | "retries": 2, 55 | "timeout": 5 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /api-ref/source/samples/container-execute-resize-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "exec_id": "c75e81815181bb22558306fffcaa7d049f4a79378ea70802ee6c4334d0597860", 3 | "url": "ws://0.0.0.0:6784/?token=062411f1-7995-413b-988f-ba8f6c553c6c&uuid=b7074d3a-14e4-4d5a-95cc-579fef16e033" 4 | } 5 | -------------------------------------------------------------------------------- /api-ref/source/samples/container-execute-resp-2.json: -------------------------------------------------------------------------------- 1 | { 2 | "output": null, 3 | "exit_code": null, 4 | "url": "tcp://172.16.1.45:2375", 5 | "exec_id": "3c851c568fc9f21bdb77b7ba98eb1c6ae0c901f56dfb1471de4d6af7c73dbf4d" 6 | } 7 | -------------------------------------------------------------------------------- /api-ref/source/samples/container-execute-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "output": "Mon Oct 9 09:09:32 UTC 2017\n", 3 | "exit_code": 0, 4 | "exec_id": null, 5 | "url": null 6 | } 7 | -------------------------------------------------------------------------------- /api-ref/source/samples/container-get-archive-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "stat": { 3 | "linkTarget": "", 4 | "size": 129, 5 | "mode": 493, 6 | "name": "ip.sh", 7 | "mtime": "2017-07-25T18:54:50-07:00" 8 | }, 9 | "data": "ARCHIVE FILE DATA" 10 | } 11 | -------------------------------------------------------------------------------- /api-ref/source/samples/container-logs-req.json: -------------------------------------------------------------------------------- 1 | { 2 | "timestamps": "True", 3 | "tail": "all", 4 | "since": "600000", 5 | "stderr": "True", 6 | "stdout": "True" 7 | } 8 | -------------------------------------------------------------------------------- /api-ref/source/samples/container-network-list-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "networks": [ 3 | { 4 | "port_id": "5be06e49-70dc-4984-94a2-1b946bb136fb", 5 | "net_id": "7e6b5e1b-9b44-4f55-b4e3-16a1ead98161", 6 | "fixed_ips": { 7 | "ip_address": "30.30.30.10", 8 | "version": 4, 9 | "subnet_id": "ae8d7cce-859e-432f-8a33-d7d8834ccd14" 10 | } 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /api-ref/source/samples/container-put-archive-req.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": "ARCHIVE FILE DATA" 3 | } 4 | -------------------------------------------------------------------------------- /api-ref/source/samples/container-stats-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "CONTAINER": "test", 3 | "CPU %": 8.89, 4 | "MEM USAGE(MiB)": 7, 5 | "MEM LIMIT(MiB)": 16048, 6 | "MEM %": 0.0436191425723, 7 | "BLOCK I/O(B)": "12910592/0", 8 | "NET I/O(B)": "246614/648" 9 | } 10 | -------------------------------------------------------------------------------- /api-ref/source/samples/container-top-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "Processes": [ 3 | ["root", "28363", "28344", "0", "Sep28", "pts/0", "00:00:00", "nginx: master process nginx -g daemon off;"], 4 | ["systemd+", "28436", "28363", "0", "Sep28", "pts/0", "00:00:00", "nginx: worker process"] 5 | ], 6 | "Titles": [ 7 | "UID", 8 | "PID", 9 | "PPID", 10 | "C", 11 | "STIME", 12 | "TTY", 13 | "TIME", 14 | "CMD" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /api-ref/source/samples/container-update-req.json: -------------------------------------------------------------------------------- 1 | { 2 | "memory": "200", 3 | "cpu": "3", 4 | "name": "test_new" 5 | } 6 | -------------------------------------------------------------------------------- /api-ref/source/samples/host-get-all-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "hosts": [ 3 | { 4 | "hostname": "testhost", 5 | "uuid": "d0405f06-101e-4340-8735-d1bf9fa8b8ad", 6 | "links": [{ 7 | "href": "http://192.168.2.200:9517/v1/hosts/d0405f06-101e-4340-8735-d1bf9fa8b8ad", 8 | "rel": "self" 9 | }, 10 | {"href": "http://192.168.2.200:9517/hosts/d0405f06-101e-4340-8735-d1bf9fa8b8ad", 11 | "rel": "bookmark" 12 | } 13 | ], 14 | "kernel_version": "4.4.0-109-generic", 15 | "labels": { 16 | "type": "test" 17 | }, 18 | "cpus": 48, 19 | "mem_used": 512, 20 | "disk_total": 16, 21 | "mem_total": 128446, 22 | "total_containers": 2, 23 | "cpu_used": 0.2, 24 | "disk_used": 10, 25 | "os_type": "linux", 26 | "architecture": "x86_64" 27 | "os": "CentOS Linux 7 (Core)" 28 | } 29 | ], 30 | "next": null 31 | } 32 | -------------------------------------------------------------------------------- /api-ref/source/samples/host-get-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "hostname": "test", 3 | "uuid": "d0405f06-101e-4340-8735-d1bf9fa8b8ad", 4 | "links": [{ 5 | "href": "http://192.168.2.22:9517/v1/hosts/d0405f06-101e-4340-8735-d1bf9fa8b8ad", 6 | "rel": "self" 7 | }, 8 | {"href": "http://192.168.2.22:9517/hosts/d0405f06-101e-4340-8735-d1bf9fa8b8ad", 9 | "rel": "bookmark"} 10 | ], 11 | "kernel_version": "3.10.0-123.el7.x86_64", 12 | "labels": {"type": "test"}, 13 | "cpus": 48, 14 | "mem_used": 512, 15 | "disk_total": 16, 16 | "mem_total": 128446, 17 | "total_containers": 2, 18 | "cpu_used": 0.2, 19 | "disk_used": 10, 20 | "os_type": "linux", 21 | "architecture": "x86_64" 22 | "os": "CentOS Linux 7 (Core)" 23 | } 24 | -------------------------------------------------------------------------------- /api-ref/source/samples/quota-classes-get-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "disk": 100, 3 | "cpu": 20, 4 | "containers": 40, 5 | "memory": 51200 6 | } 7 | -------------------------------------------------------------------------------- /api-ref/source/samples/quota-classes-update-req.json: -------------------------------------------------------------------------------- 1 | { 2 | "disk": 200, 3 | "cpu": 30, 4 | "containers": 50, 5 | "memory": 102400 6 | } 7 | -------------------------------------------------------------------------------- /api-ref/source/samples/quota-classes-update-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "disk": 200, 3 | "cpu": 30, 4 | "containers": 50, 5 | "memory": 102400 6 | } 7 | -------------------------------------------------------------------------------- /api-ref/source/samples/quotas-get-defaults-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "disk": 100, 3 | "cpu": 20, 4 | "containers": 40, 5 | "memory": 51200 6 | } 7 | -------------------------------------------------------------------------------- /api-ref/source/samples/quotas-get-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "disk": { 3 | "limit": 100, 4 | "in_use": 0 5 | }, 6 | "cpu": { 7 | "limit": 20, 8 | "in_use": 4 9 | }, 10 | "containers": { 11 | "limit": 40, 12 | "in_use": 5 13 | }, 14 | "memory": { 15 | "limit": 51200, 16 | "in_use": 2048 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /api-ref/source/samples/quotas-update-req.json: -------------------------------------------------------------------------------- 1 | { 2 | "disk": 200, 3 | "cpu": 30, 4 | "containers": 80, 5 | "memory": 102400 6 | } 7 | -------------------------------------------------------------------------------- /api-ref/source/samples/quotas-update-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "disk": 200, 3 | "cpu": 30, 4 | "containers": 80, 5 | "memory": 102400 6 | } 7 | -------------------------------------------------------------------------------- /api-ref/source/samples/service-disable-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "service": { 3 | "disabled": true, 4 | "binary": "zun-compute", 5 | "host": "host1", 6 | "disabled_reason": "abc" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /api-ref/source/samples/service-enable-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "service":{ 3 | "disabled": false, 4 | "binary": "zun-compute", 5 | "host": "tecs", 6 | "disabled_reason": null 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /api-ref/source/samples/service-forcedown-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "service": { 3 | "binary": "zun-compute", 4 | "host": "tecs", 5 | "forced_down": true 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /api-ref/source/samples/service-get-resp.json: -------------------------------------------------------------------------------- 1 | { 2 | "services":[ 3 | { 4 | "binary": "zun-compute", 5 | "availability_zone": "nova", 6 | "state": "up", 7 | "created_at": "2017-02-01T03:25:07.000000", 8 | "updated_at": "2017-02-01T06:13:07.000000", 9 | "report_count": 166, 10 | "disabled": false, 11 | "host": "instance-1", 12 | "forced_down": false, 13 | "last_seen_up": "2017-02-01T06:13:07.000000", 14 | "disabled_reason": null, 15 | "id": 1 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /api-ref/source/urls.inc: -------------------------------------------------------------------------------- 1 | .. -*- rst -*- 2 | 3 | ================= 4 | Zun Base URLs 5 | ================= 6 | 7 | All API calls through the rest of this document require authentication 8 | with the OpenStack Identity service. They also required a ``url`` that 9 | is extracted from the Identity token of type 10 | ``container``. This will be the root url that every call below will be 11 | added to build a full path. 12 | 13 | Note that if using OpenStack Identity service API v2, ``url`` can be 14 | represented via ``adminURL``, ``internalURL`` or ``publicURL`` in endpoint 15 | catalog. In Identity service API v3, ``url`` is represented with field 16 | ``interface`` including ``admin``, ``internal`` and ``public``. 17 | 18 | For instance, if the ``url`` is 19 | ``http://my-zun-url.org/zun/v1`` then the full API call for 20 | ``/containers`` is ``http://my-zun-url.org/zun/v1/containers``. 21 | 22 | Depending on the deployment the containers service 23 | url might be http or https, a custom port, a custom path, and include your 24 | project id. The only way to know the urls for your deployment is by using the 25 | service catalog. The containers service URL should never be 26 | hard coded in applications, even if they are only expected to work at a 27 | single site. It should always be discovered from the Identity token. 28 | 29 | As such, for the rest of this document we will be using short hand 30 | where ``GET /containers`` really means 31 | ``GET {your_zun_url}/containers``. 32 | -------------------------------------------------------------------------------- /contrib/legacy-ubuntu-init/README.rst: -------------------------------------------------------------------------------- 1 | =================================== 2 | Legacy Init Script for Ubuntu 14.04 3 | =================================== 4 | 5 | #. Clone the Zun repository: 6 | 7 | .. code-block:: console 8 | 9 | $ git clone https://opendev.org/openstack/zun.git 10 | 11 | #. Enable and start zun-api: 12 | 13 | .. code-block:: console 14 | 15 | # cp zun/contrib/legacy-ubuntu-init/etc/init/zun-api.conf \ 16 | /etc/init/zun-api.conf 17 | # start zun-api 18 | 19 | #. Enable and start zun-wsproxy: 20 | 21 | .. code-block:: console 22 | 23 | # cp zun/contrib/legacy-ubuntu-init/etc/init/zun-wsproxy.conf \ 24 | /etc/init/zun-wsproxy.conf 25 | # start zun-wsproxy 26 | 27 | #. Enable and start zun-compute: 28 | 29 | .. code-block:: console 30 | 31 | # cp zun/contrib/legacy-ubuntu-init/etc/init/zun-compute.conf \ 32 | /etc/init/zun-compute.conf 33 | # start zun-compute 34 | 35 | #. Verify that zun services are running: 36 | 37 | .. code-block:: console 38 | 39 | # status zun-api 40 | # status zun-wsproxy 41 | # status zun-compute 42 | -------------------------------------------------------------------------------- /contrib/legacy-ubuntu-init/etc/init/zun-api.conf: -------------------------------------------------------------------------------- 1 | description "OpenStack Container Service API" 2 | 3 | start on runlevel [2345] 4 | stop on runlevel [!2345] 5 | 6 | respawn 7 | 8 | exec start-stop-daemon --start --chuid zun \ 9 | --chdir /var/lib/zun \ 10 | --name zun-api \ 11 | --exec /usr/local/bin/zun-api -- \ 12 | --config-file=/etc/zun/zun.conf 13 | -------------------------------------------------------------------------------- /contrib/legacy-ubuntu-init/etc/init/zun-compute.conf: -------------------------------------------------------------------------------- 1 | description "OpenStack Container Service Compute Agent" 2 | 3 | start on runlevel [2345] 4 | stop on runlevel [!2345] 5 | 6 | respawn 7 | 8 | exec start-stop-daemon --start --chuid zun \ 9 | --chdir /var/lib/zun \ 10 | --name zun-compute \ 11 | --exec /usr/local/bin/zun-compute -- \ 12 | --config-file=/etc/zun/zun.conf 13 | -------------------------------------------------------------------------------- /contrib/legacy-ubuntu-init/etc/init/zun-wsproxy.conf: -------------------------------------------------------------------------------- 1 | description "OpenStack Container Service Websocket Proxy" 2 | 3 | start on runlevel [2345] 4 | stop on runlevel [!2345] 5 | 6 | respawn 7 | 8 | exec start-stop-daemon --start --chuid zun \ 9 | --chdir /var/lib/zun \ 10 | --name zun-wsproxy \ 11 | --exec /usr/local/bin/zun-wsproxy -- \ 12 | --config-file=/etc/zun/zun.conf 13 | -------------------------------------------------------------------------------- /contrib/nova-docker/etc/nova/rootwrap.d/docker.filters: -------------------------------------------------------------------------------- 1 | # nova-rootwrap command filters for setting up network in the docker driver 2 | # This file should be owned by (and only-writeable by) the root user 3 | 4 | [Filters] 5 | # nova/virt/docker/driver.py: 'ln', '-sf', '/var/run/netns/.*' 6 | ln: CommandFilter, /bin/ln, root 7 | -------------------------------------------------------------------------------- /contrib/nova-docker/nova/__init__.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | # Required to play nicely with namespace composition (PEP420). 14 | __import__('pkg_resources').declare_namespace(__name__) 15 | -------------------------------------------------------------------------------- /contrib/nova-docker/nova/virt/__init__.py: -------------------------------------------------------------------------------- 1 | # All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | # Allow composition of nova.virt namespace from disparate packages. 16 | __import__('pkg_resources').declare_namespace(__name__) 17 | -------------------------------------------------------------------------------- /contrib/nova-docker/nova/virt/hostutils.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 Docker, Inc. 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | from nova import utils 17 | 18 | 19 | def sys_uptime(): 20 | """Returns the host uptime.""" 21 | out, err = utils.execute('env', 'LANG=C', 'uptime') 22 | return out 23 | -------------------------------------------------------------------------------- /contrib/nova-docker/nova/virt/zun/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 dotCloud, Inc. 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | """ 17 | :mod:`docker` -- Nova support for Docker Hypervisor to run Linux containers 18 | =========================================================================== 19 | """ 20 | from nova.virt.zun import driver 21 | 22 | DockerDriver = driver.DockerDriver 23 | -------------------------------------------------------------------------------- /contrib/quick-start/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.7 2 | WORKDIR /opt 3 | 4 | RUN apk update \ 5 | && apk add --no-cache\ 6 | bash \ 7 | iproute2 \ 8 | openvswitch \ 9 | py-pip \ 10 | python \ 11 | uwsgi-python \ 12 | libffi-dev \ 13 | openssl-dev \ 14 | && apk add --no-cache --virtual build-deps \ 15 | gcc \ 16 | git \ 17 | linux-headers \ 18 | musl-dev \ 19 | python-dev \ 20 | && pip install -U pip setuptools \ 21 | \ 22 | && git clone https://github.com/openstack/zun \ 23 | && cd /opt/zun \ 24 | && pip install -r ./requirements.txt \ 25 | && python setup.py install \ 26 | && cd / \ 27 | && apk del build-deps 28 | 29 | VOLUME /var/log/zun 30 | VOLUME /etc/zun 31 | -------------------------------------------------------------------------------- /contrib/quick-start/README.md: -------------------------------------------------------------------------------- 1 | Budil-Zun-Service-Dcoker Image 2 | ======================= 3 | 4 | By using this dockerfile, you can build your own Zun service docker container eaily and quickly. 5 | 6 | Build docker container image 7 | for example, we build a docker container image named `zun-service-img`. 8 | ```docker build -t zun-service-img .``` 9 | 10 | Run zun service container 11 | Start a container by unsing our build image above. 12 | ```docker run --name zun-service \ 13 | --net=host \ 14 | -v /var/run:/var/run \ 15 | zun-service-img``` 16 | 17 | 18 | Note: You should enter the container and config the zun config file in the path /etc/zun/, 19 | More info about the config please reference the installation docs. 20 | -------------------------------------------------------------------------------- /contrib/vagrant/README.md: -------------------------------------------------------------------------------- 1 | vagrant-devstack-zun 2 | ======================= 3 | 4 | A Vagrant-based devstack setup for zun. 5 | Steps to try vagrant image: 6 | 1. Install virtual-box and vagrant on your local machine. 7 | 2. Git clone zun repository. 8 | 3. cd zun/contrib/vagrant 9 | 4. vagrant up 10 | It will take around 20 mins. 11 | 5. vagrant ssh 12 | You will get vm shell with all necessary setup. 13 | 14 | Note: For enabling/disabling various services, please see below file: 15 | zun/contrib/vagrant/config/localrc 16 | -------------------------------------------------------------------------------- /contrib/vagrant/Vagrantfile: -------------------------------------------------------------------------------- 1 | VAGRANTFILE_API_VERSION = "2" 2 | 3 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 4 | 5 | #https://atlas.hashicorp.com/bento/boxes/ubuntu-16.04 6 | config.vm.box = "bento/ubuntu-16.04" 7 | 8 | #below box has an issue, https://bugs.launchpad.net/cloud-images/+bug/1569237 9 | #config.vm.box_url = "https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-vagrant.box" 10 | 11 | config.vm.hostname = "devstack" 12 | 13 | config.vm.provider "virtualbox" do |vb| 14 | vb.customize ["modifyvm", :id, "--memory", "4096"] 15 | end 16 | 17 | config.vm.provision :shell, :path => "provision.sh" 18 | 19 | if Vagrant.has_plugin?("vagrant-cachier") 20 | config.cache.scope = :box 21 | end 22 | 23 | end 24 | -------------------------------------------------------------------------------- /contrib/vagrant/config/localrc: -------------------------------------------------------------------------------- 1 | HOST_IP=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/') 2 | DATABASE_PASSWORD=password 3 | RABBIT_PASSWORD=password 4 | SERVICE_TOKEN=password 5 | SERVICE_PASSWORD=password 6 | ADMIN_PASSWORD=password 7 | enable_plugin devstack-plugin-container https://opendev.org/openstack/devstack-plugin-container $TARGET_BRANCH 8 | enable_plugin zun https://opendev.org/openstack/zun $TARGET_BRANCH 9 | enable_plugin kuryr-libnetwork https://opendev.org/openstack/kuryr-libnetwork $TARGET_BRANCH 10 | 11 | #Optional: uncomment to enable the Zun UI plugin in Horizon 12 | #enable_plugin zun-ui https://opendev.org/openstack/zun-ui $TARGET_BRANCH 13 | 14 | #Uncomment below variables and enable nova and neutron 15 | #services to use nova docker driver 16 | #IP_VERSION=4 17 | disable_service n-api,n-cpu,n-cond,n-sch,n-novnc,n-cauth 18 | 19 | #comment out below line to use Horizon Dashboard 20 | disable_service horizon 21 | 22 | #comment out below line to use Cinder 23 | disable_service c-sch,c-api,c-vol 24 | 25 | #comment out below line to use tempest 26 | disable_service tempest 27 | -------------------------------------------------------------------------------- /contrib/vagrant/install_devstack.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export OS_USER=vagrant 4 | 5 | BASHPATH=$(dirname "$0"\") 6 | echo "run script from $BASHPATH" 7 | 8 | # update system 9 | export DEBIAN_FRONTEND noninteractive 10 | sudo apt-get update 11 | sudo apt-get install -qqy git 12 | 13 | # determine checkout folder 14 | PWD=$(su "$OS_USER" -c "cd && pwd") 15 | DEVSTACK=$PWD/devstack 16 | 17 | # check if devstack is already there 18 | if [ ! -d "$DEVSTACK" ] 19 | then 20 | echo "Download devstack into $DEVSTACK" 21 | 22 | # clone devstack 23 | su "$OS_USER" -c "cd && git clone -b master https://opendev.org/openstack/devstack.git $DEVSTACK" 24 | 25 | echo "Copy configuration" 26 | 27 | # copy localrc settings (source: devstack/samples/localrc) 28 | echo "copy config from $BASHPATH/config/localrc to $DEVSTACK/localrc" 29 | cp "$BASHPATH"/config/localrc "$DEVSTACK"/localrc 30 | chown "$OS_USER":"$OS_USER" "$DEVSTACK"/localrc 31 | 32 | fi 33 | 34 | 35 | # start devstack 36 | echo "Start Devstack" 37 | su "$OS_USER" -c "cd $DEVSTACK && ./stack.sh" 38 | -------------------------------------------------------------------------------- /contrib/vagrant/provision.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | # run script 5 | sh /vagrant/install_devstack.sh 6 | -------------------------------------------------------------------------------- /devstack/README.rst: -------------------------------------------------------------------------------- 1 | ==================== 2 | DevStack Integration 3 | ==================== 4 | 5 | This directory contains the files necessary to integrate zun with devstack. 6 | 7 | Refer the quickstart guide at 8 | https://docs.openstack.org/zun/latest/contributor/quickstart.html 9 | for more information on using devstack and zun. 10 | -------------------------------------------------------------------------------- /devstack/files/debs/zun: -------------------------------------------------------------------------------- 1 | numactl 2 | gawk 3 | pciutils 4 | apparmor 5 | apparmor-utils 6 | -------------------------------------------------------------------------------- /devstack/files/rpms/zun: -------------------------------------------------------------------------------- 1 | numactl 2 | gawk 3 | pciutils 4 | -------------------------------------------------------------------------------- /devstack/local.conf.sample: -------------------------------------------------------------------------------- 1 | [[local|localrc]] 2 | HOST_IP=10.0.0.11 # change this to your IP address 3 | DATABASE_PASSWORD=password 4 | RABBIT_PASSWORD=password 5 | SERVICE_TOKEN=password 6 | SERVICE_PASSWORD=password 7 | ADMIN_PASSWORD=password 8 | enable_plugin zun https://opendev.org/openstack/zun $TARGET_BRANCH 9 | enable_plugin zun-tempest-plugin https://opendev.org/openstack/zun-tempest-plugin 10 | 11 | # This below plugin enables installation of container engine on Devstack. 12 | # The default container engine is Docker 13 | enable_plugin devstack-plugin-container https://opendev.org/openstack/devstack-plugin-container $TARGET_BRANCH 14 | # This enables CRI plugin for containerd 15 | ENABLE_CONTAINERD_CRI=True 16 | 17 | # Optional: uncomment to enable Kata Container 18 | # ENABLE_KATA_CONTAINERS=True 19 | 20 | KURYR_PROCESS_EXTERNAL_CONNECTIVITY=False 21 | enable_plugin kuryr-libnetwork https://opendev.org/openstack/kuryr-libnetwork $TARGET_BRANCH 22 | 23 | # install python-zunclient from git 24 | LIBS_FROM_GIT="python-zunclient" 25 | 26 | # Optional: uncomment to enable the Zun UI plugin in Horizon 27 | # enable_plugin zun-ui https://opendev.org/openstack/zun-ui $TARGET_BRANCH 28 | 29 | # Optional: uncomment to enable the Heat plugin for container orchestration 30 | # enable_plugin heat https://opendev.org/openstack/heat $TARGET_BRANCH 31 | -------------------------------------------------------------------------------- /devstack/local.conf.subnode.sample: -------------------------------------------------------------------------------- 1 | [[local|localrc]] 2 | HOST_IP=10.0.0.31 # change this to your IP address 3 | DATABASE_PASSWORD=password 4 | RABBIT_PASSWORD=password 5 | SERVICE_TOKEN=password 6 | SERVICE_PASSWORD=password 7 | ADMIN_PASSWORD=password 8 | 9 | ENABLE_CONTAINERD_CRI=True 10 | enable_plugin devstack-plugin-container https://opendev.org/openstack/devstack-plugin-container $TARGET_BRANCH 11 | enable_plugin zun https://opendev.org/openstack/zun $TARGET_BRANCH 12 | 13 | # Optional: uncomment to enable Kata Container 14 | # ENABLE_KATA_CONTAINERS=True 15 | 16 | KURYR_PROCESS_EXTERNAL_CONNECTIVITY=False 17 | enable_plugin kuryr-libnetwork https://opendev.org/openstack/kuryr-libnetwork $TARGET_BRANCH 18 | 19 | # Following is for multi host settings 20 | MULTI_HOST=True 21 | SERVICE_HOST=10.0.0.11 # change this to controller's IP address 22 | DATABASE_TYPE=mysql 23 | MYSQL_HOST=$SERVICE_HOST 24 | RABBIT_HOST=$SERVICE_HOST 25 | 26 | ENABLED_SERVICES=zun-compute,kuryr-libnetwork,q-agt 27 | -------------------------------------------------------------------------------- /devstack/plugin.sh: -------------------------------------------------------------------------------- 1 | # zun - Devstack extras script to install zun 2 | 3 | # Save trace setting 4 | XTRACE=$(set +o | grep xtrace) 5 | set -o xtrace 6 | 7 | echo_summary "zun's plugin.sh was called..." 8 | source $DEST/zun/devstack/lib/zun 9 | (set -o posix; set) 10 | 11 | if is_service_enabled zun-api zun-compute; then 12 | if [[ "$1" == "stack" && "$2" == "install" ]]; then 13 | echo_summary "Installing zun" 14 | install_zun 15 | 16 | install_zunclient 17 | cleanup_zun 18 | 19 | elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then 20 | echo_summary "Configuring zun" 21 | configure_zun 22 | 23 | if is_service_enabled key; then 24 | create_zun_accounts 25 | fi 26 | 27 | elif [[ "$1" == "stack" && "$2" == "extra" ]]; then 28 | # Initialize zun 29 | init_zun 30 | 31 | # Start the zun API and zun compute 32 | echo_summary "Starting zun" 33 | start_zun 34 | upload_images 35 | 36 | fi 37 | 38 | if [[ "$1" == "unstack" ]]; then 39 | stop_zun 40 | fi 41 | 42 | if [[ "$1" == "clean" ]]; then 43 | cleanup_zun 44 | fi 45 | fi 46 | 47 | # Restore xtrace 48 | $XTRACE 49 | -------------------------------------------------------------------------------- /devstack/settings: -------------------------------------------------------------------------------- 1 | # Devstack settings 2 | 3 | ## Modify to your environment 4 | # FLOATING_RANGE=192.168.1.224/27 5 | # PUBLIC_NETWORK_GATEWAY=192.168.1.225 6 | # PUBLIC_INTERFACE=em1 7 | # FIXED_RANGE=10.0.0.0/24 8 | ## Log all output to files 9 | # LOGFILE=$HOME/devstack.log 10 | ## Neutron settings 11 | # Q_USE_SECGROUP=True 12 | # ENABLE_TENANT_VLANS=True 13 | # TENANT_VLAN_RANGE= 14 | # PHYSICAL_NETWORK=public 15 | # OVS_PHYSICAL_BRIDGE=br-ex 16 | 17 | # Enable/Disable Kata Container 18 | ENABLE_KATA_CONTAINERS=${ENABLE_KATA_CONTAINERS:-false} 19 | 20 | # Configure CNI plugins 21 | CNI_PLUGINS_INSTALL_PLUGINS=loopback,zun-cni 22 | CNI_PLUGINS_CONF_SOURCE_DIR=$DEST/zun/etc/cni/net.d 23 | 24 | # Enable Zun services 25 | if [[ ${HOST_IP} == ${SERVICE_HOST} ]] || [[ "[${HOST_IPV6}]" == "${SERVICE_HOST}" ]]; then 26 | enable_service zun-api 27 | enable_service zun-compute 28 | enable_service zun-wsproxy 29 | enable_service zun-cni-daemon 30 | else 31 | enable_service zun-compute 32 | enable_service zun-cni-daemon 33 | fi 34 | -------------------------------------------------------------------------------- /doc/requirements.txt: -------------------------------------------------------------------------------- 1 | # The order of packages is significant, because pip processes them in the order 2 | # of appearance. Changing the order has an impact on the overall integration 3 | # process, which may cause wedges in the gate later. 4 | # this is required for the docs build jobs 5 | sphinx>=2.0.0,!=2.1.0 # BSD 6 | sphinxcontrib-apidoc>=0.2.0 # BSD 7 | openstackdocstheme>=2.2.1 # Apache-2.0 8 | reno>=3.1.0 # Apache-2.0 9 | os-api-ref>=1.0.0 # Apache-2.0 10 | -------------------------------------------------------------------------------- /doc/source/admin/README.rst: -------------------------------------------------------------------------------- 1 | =============================================== 2 | Zun Administration Documentation (source/admin) 3 | =============================================== 4 | 5 | 6 | This directory is intended to hold any documentation that is related 7 | to how to run or operate Zun. 8 | -------------------------------------------------------------------------------- /doc/source/admin/clear-containers.rst: -------------------------------------------------------------------------------- 1 | ======================= 2 | Clear Containers in Zun 3 | ======================= 4 | 5 | Zun now supports running Clear Containers with regular Docker containers. 6 | Clear containers run containers as very lightweight virtual machines 7 | which boot up really fast and has low memory footprints. It provides 8 | security to the containers with an isolated environment. You can read 9 | more about Clear Containers `here `_. 10 | 11 | Installation with DevStack 12 | ========================== 13 | It is possible to run Clear Containers with Zun. Follow the 14 | :doc:`/contributor/quickstart` to download DevStack, Zun code and copy the 15 | local.conf file. Now perform the following steps to install Clear Containers 16 | with DevStack:: 17 | 18 | cd /opt/stack/devstack 19 | echo "ENABLE_CLEAR_CONTAINER=true" >> local.conf 20 | ./stack.sh 21 | 22 | Verify the installation by:: 23 | 24 | $ sudo docker info | grep Runtimes 25 | Runtimes: cor runc 26 | 27 | Using Clear Containers with Zun 28 | =============================== 29 | To create Clear Containers with Zun, specify the `--runtime` option:: 30 | 31 | zun run --name clear-container --runtime cor cirros ping -c 4 8.8.8.8 32 | 33 | .. note:: 34 | 35 | Clear Containers support in Zun is not production ready. It is recommended 36 | not to running Clear Containers and runc containers on the same host. 37 | -------------------------------------------------------------------------------- /doc/source/admin/index.rst: -------------------------------------------------------------------------------- 1 | Administrator's Guide 2 | ===================== 3 | 4 | Installation & Operations 5 | ------------------------- 6 | 7 | If you are a system administrator running Zun, this section contains 8 | information that should help you understand how to deploy, operate, and upgrade 9 | the services. 10 | 11 | .. toctree:: 12 | :maxdepth: 1 13 | 14 | osprofiler 15 | clear-containers 16 | keep-containers-alive 17 | security-groups 18 | private_registry 19 | -------------------------------------------------------------------------------- /doc/source/admin/keep-containers-alive.rst: -------------------------------------------------------------------------------- 1 | ======================= 2 | Keep Containers Alive 3 | ======================= 4 | As we know, the Docker daemon shuts down all running containers 5 | during daemon downtime. Starting with Docker Engine 1.12, users can 6 | configure the daemon so that containers remain running when the 7 | docker service becomes unavailable. This functionality is called 8 | live restore. You can read more about Live Restore 9 | `here `_. 10 | 11 | Installation with DevStack 12 | ========================== 13 | It is possible to keep containers alive. Follow the 14 | :doc:`/contributor/quickstart` to download DevStack, Zun code and copy the 15 | local.conf file. Now perform the following steps to install Zun with DevStack:: 16 | 17 | cd /opt/stack/devstack 18 | echo "ENABLE_LIVE_RESTORE=true" >> local.conf 19 | ./stack.sh 20 | 21 | Verify the installation by:: 22 | 23 | $ sudo docker info | grep "Live Restore" 24 | Live Restore Enabled: true 25 | -------------------------------------------------------------------------------- /doc/source/cli/README.rst: -------------------------------------------------------------------------------- 1 | ================================== 2 | Zun CLI Documentation (source/cli) 3 | ================================== 4 | 5 | 6 | This directory is intended to hold any documentation that relates to 7 | Zun's Command Line Interface. Note that this directory is intended for 8 | basic descriptions of the commands supported, similar to what you would 9 | find with a 'man page'. Tutorials or step-by-step guides should go into 10 | 'doc/source/admin' or 'doc/source/user' depending on the target audience. 11 | -------------------------------------------------------------------------------- /doc/source/cli/index.rst: -------------------------------------------------------------------------------- 1 | ====================== 2 | Zun Command Line Guide 3 | ====================== 4 | 5 | In this section you will find information on Zun’s command line 6 | interface. 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | zun-status 12 | 13 | 14 | .. note:: 15 | Other command line guide for Zun to be added. The work will be 16 | tracked here: https://blueprints.launchpad.net/zun/+spec/zun-cli-guide 17 | -------------------------------------------------------------------------------- /doc/source/configuration/README.rst: -------------------------------------------------------------------------------- 1 | ====================================================== 2 | Zun Configuration Documentation (source/configuration) 3 | ====================================================== 4 | 5 | 6 | This directory is intended to hold any documentation that relates 7 | to how to configure Zun. It is intended that some of this content 8 | be automatically generated in the future. At the moment, however, 9 | it is not. Changes to configuration options for Zun or its drivers 10 | needs to be put under this directory. 11 | -------------------------------------------------------------------------------- /doc/source/configuration/index.rst: -------------------------------------------------------------------------------- 1 | Sample Configuration File 2 | ------------------------- 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | sample-config 8 | policy 9 | -------------------------------------------------------------------------------- /doc/source/configuration/policy.rst: -------------------------------------------------------------------------------- 1 | ==================== 2 | Policy configuration 3 | ==================== 4 | 5 | Configuration 6 | ~~~~~~~~~~~~~ 7 | 8 | .. warning:: 9 | 10 | JSON formatted policy file is deprecated since Zun 7.0.0 (Wallaby). 11 | This `oslopolicy-convert-json-to-yaml`__ tool will migrate your existing 12 | JSON-formatted policy file to YAML in a backward-compatible way. 13 | 14 | .. __: https://docs.openstack.org/oslo.policy/latest/cli/oslopolicy-convert-json-to-yaml.html 15 | 16 | The following is an overview of all available policies in Zun. For a sample 17 | configuration file. 18 | 19 | .. show-policy:: 20 | :config-file: ../../etc/zun/zun-policy-generator.conf 21 | -------------------------------------------------------------------------------- /doc/source/configuration/sample-config.rst: -------------------------------------------------------------------------------- 1 | ========================= 2 | Zun Configuration Options 3 | ========================= 4 | 5 | The following is a sample Zun configuration for adaptation and use. It is 6 | auto-generated from Zun when this documentation is built, so 7 | if you are having issues with an option, please compare your version of 8 | Zun with the version of this documentation. 9 | 10 | .. only:: html 11 | 12 | The sample configuration can also be viewed in :download:`file form 13 | `. 14 | 15 | .. literalinclude:: /_static/zun.conf.sample 16 | -------------------------------------------------------------------------------- /doc/source/contributor/README.rst: -------------------------------------------------------------------------------- 1 | ================================================== 2 | Zun Contributor Documentation (source/contributor) 3 | ================================================== 4 | 5 | 6 | This directory is intended to hold any documentation that relates to 7 | how to contribute to Zun or how the project is managed. Some of this 8 | content was previous under 'developer' in openstack-manuals. The content 9 | of the documentation, however, goes beyond just developers to anyone 10 | contributing to the project, thus the change in naming. 11 | -------------------------------------------------------------------------------- /doc/source/contributor/gerrit.rst: -------------------------------------------------------------------------------- 1 | Code Reviews with Gerrit 2 | ======================== 3 | 4 | Zun uses the `Gerrit`_ tool to review proposed code changes. The review site 5 | is https://review.opendev.org. 6 | 7 | Gerrit is a complete replacement for Github pull requests. `All Github pull 8 | requests to the Zun repository will be ignored`. 9 | 10 | See `Gerrit Workflow Quick Reference`_ for information about how to get 11 | started using Gerrit. See `Development Workflow`_ for more detailed 12 | documentation on how to work with Gerrit. 13 | 14 | .. _Gerrit: https://bugs.chromium.org/p/gerrit/ 15 | .. _Development Workflow: https://docs.openstack.org/infra/manual/developers.html#development-workflow 16 | .. _Gerrit Workflow Quick Reference: https://docs.openstack.org/infra/manual/developers.html#development-workflow 17 | -------------------------------------------------------------------------------- /doc/source/contributor/jenkins.rst: -------------------------------------------------------------------------------- 1 | Continuous Integration with Jenkins 2 | =================================== 3 | 4 | Zun uses a `Jenkins `_ server to automate development 5 | tasks. 6 | 7 | Jenkins performs tasks such as: 8 | 9 | `gate-zun-pep8-ubuntu-xenial` 10 | Run PEP8 checks on proposed code changes that have been reviewed. 11 | 12 | `gate-zun-python27-ubuntu-xenial` 13 | Run unit tests using python2.7 on proposed code changes that have been 14 | reviewed. 15 | 16 | `gate-zun-python35` 17 | Run unit tests using python3.5 on proposed code changes that have been 18 | reviewed. 19 | 20 | `gate-zun-docs-ubuntu-xenial` 21 | Build this documentation and push it to `OpenStack Zun 22 | `_. 23 | -------------------------------------------------------------------------------- /doc/source/contributor/releasenotes.rst: -------------------------------------------------------------------------------- 1 | Release notes 2 | ============= 3 | 4 | The release notes for a patch should be included in the patch. 5 | 6 | If the following applies to the patch, a release note is required: 7 | 8 | * Upgrades 9 | 10 | * The deployer needs to take an action when upgrading 11 | * A new config option is added that the deployer should consider changing 12 | from the default 13 | * A configuration option is deprecated or removed 14 | 15 | * Features 16 | 17 | * A new feature or driver is implemented 18 | * Feature is deprecated or removed 19 | * Current behavior is changed 20 | 21 | * Bugs 22 | 23 | * A security bug is fixed 24 | * A long-standing or important bug is fixed 25 | 26 | * APIs 27 | 28 | * REST API changes 29 | 30 | Zun uses `reno `_ to 31 | generate release notes. Please read the docs for details. In summary, use 32 | 33 | .. code-block:: bash 34 | 35 | $ tox -e venv -- reno new 36 | 37 | Then edit the sample file that was created and push it with your change. 38 | 39 | To see the results: 40 | 41 | .. code-block:: bash 42 | 43 | $ git commit # Commit the change because reno scans git log. 44 | 45 | $ tox -e releasenotes 46 | 47 | Then look at the generated release notes files in releasenotes/build/html in 48 | your favorite browser. 49 | -------------------------------------------------------------------------------- /doc/source/install/README.rst: -------------------------------------------------------------------------------- 1 | =============================================== 2 | Zun Installation Documentation (source/install) 3 | =============================================== 4 | 5 | Introduction: 6 | ------------- 7 | 8 | This directory is intended to hold any installation documentation for Zun. 9 | Documentation that explains how to bring Zun up to the point that it is 10 | ready to use in an OpenStack or standalone environment should be put 11 | in this directory. 12 | 13 | The full spec for organization of documentation may be seen in the 14 | `OS Manuals Migration Spec 15 | `. 16 | -------------------------------------------------------------------------------- /doc/source/install/get_started.rst: -------------------------------------------------------------------------------- 1 | ========================== 2 | Container service overview 3 | ========================== 4 | 5 | The Container service consists of the following components: 6 | 7 | ``zun-api`` 8 | An OpenStack-native REST API that processes API requests by sending 9 | them to the ``zun-compute`` over Remote Procedure Call (RPC). 10 | 11 | ``zun-compute`` 12 | A worker daemon that creates and terminates containers or capsules (pods) 13 | through container engine API. Manage containers, capsules and compute 14 | resources in local host. 15 | 16 | ``zun-wsproxy`` 17 | Provides a proxy for accessing running containers through a websocket 18 | connection. 19 | 20 | ``zun-cni-daemon`` 21 | Provides a CNI daemon service that provides implementation for the Zun CNI 22 | plugin. 23 | 24 | Optionally, one may wish to utilize the following associated projects for 25 | additional functionality: 26 | 27 | python-zunclient_ 28 | A command-line interface (CLI) and python bindings for interacting with the 29 | Container service. 30 | 31 | zun-ui_ 32 | The Horizon plugin for providing Web UI for Zun. 33 | 34 | .. _python-zunclient: https://docs.openstack.org/python-zunclient/latest/ 35 | .. _zun-ui: https://docs.openstack.org/zun-ui/latest/ 36 | -------------------------------------------------------------------------------- /doc/source/install/index.rst: -------------------------------------------------------------------------------- 1 | ====================== 2 | Zun Installation Guide 3 | ====================== 4 | 5 | .. toctree:: 6 | 7 | overview.rst 8 | get_started.rst 9 | controller-install.rst 10 | compute-install.rst 11 | verify.rst 12 | launch-container.rst 13 | next-steps.rst 14 | 15 | This chapter assumes a working setup of OpenStack following the 16 | `OpenStack Installation Tutorial `_. 17 | -------------------------------------------------------------------------------- /doc/source/install/next-steps.rst: -------------------------------------------------------------------------------- 1 | .. _next-steps: 2 | 3 | Next steps 4 | ~~~~~~~~~~ 5 | 6 | Your OpenStack environment now includes the zun service. 7 | 8 | To add more services, see the 9 | `additional documentation on installing OpenStack `_ . 10 | 11 | To learn more about the zun service, read the `Zun developer documentation 12 | `__. 13 | -------------------------------------------------------------------------------- /doc/source/install/verify.rst: -------------------------------------------------------------------------------- 1 | .. _verify: 2 | 3 | Verify operation 4 | ~~~~~~~~~~~~~~~~ 5 | 6 | Verify operation of the Container service. 7 | 8 | .. note:: 9 | 10 | Perform these commands on the controller node. 11 | 12 | #. Install python-zunclient: 13 | 14 | .. code-block:: console 15 | 16 | # pip3 install python-zunclient 17 | 18 | #. Source the ``admin`` tenant credentials: 19 | 20 | .. code-block:: console 21 | 22 | $ . admin-openrc 23 | 24 | #. List service components to verify successful launch and 25 | registration of each process: 26 | 27 | .. code-block:: console 28 | 29 | $ openstack appcontainer service list 30 | +----+-----------------------+-------------+-------+----------+-----------------+---------------------------+--------------------+ 31 | | Id | Host | Binary | State | Disabled | Disabled Reason | Updated At | Availability Zone | 32 | +----+-----------------------+-------------+-------+----------+-----------------+---------------------------+--------------------+ 33 | | 1 | localhost.localdomain | zun-compute | up | False | None | 2018-03-13 14:15:40+00:00 | nova | 34 | +----+-----------------------+-------------+-------+----------+-----------------+---------------------------+--------------------+ 35 | -------------------------------------------------------------------------------- /doc/source/reference/api-microversion-history.rst: -------------------------------------------------------------------------------- 1 | .. include:: ../../../zun/api/rest_api_version_history.rst 2 | -------------------------------------------------------------------------------- /doc/source/reference/index.rst: -------------------------------------------------------------------------------- 1 | Reference Material 2 | ================== 3 | 4 | .. toctree:: 5 | :glob: 6 | :maxdepth: 1 7 | 8 | api-microversion-history 9 | -------------------------------------------------------------------------------- /etc/cni/net.d/10-zun-cni.conf: -------------------------------------------------------------------------------- 1 | { 2 | "cniVersion": "0.3.1", 3 | "name": "zun", 4 | "type": "zun-cni", 5 | "zun_conf": "/etc/zun/zun.conf" 6 | } 7 | -------------------------------------------------------------------------------- /etc/zun/api-paste.ini: -------------------------------------------------------------------------------- 1 | [composite:main] 2 | use = egg:Paste#urlmap 3 | /: zun_api_pipeline 4 | /healthcheck: healthcheck 5 | 6 | [pipeline:zun_api_pipeline] 7 | pipeline = cors request_id osprofiler authtoken api_v1 8 | 9 | [app:api_v1] 10 | paste.app_factory = zun.api.app:app_factory 11 | 12 | [filter:authtoken] 13 | acl_public_routes = /, /v1 14 | paste.filter_factory = zun.api.middleware.auth_token:AuthTokenMiddleware.factory 15 | 16 | [filter:osprofiler] 17 | paste.filter_factory = zun.common.profiler:WsgiMiddleware.factory 18 | 19 | [filter:request_id] 20 | paste.filter_factory = oslo_middleware:RequestId.factory 21 | 22 | [filter:cors] 23 | paste.filter_factory = oslo_middleware.cors:filter_factory 24 | oslo_config_project = zun 25 | 26 | [app:healthcheck] 27 | paste.app_factory = oslo_middleware:Healthcheck.app_factory 28 | backends = disable_by_file 29 | disable_by_file_path = /etc/zun/healthcheck_disable 30 | -------------------------------------------------------------------------------- /etc/zun/rootwrap.conf: -------------------------------------------------------------------------------- 1 | # Configuration for zun-rootwrap 2 | # This file should be owned by (and only-writable by) the root user 3 | 4 | [DEFAULT] 5 | # List of directories to load filter definitions from (separated by ','). 6 | # These directories MUST all be only writable by root ! 7 | filters_path=/etc/zun/rootwrap.d 8 | 9 | # List of directories to search executables in, in case filters do not 10 | # explicitely specify a full path (separated by ',') 11 | # If not specified, defaults to system PATH environment variable. 12 | # These directories MUST all be only writable by root ! 13 | exec_dirs=/sbin,/usr/sbin,/bin,/usr/bin,/usr/local/bin,/usr/local/sbin 14 | 15 | # Enable logging to syslog 16 | # Default value is False 17 | use_syslog=False 18 | 19 | # Which syslog facility to use. 20 | # Valid values include auth, authpriv, syslog, local0, local1... 21 | # Default value is 'syslog' 22 | syslog_log_facility=syslog 23 | 24 | # Which messages to log. 25 | # INFO means log all usage 26 | # ERROR means only log unsuccessful attempts 27 | syslog_log_level=ERROR 28 | -------------------------------------------------------------------------------- /etc/zun/rootwrap.d/zun.filters: -------------------------------------------------------------------------------- 1 | # zun command filters 2 | # This file should be owned by (and only-writeable by) the root user 3 | 4 | [Filters] 5 | # privileged/__init__.py: priv_context.PrivContext(default) 6 | # This line ties the superuser privs with the config files, context name, 7 | # and (implicitly) the actual python code invoked. 8 | privsep-rootwrap: RegExpFilter, privsep-helper, root, privsep-helper, --config-file, /etc/(?!\.\.).*, --privsep_context, os_brick.privileged.default, --privsep_sock_path, /tmp/.* 9 | -------------------------------------------------------------------------------- /etc/zun/zun-config-generator.conf: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | output_file = etc/zun/zun.conf.sample 3 | wrap_width = 79 4 | 5 | namespace = zun.conf 6 | namespace = keystonemiddleware.auth_token 7 | namespace = oslo.concurrency 8 | namespace = oslo.db 9 | namespace = oslo.log 10 | namespace = oslo.messaging 11 | namespace = oslo.middleware.cors 12 | namespace = oslo.middleware.healthcheck 13 | namespace = oslo.policy 14 | namespace = oslo.privsep 15 | namespace = oslo.service.periodic_task 16 | namespace = oslo.service.service 17 | -------------------------------------------------------------------------------- /etc/zun/zun-policy-generator.conf: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | output_file = etc/zun/policy.yaml.sample 3 | namespace = zun 4 | -------------------------------------------------------------------------------- /playbooks/fullstack/post.yaml: -------------------------------------------------------------------------------- 1 | - hosts: all 2 | roles: 3 | - fetch_docker_log 4 | -------------------------------------------------------------------------------- /playbooks/fullstack/run.yaml: -------------------------------------------------------------------------------- 1 | - hosts: all 2 | roles: 3 | - orchestrate-devstack 4 | - ensure-tox 5 | - tox 6 | -------------------------------------------------------------------------------- /playbooks/zun-tempest-base/post.yaml: -------------------------------------------------------------------------------- 1 | - hosts: all 2 | roles: 3 | - fetch_docker_log 4 | - fetch_containerd_log 5 | -------------------------------------------------------------------------------- /releasenotes/notes/.placeholder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/releasenotes/notes/.placeholder -------------------------------------------------------------------------------- /releasenotes/notes/add-cni-plugin-fd5bf4e9abbe6683.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Introduce a CNI plugin for Zun. The plugin is a binary called ``zun-cni``. 5 | This binary is an executable that sends CNI commands to a daemon process 6 | ``zun-cni-daemon`` which provides the actual implementation for CNI. 7 | -------------------------------------------------------------------------------- /releasenotes/notes/add-support-for-cri-runtime-2c549a85fe795361.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | prelude: > 3 | Starting from this release, Zun adds support for CRI-compatible runtime. 4 | Zun uses CRI runtime to realize the concept of capsule (pod). 5 | As a result, users can use Zun API to create pods in Kata container via 6 | a CRI runtime. 7 | features: 8 | - | 9 | Introduce a CRI driver that is responsible for interfacing with CRI 10 | runtime to manage the pods. 11 | -------------------------------------------------------------------------------- /releasenotes/notes/add-support-for-requested_host-0ea7e317234c3d0c.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Add support for requesting specific host to run a container. 5 | By default, host can be specified by administrators only. 6 | -------------------------------------------------------------------------------- /releasenotes/notes/add-upgrade-check-framework-4729fcb4ecd31221.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | prelude: > 3 | Added new tool ``zun-status upgrade check``. 4 | features: 5 | - | 6 | New framework for ``zun-status upgrade check`` command is added. 7 | This framework allows adding various checks which can be run before a 8 | Zun upgrade to ensure if the upgrade can be performed safely. 9 | upgrade: 10 | - | 11 | Operator can now use new CLI tool ``zun-status upgrade check`` 12 | to check if Zun deployment can be safely upgraded from 13 | N-1 to N release. 14 | 15 | -------------------------------------------------------------------------------- /releasenotes/notes/container_driver-e82fe9c64c9b994b.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | upgrade: 3 | - | 4 | Starting from this release, container driver is loaded from entry point. 5 | Deployers should specify the entry point (i.e. ``docker``) in config option 6 | ``container_driver`` under ``[DEFAULT]`` session. 7 | deprecations: 8 | - | 9 | Specifying container driver class via config option ``container_driver`` 10 | is deprecated. Use driver name in entry point ``zun.container.driver`` 11 | instead. 12 | -------------------------------------------------------------------------------- /releasenotes/notes/deprecate-CPU-Ram-Disk-filter-fa8ed0d10b0bd92a.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | deprecations: 3 | - | 4 | The ``CPUFilter``, ``RamFilter`` and 5 | ``DiskFilter`` are now deprecated. 6 | They will be removed in a future release and should no longer be used. 7 | Their functionality has been replaced with a placement native approach. 8 | -------------------------------------------------------------------------------- /releasenotes/notes/deprecate-json-formatted-policy-file-1c77a54f9a043c25.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | upgrade: 3 | - | 4 | The default value of ``[oslo_policy] policy_file`` config option has 5 | been changed from ``policy.json`` to ``policy.yaml``. 6 | Operators who are utilizing customized or previously generated 7 | static policy JSON files (which are not needed by default), should 8 | generate new policy files or convert them in YAML format. Use the 9 | `oslopolicy-convert-json-to-yaml 10 | `_ 11 | tool to convert a JSON to YAML formatted policy file in 12 | backward compatible way. 13 | deprecations: 14 | - | 15 | Use of JSON policy files was deprecated by the ``oslo.policy`` library 16 | during the Victoria development cycle. As a result, this deprecation is 17 | being noted in the Wallaby cycle with an anticipated future removal of support 18 | by ``oslo.policy``. As such operators will need to convert to YAML policy 19 | files. Please see the upgrade notes for details on migration of any 20 | custom policy files. 21 | -------------------------------------------------------------------------------- /releasenotes/notes/drop-py-2-7-c475cf37ff3476d8.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | upgrade: 3 | - | 4 | Python 2.7 support has been dropped. Last release of Zun to support 5 | py2.7 is OpenStack Train. The minimum version of Python now 6 | supported by Zun is Python 3.6. 7 | -------------------------------------------------------------------------------- /releasenotes/notes/introduce-CNI-plugin-for-docker-07d6a78cd281a508.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | prelude: > 3 | Introduce a CNI plugin for docker. The new CNI plugin will eventually 4 | replace kuryr-libnetwork (which is the current network plugin Zun is 5 | currently using for docker). 6 | features: 7 | - | 8 | Introduce a CNI plugin for docker. In before, Zun was using libnetwork 9 | as the networking model for docker containers. 10 | Starting from this release, Zun introduces an alternative CNI plugin 11 | which implements the CNI networking model for docker containers. 12 | The new CNI plugin will become the default network plugin and the old 13 | libnetwork plugin will be deprecated. 14 | upgrade: 15 | - | 16 | Deployers who are choosing CNI plugin don't need to deploy 17 | kuryr-libnetwork and etcd. 18 | -------------------------------------------------------------------------------- /releasenotes/notes/placement-integration-d701f64c584981d6.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | prelude: > 3 | This release supports placement integration. 4 | features: 5 | - | 6 | In this release, Zun compute agent will report local resource 7 | availability/utilization to placement API. 8 | In addition, Zun scheduler will get allocation candidates 9 | from placement API and claim container allocation in placement. 10 | upgrade: 11 | - | 12 | Since this release, operators need to configure each compute node 13 | that runs both Zun compute agent and Nova compute agent as follows:: 14 | 15 | [compute] 16 | host_shared_with_nova = true 17 | 18 | By setting ``host_shared_with_nova`` to ``true``, Zun compute agent and 19 | Nova compute agent will share a resource provider for the compute node 20 | in placement. In particular, both Nova instances and Zun containers might 21 | claim allocation on the same resource provider. 22 | By default, ``host_shared_with_nova`` is ``false`` which means Zun 23 | compute agent will create its own resource provider for the compute node. 24 | -------------------------------------------------------------------------------- /releasenotes/notes/support-entrypoint-option-5127ab5044025380.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Add support for specifying entrypoint with the container 5 | which is used to overwrite the entrypoint of the docker image. 6 | -------------------------------------------------------------------------------- /releasenotes/notes/zuul-v3-native-gates-a46ef4c168f9362e.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Migrate all upstream gates to Zuulv3 native format. 5 | 6 | -------------------------------------------------------------------------------- /releasenotes/source/2023.1.rst: -------------------------------------------------------------------------------- 1 | =========================== 2 | 2023.1 Series Release Notes 3 | =========================== 4 | 5 | .. release-notes:: 6 | :branch: unmaintained/2023.1 7 | -------------------------------------------------------------------------------- /releasenotes/source/2023.2.rst: -------------------------------------------------------------------------------- 1 | =========================== 2 | 2023.2 Series Release Notes 3 | =========================== 4 | 5 | .. release-notes:: 6 | :branch: stable/2023.2 7 | -------------------------------------------------------------------------------- /releasenotes/source/2024.1.rst: -------------------------------------------------------------------------------- 1 | =========================== 2 | 2024.1 Series Release Notes 3 | =========================== 4 | 5 | .. release-notes:: 6 | :branch: stable/2024.1 7 | -------------------------------------------------------------------------------- /releasenotes/source/2024.2.rst: -------------------------------------------------------------------------------- 1 | =========================== 2 | 2024.2 Series Release Notes 3 | =========================== 4 | 5 | .. release-notes:: 6 | :branch: stable/2024.2 7 | -------------------------------------------------------------------------------- /releasenotes/source/2025.1.rst: -------------------------------------------------------------------------------- 1 | =========================== 2 | 2025.1 Series Release Notes 3 | =========================== 4 | 5 | .. release-notes:: 6 | :branch: stable/2025.1 7 | -------------------------------------------------------------------------------- /releasenotes/source/_static/.placeholder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/releasenotes/source/_static/.placeholder -------------------------------------------------------------------------------- /releasenotes/source/_templates/.placeholder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/releasenotes/source/_templates/.placeholder -------------------------------------------------------------------------------- /releasenotes/source/index.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Licensed under the Apache License, Version 2.0 (the "License"); you may 3 | not use this file except in compliance with the License. You may obtain 4 | a copy of the License at 5 | 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | 8 | Unless required by applicable law or agreed to in writing, software 9 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 11 | License for the specific language governing permissions and limitations 12 | under the License. 13 | 14 | ================== 15 | Zun Release Notes 16 | ================== 17 | 18 | .. toctree:: 19 | :maxdepth: 1 20 | 21 | unreleased 22 | 2025.1 23 | 2024.2 24 | 2024.1 25 | 2023.2 26 | 2023.1 27 | zed 28 | yoga 29 | xena 30 | wallaby 31 | victoria 32 | ussuri 33 | train 34 | stein 35 | rocky 36 | queens 37 | pike 38 | -------------------------------------------------------------------------------- /releasenotes/source/pike.rst: -------------------------------------------------------------------------------- 1 | =================================== 2 | Pike Series Release Notes 3 | =================================== 4 | 5 | .. release-notes:: 6 | :branch: stable/pike 7 | -------------------------------------------------------------------------------- /releasenotes/source/queens.rst: -------------------------------------------------------------------------------- 1 | =================================== 2 | Queens Series Release Notes 3 | =================================== 4 | 5 | .. release-notes:: 6 | :branch: stable/queens 7 | -------------------------------------------------------------------------------- /releasenotes/source/rocky.rst: -------------------------------------------------------------------------------- 1 | =================================== 2 | Rocky Series Release Notes 3 | =================================== 4 | 5 | .. release-notes:: 6 | :branch: stable/rocky 7 | -------------------------------------------------------------------------------- /releasenotes/source/stein.rst: -------------------------------------------------------------------------------- 1 | =================================== 2 | Stein Series Release Notes 3 | =================================== 4 | 5 | .. release-notes:: 6 | :branch: stable/stein 7 | -------------------------------------------------------------------------------- /releasenotes/source/train.rst: -------------------------------------------------------------------------------- 1 | ========================== 2 | Train Series Release Notes 3 | ========================== 4 | 5 | .. release-notes:: 6 | :branch: stable/train 7 | -------------------------------------------------------------------------------- /releasenotes/source/unreleased.rst: -------------------------------------------------------------------------------- 1 | ============================== 2 | Current Series Release Notes 3 | ============================== 4 | 5 | .. release-notes:: 6 | -------------------------------------------------------------------------------- /releasenotes/source/ussuri.rst: -------------------------------------------------------------------------------- 1 | =========================== 2 | Ussuri Series Release Notes 3 | =========================== 4 | 5 | .. release-notes:: 6 | :branch: stable/ussuri 7 | -------------------------------------------------------------------------------- /releasenotes/source/victoria.rst: -------------------------------------------------------------------------------- 1 | ============================= 2 | Victoria Series Release Notes 3 | ============================= 4 | 5 | .. release-notes:: 6 | :branch: unmaintained/victoria 7 | -------------------------------------------------------------------------------- /releasenotes/source/wallaby.rst: -------------------------------------------------------------------------------- 1 | ============================ 2 | Wallaby Series Release Notes 3 | ============================ 4 | 5 | .. release-notes:: 6 | :branch: unmaintained/wallaby 7 | -------------------------------------------------------------------------------- /releasenotes/source/xena.rst: -------------------------------------------------------------------------------- 1 | ========================= 2 | Xena Series Release Notes 3 | ========================= 4 | 5 | .. release-notes:: 6 | :branch: unmaintained/xena 7 | -------------------------------------------------------------------------------- /releasenotes/source/yoga.rst: -------------------------------------------------------------------------------- 1 | ========================= 2 | Yoga Series Release Notes 3 | ========================= 4 | 5 | .. release-notes:: 6 | :branch: unmaintained/yoga 7 | -------------------------------------------------------------------------------- /releasenotes/source/zed.rst: -------------------------------------------------------------------------------- 1 | ======================== 2 | Zed Series Release Notes 3 | ======================== 4 | 5 | .. release-notes:: 6 | :branch: unmaintained/zed 7 | -------------------------------------------------------------------------------- /roles/fetch_containerd_log/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | - name: Ensure {{ ansible_user_dir }}/logs exists 2 | become: True 3 | file: 4 | path: "{{ ansible_user_dir }}/logs" 5 | state: directory 6 | owner: "{{ ansible_user }}" 7 | - name: Copy over containerd systemd unit journals 8 | shell: 9 | cmd: | 10 | sudo journalctl -o short-precise --unit containerd | sudo tee {{ ansible_user_dir }}/logs/containerd.txt > /dev/null 11 | executable: /bin/bash 12 | -------------------------------------------------------------------------------- /roles/fetch_docker_log/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | - name: Ensure {{ ansible_user_dir }}/logs exists 2 | become: True 3 | file: 4 | path: "{{ ansible_user_dir }}/logs" 5 | state: directory 6 | owner: "{{ ansible_user }}" 7 | - name: Copy over docker systemd unit journals 8 | shell: 9 | cmd: | 10 | sudo journalctl -o short-precise --unit docker | sudo tee {{ ansible_user_dir }}/logs/docker.txt > /dev/null 11 | executable: /bin/bash 12 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 Hewlett-Packard Development Company, L.P. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 | # implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT 17 | import setuptools 18 | 19 | # In python < 2.7.4, a lazy loading of package `pbr` will break 20 | # setuptools if some other modules registered functions in `atexit`. 21 | # solution from: http://bugs.python.org/issue15881#msg170215 22 | try: 23 | import multiprocessing # noqa 24 | except ImportError: 25 | pass 26 | 27 | setuptools.setup( 28 | setup_requires=['pbr>=2.0.0'], 29 | pbr=True) 30 | -------------------------------------------------------------------------------- /template/capsule/capsule-init-containers.yaml: -------------------------------------------------------------------------------- 1 | capsuleVersion: beta 2 | kind: capsule 3 | metadata: 4 | name: init-demo 5 | spec: 6 | containers: 7 | - image: nginx 8 | volumeMounts: 9 | - name: workdir 10 | mountPath: /usr/share/nginx/html 11 | # These containers are run during capsule initialization 12 | initContainers: 13 | - image: busybox 14 | command: 15 | - wget 16 | - "-O" 17 | - "/work-dir/index.html" 18 | - https://www.openstack.org/ 19 | volumeMounts: 20 | - name: workdir 21 | mountPath: "/work-dir" 22 | volumes: 23 | - name: workdir 24 | cinder: 25 | size: 1 26 | -------------------------------------------------------------------------------- /template/capsule/capsule-volume.yaml: -------------------------------------------------------------------------------- 1 | # use "-" because that the fields have many items 2 | capsuleVersion: beta 3 | kind: capsule 4 | metadata: 5 | name: capsule-volume 6 | labels: 7 | foo: bar 8 | availabilityZone: nova 9 | spec: 10 | restartPolicy: Always 11 | containers: 12 | - image: test 13 | command: 14 | - "/bin/bash" 15 | workDir: /root 16 | labels: 17 | app: web 18 | volumeMounts: 19 | - name: volume1 20 | mountPath: /data1 21 | - name: volume2 22 | mountPath: /data2 23 | - name: volume3 24 | mountPath: /data3 25 | volumes: 26 | - name: volume1 27 | cinder: 28 | size: 3 29 | autoRemove: True 30 | - name: volume2 31 | cinder: 32 | volumeID: 473e4a6a-99f2-4b42-88ce-5ab03a00b756 33 | - name: volume3 34 | cinder: 35 | volumeID: f4246aa1-1c87-479c-a2ab-4dbaf0c3c7bb 36 | -------------------------------------------------------------------------------- /test-requirements.txt: -------------------------------------------------------------------------------- 1 | # The order of packages is significant, because pip processes them in the order 2 | # of appearance. Changing the order has an impact on the overall integration 3 | # process, which may cause wedges in the gate later. 4 | 5 | # Hacking already pins down pep8, pyflakes and flake8 6 | hacking>=3.0.1,<3.1.0 # Apache-2.0 7 | 8 | bandit>=1.1.0 # Apache-2.0 9 | doc8>=0.8.1 # Apache-2.0 10 | coverage>=5.3 # Apache-2.0 11 | fixtures>=3.0.0 # Apache-2.0/BSD 12 | oslotest>=4.4.1 # Apache-2.0 13 | osprofiler>=3.4.0 # Apache-2.0 14 | PyMySQL>=0.7.6 # MIT License 15 | tempest>=17.1.0 # Apache-2.0 16 | testresources>=2.0.0 # Apache-2.0/BSD 17 | testscenarios>=0.4 # Apache-2.0/BSD 18 | testtools>=2.4.0 # MIT 19 | stestr>=3.1.0 # Apache-2.0 20 | Pygments>=2.7.2 # BSD license 21 | python-zunclient>=4.1.0 # Apache-2.0 22 | WebTest>=2.0.26 # MIT 23 | -------------------------------------------------------------------------------- /tools/README-zun.conf.txt: -------------------------------------------------------------------------------- 1 | To generate the sample zun.conf file, run gen-config tools 2 | from the top level of the zun directory: 3 | 4 | tools/gen-config 5 | 6 | Or run the following command from the top level of the 7 | zun directory: 8 | 9 | tox -egenconfig 10 | 11 | Generated sample configuration file will be put into etc/zun/ 12 | directory. 13 | -------------------------------------------------------------------------------- /tools/fast8.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd $(dirname "$0")/.. 4 | CHANGED=$(git diff --name-only HEAD~1 | tr '\n' ' ') 5 | 6 | # Skip files that don't exist 7 | # (have been git rm'd) 8 | CHECK="" 9 | for FILE in $CHANGED; do 10 | if [ -f "$FILE" ]; then 11 | CHECK="$CHECK $FILE" 12 | fi 13 | done 14 | 15 | diff -u --from-file /dev/null $CHECK | flake8 --diff 16 | 17 | -------------------------------------------------------------------------------- /tools/flake8wrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # A simple wrapper around flake8 which makes it possible 4 | # to ask it to only verify files changed in the current 5 | # git HEAD patch. 6 | # 7 | # Intended to be invoked via tox: 8 | # 9 | # tox -epep8 -- -HEAD 10 | # 11 | 12 | if test "x$1" = "x-HEAD" ; then 13 | shift 14 | files=$(git diff --name-only HEAD~1 | tr '\n' ' ') 15 | echo "Running flake8 on ${files}" 16 | diff -u --from-file /dev/null ${files} | flake8 --max-complexity 34 --exclude zun/criapi --diff "$@" 17 | else 18 | echo "Running flake8 on all files" 19 | exec flake8 "$@" 20 | fi 21 | -------------------------------------------------------------------------------- /tools/gen-config: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | oslo-config-generator --config-file=tools/zun-config-generator.conf 4 | -------------------------------------------------------------------------------- /tools/zun-config-generator.conf: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | output_file = etc/zun/zun.conf.sample 3 | wrap_width = 79 4 | 5 | namespace = zun.conf 6 | namespace = keystonemiddleware.auth_token 7 | namespace = oslo.concurrency 8 | namespace = oslo.db 9 | namespace = oslo.log 10 | namespace = oslo.messaging 11 | namespace = oslo.middleware.cors 12 | namespace = oslo.policy 13 | namespace = oslo.service.periodic_task 14 | namespace = oslo.service.service 15 | -------------------------------------------------------------------------------- /zun/MANIFEST.in: -------------------------------------------------------------------------------- 1 | recursive-include public * 2 | -------------------------------------------------------------------------------- /zun/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | import pbr.version 15 | 16 | 17 | __version__ = pbr.version.VersionInfo( 18 | 'zun').version_string() 19 | -------------------------------------------------------------------------------- /zun/api/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/api/__init__.py -------------------------------------------------------------------------------- /zun/api/app.wsgi: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | """Use this file for deploying the API under mod_wsgi. 14 | See https://pecan.readthedocs.org/en/latest/deployment.html for details. 15 | """ 16 | 17 | from zun.api import wsgi 18 | 19 | application = wsgi.init_application() 20 | -------------------------------------------------------------------------------- /zun/api/config.py: -------------------------------------------------------------------------------- 1 | # Copyright 2013 - Noorul Islam K M 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | from zun.api import hooks 16 | 17 | # Pecan Application Configurations 18 | app = { 19 | 'root': 'zun.api.controllers.root.RootController', 20 | 'modules': ['zun'], 21 | 'hooks': [ 22 | hooks.ContextHook(), 23 | hooks.NoExceptionTracebackHook(), 24 | hooks.RPCHook(), 25 | ], 26 | 'debug': False, 27 | } 28 | -------------------------------------------------------------------------------- /zun/api/controllers/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/api/controllers/__init__.py -------------------------------------------------------------------------------- /zun/api/controllers/v1/schemas/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/api/controllers/v1/schemas/__init__.py -------------------------------------------------------------------------------- /zun/api/controllers/v1/schemas/capsules.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 ARM Holdings. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | from zun.api.controllers.v1.schemas import parameter_types 16 | 17 | _capsule_properties = { 18 | 'template': parameter_types.capsule_template 19 | } 20 | 21 | capsule_create = { 22 | 'type': 'object', 23 | 'properties': _capsule_properties, 24 | 'required': ['template'], 25 | 'additionalProperties': False 26 | } 27 | -------------------------------------------------------------------------------- /zun/api/controllers/v1/schemas/images.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | from zun.api.controllers.v1.schemas import parameter_types 14 | 15 | _image_properties = { 16 | 'image_id': parameter_types.image_id, 17 | 'repo': parameter_types.repo, 18 | 'tag': parameter_types.tag, 19 | 'size': parameter_types.size, 20 | 'image_pull_policy': parameter_types.image_pull_policy, 21 | 'host': parameter_types.image_host, 22 | } 23 | 24 | image_create = { 25 | 'type': 'object', 26 | 'properties': _image_properties, 27 | 'required': ['repo', 'host'], 28 | 'additionalProperties': False 29 | } 30 | 31 | query_param_search = { 32 | 'type': 'object', 33 | 'properties': { 34 | 'image_driver': parameter_types.image_driver, 35 | 'exact_match': parameter_types.boolean 36 | }, 37 | 'additionalProperties': False 38 | } 39 | -------------------------------------------------------------------------------- /zun/api/controllers/v1/schemas/network.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | from zun.api.controllers.v1.schemas import parameter_types 14 | 15 | _network_properties = { 16 | 'neutron_net_id': parameter_types.neutron_net_id, 17 | 'name': parameter_types.network_name 18 | } 19 | 20 | network_create = { 21 | 'type': 'object', 22 | 'properties': _network_properties, 23 | 'required': ['name'], 24 | 'additionalProperties': False 25 | } 26 | -------------------------------------------------------------------------------- /zun/api/controllers/v1/schemas/quota_classes.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | from zun.api.controllers.v1.schemas import quotas 14 | 15 | 16 | query_param_update = { 17 | 'type': 'object', 18 | 'properties': quotas.quota_resources, 19 | 'additionalProperties': False 20 | } 21 | -------------------------------------------------------------------------------- /zun/api/controllers/v1/schemas/quotas.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | common_quota = { 14 | 'type': ['integer', 'string'], 15 | 'pattern': '^-?[0-9]+$', 16 | # -1 is a flag value for unlimited 17 | 'minimum': -1 18 | } 19 | 20 | quota_resources = { 21 | 'containers': common_quota, 22 | 'memory': common_quota, 23 | 'cpu': common_quota, 24 | 'disk': common_quota 25 | } 26 | 27 | query_param_update = { 28 | 'type': 'object', 29 | 'properties': quota_resources, 30 | 'additionalProperties': False 31 | } 32 | -------------------------------------------------------------------------------- /zun/api/controllers/v1/views/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/api/controllers/v1/views/__init__.py -------------------------------------------------------------------------------- /zun/api/controllers/v1/views/network_view.py: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 3 | # not use this file except in compliance with the License. You may obtain 4 | # a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 11 | # License for the specific language governing permissions and limitations 12 | # under the License. 13 | 14 | import itertools 15 | 16 | _basic_keys = ( 17 | 'uuid', 18 | 'name', 19 | 'project_id', 20 | 'user_id', 21 | 'network_id', 22 | 'neutron_net_id', 23 | ) 24 | 25 | 26 | def format_network(url, network): 27 | def transform(key, value): 28 | if key not in _basic_keys: 29 | return 30 | if key == 'uuid': 31 | yield ('uuid', value) 32 | else: 33 | yield (key, value) 34 | 35 | return dict(itertools.chain.from_iterable( 36 | transform(k, v) for k, v in network.as_dict().items())) 37 | -------------------------------------------------------------------------------- /zun/api/controllers/v1/views/services_view.py: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 3 | # not use this file except in compliance with the License. You may obtain 4 | # a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 11 | # License for the specific language governing permissions and limitations 12 | # under the License. 13 | 14 | import datetime 15 | import itertools 16 | 17 | from zun.common import utils 18 | 19 | 20 | _basic_keys = ( 21 | 'availability_zone', 22 | 'binary', 23 | 'created_at', 24 | 'disabled', 25 | 'disabled_reason', 26 | 'forced_down', 27 | 'host', 28 | 'id', 29 | 'last_seen_up', 30 | 'report_count', 31 | 'state', 32 | 'updated_at', 33 | ) 34 | 35 | 36 | def format_service(service): 37 | def transform(key, value): 38 | if key not in _basic_keys: 39 | return 40 | if isinstance(value, datetime.datetime): 41 | yield (key, utils.strtime(value)) 42 | else: 43 | yield (key, value) 44 | 45 | return dict( 46 | itertools.chain.from_iterable( 47 | transform(k, v)for k, v in service.items())) 48 | -------------------------------------------------------------------------------- /zun/api/middleware/__init__.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | from zun.api.middleware import auth_token 14 | from zun.api.middleware import parsable_error 15 | 16 | 17 | AuthTokenMiddleware = auth_token.AuthTokenMiddleware 18 | ParsableErrorMiddleware = parsable_error.ParsableErrorMiddleware 19 | 20 | __all__ = ('AuthTokenMiddleware', 21 | 'ParsableErrorMiddleware') 22 | -------------------------------------------------------------------------------- /zun/api/servicegroup.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 10 | # implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | from oslo_utils import timeutils 15 | 16 | import zun.conf 17 | from zun import objects 18 | 19 | CONF = zun.conf.CONF 20 | 21 | 22 | class ServiceGroup(object): 23 | def __init__(self): 24 | self.service_down_time = CONF.service_down_time 25 | 26 | def service_is_up(self, member): 27 | if not isinstance(member, objects.ZunService): 28 | raise TypeError 29 | if member.forced_down: 30 | return False 31 | 32 | last_heartbeat = (member.last_seen_up or 33 | member.updated_at or member.created_at) 34 | now = timeutils.utcnow() 35 | elapsed = timeutils.delta_seconds(last_heartbeat, now) 36 | is_up = abs(elapsed) <= self.service_down_time 37 | return is_up 38 | -------------------------------------------------------------------------------- /zun/api/versioned_method.py: -------------------------------------------------------------------------------- 1 | # Copyright 2014 IBM Corp. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | 16 | class VersionedMethod(object): 17 | 18 | def __init__(self, name, start_version, end_version, func): 19 | """Versioning information for a single method 20 | 21 | @name: Name of the method 22 | @start_version: Minimum acceptable version 23 | @end_version: Maximum acceptable_version 24 | @func: Method to call 25 | 26 | Minimum and maximums are inclusive 27 | """ 28 | self.name = name 29 | self.start_version = start_version 30 | self.end_version = end_version 31 | self.func = func 32 | 33 | def __str__(self): 34 | return ("Version Method %s: min: %s, max: %s" 35 | % (self.name, self.start_version, self.end_version)) 36 | -------------------------------------------------------------------------------- /zun/api/wsgi.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | import sys 14 | 15 | from oslo_log import log 16 | 17 | from zun.api import app 18 | from zun.common import profiler 19 | from zun.common import service 20 | import zun.conf 21 | 22 | 23 | CONF = zun.conf.CONF 24 | LOG = log.getLogger(__name__) 25 | 26 | 27 | def init_application(): 28 | # NOTE(hberaud): Call reset to ensure the ConfigOpts object doesn't 29 | # already contain registered options if the app is reloaded. 30 | CONF.reset() 31 | # Initialize the oslo configuration library and logging 32 | service.prepare_service(sys.argv) 33 | profiler.setup('zun-api', CONF.host) 34 | 35 | LOG.debug("Configuration:") 36 | CONF.log_opt_values(LOG, log.DEBUG) 37 | 38 | return app.load_app() 39 | -------------------------------------------------------------------------------- /zun/cmd/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Fujitsu Ltd. 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | # NOTE(hieulq): we monkey patch all eventlet services for easier tracking/debug 17 | 18 | import eventlet 19 | 20 | eventlet.monkey_patch() 21 | -------------------------------------------------------------------------------- /zun/cni/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/cni/__init__.py -------------------------------------------------------------------------------- /zun/cni/binding/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/cni/binding/__init__.py -------------------------------------------------------------------------------- /zun/cni/cmd/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/cni/cmd/__init__.py -------------------------------------------------------------------------------- /zun/cni/cmd/cni_daemon.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | import shlex 14 | import sys 15 | 16 | import os_vif 17 | from oslo_privsep import priv_context 18 | 19 | from zun.cni.daemon import service 20 | from zun.common import config 21 | from zun.common import service as zun_service 22 | from zun.common import utils 23 | 24 | 25 | def main(): 26 | priv_context.init(root_helper=shlex.split(utils.get_root_helper())) 27 | zun_service.prepare_service(sys.argv) 28 | config.parse_args(sys.argv) 29 | 30 | # Initialize o.vo registry. 31 | os_vif.initialize() 32 | 33 | service.CNIDaemonServiceManager().run() 34 | 35 | 36 | if __name__ == '__main__': 37 | sys.exit(main()) 38 | -------------------------------------------------------------------------------- /zun/cni/daemon/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/cni/daemon/__init__.py -------------------------------------------------------------------------------- /zun/cni/plugins/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/cni/plugins/__init__.py -------------------------------------------------------------------------------- /zun/common/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/common/__init__.py -------------------------------------------------------------------------------- /zun/common/docker_image/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/common/docker_image/__init__.py -------------------------------------------------------------------------------- /zun/common/i18n.py: -------------------------------------------------------------------------------- 1 | # Copyright 2014 IBM Corp. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 | # implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # It's based on oslo.i18n usage in OpenStack Keystone project and 17 | # recommendations from 18 | # https://docs.openstack.org/oslo.i18n/latest/user/usage.html 19 | 20 | import oslo_i18n 21 | 22 | 23 | _translators = oslo_i18n.TranslatorFactory(domain='zun') 24 | 25 | # The primary translation function using the well-known name "_" 26 | _ = _translators.primary 27 | -------------------------------------------------------------------------------- /zun/common/name_generator.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | from random import Random 14 | 15 | 16 | class NameGenerator(object): 17 | letters = ['alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 18 | 'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 'nu', 19 | 'xi', 'omicron', 'pi', 'rho', 'sigma', 'tau', 'upsilon', 20 | 'phi', 'chi', 'psi', 'omega'] 21 | 22 | def __init__(self): 23 | self.random = Random() 24 | 25 | def generate(self): 26 | """Generate a random name compose of a Greek leter and 27 | 28 | a number, like: beta_2. 29 | """ 30 | 31 | letter = self.random.choice(self.letters) 32 | number = self.random.randint(1, 24) 33 | 34 | return letter + '-' + str(number) 35 | -------------------------------------------------------------------------------- /zun/common/policies/availability_zone.py: -------------------------------------------------------------------------------- 1 | # Copyright 2018 NEC, Corp. 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | from oslo_policy import policy 17 | 18 | from zun.common.policies import base 19 | 20 | AVAILABILITY_ZONE = 'availability_zones:%s' 21 | 22 | 23 | rules = [ 24 | policy.DocumentedRuleDefault( 25 | name=AVAILABILITY_ZONE % 'get_all', 26 | check_str=base.RULE_ADMIN_OR_OWNER, 27 | description='List availability zone', 28 | operations=[ 29 | { 30 | 'path': '/v1/availability_zones', 31 | 'method': 'GET' 32 | } 33 | ] 34 | ) 35 | ] 36 | 37 | 38 | def list_rules(): 39 | return rules 40 | -------------------------------------------------------------------------------- /zun/common/policies/base.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | from oslo_policy import policy 14 | 15 | ROLE_ADMIN = 'role:admin' 16 | RULE_ADMIN_OR_OWNER = 'is_admin:True or project_id:%(project_id)s' 17 | RULE_ADMIN_API = 'rule:context_is_admin' 18 | RULE_DENY_EVERYBODY = 'rule:deny_everybody' 19 | 20 | rules = [ 21 | policy.RuleDefault( 22 | name='context_is_admin', 23 | check_str=ROLE_ADMIN 24 | ), 25 | policy.RuleDefault( 26 | name='admin_or_owner', 27 | check_str=RULE_ADMIN_OR_OWNER 28 | ), 29 | policy.RuleDefault( 30 | name='admin_api', 31 | check_str=RULE_ADMIN_API 32 | ), 33 | policy.RuleDefault( 34 | name="deny_everybody", 35 | check_str="!", 36 | description="Default rule for deny everybody."), 37 | ] 38 | 39 | 40 | def list_rules(): 41 | return rules 42 | -------------------------------------------------------------------------------- /zun/common/privileged.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | from oslo_privsep import capabilities as c 14 | from oslo_privsep import priv_context 15 | 16 | 17 | default = priv_context.PrivContext( 18 | 'zun.common', 19 | cfg_section='privsep', 20 | pypath=__name__ + '.default', 21 | capabilities=[c.CAP_SYS_ADMIN], 22 | ) 23 | 24 | 25 | cni = priv_context.PrivContext( 26 | 'zun.cni', 27 | cfg_section='privsep', 28 | pypath=__name__ + '.cni', 29 | capabilities=[c.CAP_SYS_ADMIN, c.CAP_NET_ADMIN, 30 | c.CAP_SYS_PTRACE], 31 | ) 32 | -------------------------------------------------------------------------------- /zun/common/singleton.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 IBM, Corp. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | from oslo_concurrency import lockutils 16 | 17 | 18 | class Singleton(type): 19 | _instances = {} 20 | _semaphores = lockutils.Semaphores() 21 | 22 | def __call__(cls, *args, **kwargs): 23 | with lockutils.lock('singleton_lock', semaphores=cls._semaphores): 24 | if cls not in cls._instances: 25 | cls._instances[cls] = super( 26 | Singleton, cls).__call__(*args, **kwargs) 27 | return cls._instances[cls] 28 | -------------------------------------------------------------------------------- /zun/common/yamlutils.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | import yaml 14 | 15 | 16 | def load(s): 17 | try: 18 | yml_dict = yaml.safe_load(s) 19 | except yaml.YAMLError as exc: 20 | msg = 'An error occurred during YAML parsing.' 21 | if hasattr(exc, 'problem_mark'): 22 | msg += ' Error position: (%s:%s)' % (exc.problem_mark.line + 1, 23 | exc.problem_mark.column + 1) 24 | raise ValueError(msg) 25 | if not isinstance(yml_dict, dict) and not isinstance(yml_dict, list): 26 | raise ValueError('The source is not a YAML mapping or list.') 27 | if isinstance(yml_dict, dict) and len(yml_dict) < 1: 28 | raise ValueError('Could not find any element in your YAML mapping.') 29 | return yml_dict 30 | 31 | 32 | def dump(s): 33 | return yaml.safe_dump(s) 34 | -------------------------------------------------------------------------------- /zun/compute/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/compute/__init__.py -------------------------------------------------------------------------------- /zun/conf/database.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015 NEC Corporation. All rights reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | from oslo_config import cfg 16 | 17 | 18 | sql_opts = [ 19 | cfg.StrOpt('mysql_engine', 20 | default='InnoDB', 21 | help='MySQL engine to use.') 22 | ] 23 | 24 | DEFAULT_OPTS = (sql_opts) 25 | 26 | 27 | def register_opts(conf): 28 | conf.register_opts(sql_opts, 'database') 29 | 30 | 31 | def list_opts(): 32 | return {"DEFAULT": DEFAULT_OPTS} 33 | -------------------------------------------------------------------------------- /zun/conf/network.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | from oslo_config import cfg 14 | 15 | 16 | network_group = cfg.OptGroup(name='network', 17 | title='Options for the container network') 18 | 19 | network_opts = [ 20 | cfg.StrOpt('driver', 21 | default='kuryr', 22 | help='Defines which driver to use for container network.'), 23 | cfg.StrOpt('driver_name', 24 | default='kuryr', 25 | help=('The network plugin driver name, you can find it by' 26 | ' docker plugin list.')), 27 | ] 28 | 29 | ALL_OPTS = (network_opts) 30 | 31 | 32 | def register_opts(conf): 33 | conf.register_group(network_group) 34 | conf.register_opts(ALL_OPTS, group=network_group) 35 | 36 | 37 | def list_opts(): 38 | return {network_group: ALL_OPTS} 39 | -------------------------------------------------------------------------------- /zun/conf/neutron.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); 2 | # you may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 10 | # implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | from oslo_config import cfg 15 | 16 | 17 | neutron_group = cfg.OptGroup(name='neutron', title='Options for neutron') 18 | 19 | neutron_opts = [ 20 | cfg.StrOpt('ovs_bridge', 21 | default='br-int', 22 | help=""" 23 | Default name for the Open vSwitch integration bridge. 24 | 25 | Specifies the name of an integration bridge interface used by OpenvSwitch. 26 | This option is only used if Neutron does not specify the OVS bridge name in 27 | port binding responses. 28 | """), 29 | ] 30 | 31 | ALL_OPTS = (neutron_opts) 32 | 33 | 34 | def register_opts(conf): 35 | conf.register_group(neutron_group) 36 | conf.register_opts(ALL_OPTS, neutron_group) 37 | 38 | 39 | def list_opts(): 40 | return {neutron_group: ALL_OPTS} 41 | -------------------------------------------------------------------------------- /zun/conf/profiler.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | # use this file except in compliance with the License. You may obtain a copy 3 | # of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | from oslo_utils import importutils 14 | 15 | 16 | profiler_opts = importutils.try_import('osprofiler.opts') 17 | 18 | 19 | def register_opts(conf): 20 | if profiler_opts: 21 | profiler_opts.set_defaults(conf) 22 | 23 | 24 | def list_opts(): 25 | if not profiler_opts: 26 | return {} 27 | return { 28 | profiler_opts._profiler_opt_group: profiler_opts._PROFILER_OPTS 29 | } 30 | -------------------------------------------------------------------------------- /zun/conf/ssl.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | from oslo_config import cfg 14 | from oslo_service import sslutils 15 | 16 | 17 | def register_opts(conf): 18 | sslutils.register_opts(conf) 19 | 20 | 21 | def list_opts(): 22 | group_name, ssl_opts = sslutils.list_opts()[0] 23 | ssl_group = cfg.OptGroup(name=group_name, 24 | title='Options for the ssl') 25 | return { 26 | ssl_group: ssl_opts 27 | } 28 | -------------------------------------------------------------------------------- /zun/conf/utils.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not 2 | # use this file except in compliance with the License. You may obtain a copy 3 | # of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | from oslo_config import cfg 14 | 15 | 16 | utils_opts = [ 17 | cfg.StrOpt('rootwrap_config', 18 | default="/etc/zun/rootwrap.conf", 19 | help='Path to the rootwrap configuration file to use for ' 20 | 'running commands as root.'), 21 | cfg.StrOpt('auth_encryption_key', 22 | secret=True, 23 | default='notgood but just long enough i t', 24 | help='Key used to encrypt authentication info in the ' 25 | 'database. Length of this key must be 32 characters.'), 26 | ] 27 | 28 | 29 | def register_opts(conf): 30 | conf.register_opts(utils_opts) 31 | 32 | 33 | def list_opts(): 34 | return { 35 | "DEFAULT": utils_opts 36 | } 37 | -------------------------------------------------------------------------------- /zun/container/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/container/__init__.py -------------------------------------------------------------------------------- /zun/container/cri/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/container/cri/__init__.py -------------------------------------------------------------------------------- /zun/container/docker/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/container/docker/__init__.py -------------------------------------------------------------------------------- /zun/container/os_capability/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/container/os_capability/__init__.py -------------------------------------------------------------------------------- /zun/container/os_capability/linux/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/container/os_capability/linux/__init__.py -------------------------------------------------------------------------------- /zun/criapi/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/criapi/__init__.py -------------------------------------------------------------------------------- /zun/db/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015 NEC Corporation. All rights reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | from oslo_db import options 16 | 17 | from zun.common import paths 18 | import zun.conf 19 | 20 | _DEFAULT_SQL_CONNECTION = 'sqlite:///' + paths.state_path_def('zun.sqlite') 21 | 22 | options.set_defaults(zun.conf.CONF) 23 | options.set_defaults(zun.conf.CONF, _DEFAULT_SQL_CONNECTION) 24 | -------------------------------------------------------------------------------- /zun/db/etcd/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/db/etcd/__init__.py -------------------------------------------------------------------------------- /zun/db/sqlalchemy/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/db/sqlalchemy/__init__.py -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/README: -------------------------------------------------------------------------------- 1 | Please see https://alembic.readthedocs.org/en/latest/index.html for general documentation 2 | 3 | To create alembic migrations use: 4 | $ zun-db-manage revision --message "description of revision" --autogenerate 5 | 6 | Stamp db with most recent migration version, without actually running migrations 7 | $ zun-db-manage stamp head 8 | 9 | Upgrade can be performed by: 10 | $ zun-db-manage upgrade 11 | $ zun-db-manage upgrade head 12 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/script.py.mako: -------------------------------------------------------------------------------- 1 | """${message} 2 | 3 | Revision ID: ${up_revision} 4 | Revises: ${down_revision | comma,n} 5 | Create Date: ${create_date} 6 | 7 | """ 8 | 9 | # revision identifiers, used by Alembic. 10 | revision = ${repr(up_revision)} 11 | down_revision = ${repr(down_revision)} 12 | branch_labels = ${repr(branch_labels)} 13 | depends_on = ${repr(depends_on)} 14 | 15 | from alembic import op 16 | import sqlalchemy as sa 17 | ${imports if imports else ""} 18 | 19 | def upgrade(): 20 | ${upgrades if upgrades else "pass"} 21 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/02134de8e7d3_add_exposed_ports_to_container.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | """add_exposed_ports_to_container 14 | 15 | Revision ID: 02134de8e7d3 16 | Revises: a019998b09b5 17 | Create Date: 2018-08-19 19:29:51.636559 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = '02134de8e7d3' 23 | down_revision = 'a019998b09b5' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | import zun 31 | 32 | 33 | def upgrade(): 34 | op.add_column('container', 35 | sa.Column('exposed_ports', 36 | zun.db.sqlalchemy.models.JSONEncodedDict(), 37 | nullable=True)) 38 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/105626c4f972_add_privileged_to_container.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | 14 | """add privileged to container 15 | 16 | Revision ID: 105626c4f972 17 | Revises: 3e80bbfd8da7 18 | Create Date: 2018-07-26 15:05:10.567715 19 | 20 | """ 21 | 22 | # revision identifiers, used by Alembic. 23 | revision = '105626c4f972' 24 | down_revision = '3e80bbfd8da7' 25 | branch_labels = None 26 | depends_on = None 27 | 28 | from alembic import op 29 | import sqlalchemy as sa 30 | 31 | 32 | def upgrade(): 33 | op.add_column('container', 34 | sa.Column('privileged', sa.Boolean(), 35 | nullable=True)) 36 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/157a0595e13e_drop_capsule_table.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | """drop capsule table 14 | 15 | Revision ID: 157a0595e13e 16 | Revises: d73b72ab7cc6 17 | Create Date: 2019-02-18 20:21:39.108829 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = '157a0595e13e' 23 | down_revision = 'd73b72ab7cc6' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | 29 | 30 | def upgrade(): 31 | op.drop_table('capsule') 32 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/174cafda0857_add_security_groups.py: -------------------------------------------------------------------------------- 1 | 2 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 3 | # not use this file except in compliance with the License. You may obtain 4 | # a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 11 | # License for the specific language governing permissions and limitations 12 | # under the License. 13 | 14 | """add security groups 15 | 16 | Revision ID: 174cafda0857 17 | Revises: 5359d23b2322 18 | Create Date: 2017-05-16 08:49:27.482284 19 | 20 | """ 21 | 22 | # revision identifiers, used by Alembic. 23 | revision = '174cafda0857' 24 | down_revision = '5359d23b2322' 25 | branch_labels = None 26 | depends_on = None 27 | 28 | 29 | from alembic import op 30 | import sqlalchemy as sa 31 | 32 | import zun 33 | 34 | 35 | def upgrade(): 36 | op.add_column('container', 37 | sa.Column('security_groups', 38 | zun.db.sqlalchemy.models.JSONEncodedList(), 39 | nullable=True)) 40 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/17ab8b533cc8_add_container_hosts_label_info.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); 2 | # you may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | """Add container hosts label info 14 | 15 | Revision ID: 17ab8b533cc8 16 | Revises: 04ba87af76bb 17 | Create Date: 2017-05-03 14:00:06.170629 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = '17ab8b533cc8' 23 | down_revision = '04ba87af76bb' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | import zun 31 | 32 | 33 | def upgrade(): 34 | op.add_column('compute_node', 35 | sa.Column('labels', 36 | zun.db.sqlalchemy.models.JSONEncodedDict(), 37 | nullable=True)) 38 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/1bc34e18180b_add_registry_id_to_container.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | """add registry_id to container 14 | 15 | Revision ID: 1bc34e18180b 16 | Revises: 5ffc1cabe6b4 17 | Create Date: 2019-01-06 21:45:57.505152 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = '1bc34e18180b' 23 | down_revision = '5ffc1cabe6b4' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | 31 | def upgrade(): 32 | op.add_column('container', 33 | sa.Column('registry_id', sa.Integer(), 34 | nullable=True)) 35 | op.create_foreign_key( 36 | None, 'container', 'registry', ['registry_id'], ['id']) 37 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/21fa080c818a_add_enable_cpu_pinning_to_compute_node.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | """add enable_cpu_pinning to compute_node 14 | 15 | Revision ID: 21fa080c818a 16 | Revises: 2b129060baff 17 | Create Date: 2018-12-12 03:09:40.316168 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = '21fa080c818a' 23 | down_revision = '2b129060baff' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | 31 | def upgrade(): 32 | op.add_column('compute_node', 33 | sa.Column('enable_cpu_pinning', sa.Boolean(), 34 | nullable=False, default=sa.sql.false(), 35 | server_default=sa.sql.false())) 36 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/238f94009eab_add_disk_quota_supported_to_compute_node.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | """add disk_quota_supported to compute_node 14 | 15 | Revision ID: 238f94009eab 16 | Revises: 372433c0afd2 17 | Create Date: 2018-04-01 18:46:29.977789 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = '238f94009eab' 23 | down_revision = '372433c0afd2' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | 31 | def upgrade(): 32 | op.add_column('compute_node', 33 | sa.Column('disk_quota_supported', sa.Boolean(), 34 | nullable=False, default=sa.sql.false(), 35 | server_default=sa.sql.false())) 36 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/271c7f45982d_add_started_at_to_container.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | """add started_at to containers 14 | 15 | Revision ID: 271c7f45982d 16 | Revises: cff60402dd86 17 | Create Date: 2018-05-03 11:27:00.722445 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = '271c7f45982d' 23 | down_revision = 'cff60402dd86' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | 31 | def upgrade(): 32 | op.add_column('container', 33 | sa.Column('started_at', sa.DateTime(), 34 | nullable=True)) 35 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/2b129060baff_support_container_cpuset.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | 14 | """support cpuset 15 | 16 | Revision ID: 2b129060baff 17 | Revises: 33cdd98bb9b2 18 | Create Date: 2018-011-10 10:08:40.547664 19 | 20 | """ 21 | 22 | # revision identifiers, used by Alembic. 23 | revision = '2b129060baff' 24 | down_revision = '33cdd98bb9b2' 25 | branch_labels = None 26 | depends_on = None 27 | 28 | from alembic import op 29 | import sqlalchemy as sa 30 | 31 | from zun.db.sqlalchemy import models 32 | 33 | 34 | def upgrade(): 35 | op.add_column('container', 36 | sa.Column('cpu_policy', sa.String(length=255))) 37 | op.add_column('container', 38 | sa.Column('cpuset', models.JSONEncodedDict, nullable=True)) 39 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/2fb377a5a519_add_healthcheck_to_container.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | """add healthcheck to containers 14 | 15 | Revision ID: 2fb377a5a519 16 | Revises: 105626c4f972 17 | Create Date: 2018-05-03 11:27:00.722445 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = '2fb377a5a519' 23 | down_revision = '105626c4f972' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | import zun 30 | 31 | 32 | def upgrade(): 33 | with op.batch_alter_table('container', schema=None) as batch_op: 34 | batch_op.add_column(sa.Column( 35 | 'healthcheck', zun.db.sqlalchemy.models.JSONEncodedDict(), 36 | nullable=True)) 37 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/35cb52c5553f_rename_volume_id_to_cinder_volume_id_in_.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); 2 | # you may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | """rename volume_id to cinder_volume_id in volume_mapping 14 | 15 | Revision ID: 35cb52c5553f 16 | Revises: 54bcb75afb32 17 | Create Date: 2018-09-22 20:20:02.072979 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = '35cb52c5553f' 23 | down_revision = '54bcb75afb32' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | 31 | def upgrade(): 32 | op.alter_column( 33 | 'volume_mapping', 'volume_id', 34 | new_column_name='cinder_volume_id', 35 | type_=sa.String(36) 36 | ) 37 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/372433c0afd2_add_auto_heal_to_container.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 ARM Holdings 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | """add auto heal to container 16 | 17 | Revision ID: 372433c0afd2 18 | Revises: d0c606fdec3c 19 | Create Date: 2018-03-12 14:18:44.545951 20 | 21 | """ 22 | 23 | # revision identifiers, used by Alembic. 24 | revision = '372433c0afd2' 25 | down_revision = 'd0c606fdec3c' 26 | branch_labels = None 27 | depends_on = None 28 | 29 | from alembic import op 30 | import sqlalchemy as sa 31 | 32 | 33 | def upgrade(): 34 | # ### commands auto generated by Alembic - please adjust! ### 35 | with op.batch_alter_table('container', schema=None) as batch_op: 36 | batch_op.add_column(sa.Column('auto_heal', 37 | sa.Boolean(), nullable=True)) 38 | # ### end Alembic commands ### 39 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/3f49fa520409_add_availability_zone_to_service.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); 2 | # you may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | """add availability_zone to service 14 | 15 | Revision ID: 3f49fa520409 16 | Revises: 50829990c965 17 | Create Date: 2018-02-10 22:33:22.890723 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = '3f49fa520409' 23 | down_revision = '50829990c965' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | 31 | def upgrade(): 32 | op.add_column('zun_service', 33 | sa.Column('availability_zone', sa.String(255), 34 | nullable=True)) 35 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/43e1088c3389_add_image_pull_policy_column.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); 2 | # you may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | """add image_pull_policy column 14 | 15 | Revision ID: 43e1088c3389 16 | Revises: c5565cbaa3de 17 | Create Date: 2016-11-17 09:26:22.756296 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = '43e1088c3389' 23 | down_revision = 'c5565cbaa3de' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | 31 | def upgrade(): 32 | op.add_column('container', 33 | sa.Column('image_pull_policy', sa.Text(), 34 | nullable=True)) 35 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/47d79ffdc582_add_cni_metadata_to_container.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); 2 | # you may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | """add cni_metadata to container 14 | 15 | Revision ID: 47d79ffdc582 16 | Revises: c2052ead4f95 17 | Create Date: 2019-12-30 17:40:10.199545 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = '47d79ffdc582' 23 | down_revision = 'c2052ead4f95' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | 31 | def MediumText(): 32 | return sa.Text().with_variant(sa.dialects.mysql.MEDIUMTEXT(), 'mysql') 33 | 34 | 35 | def upgrade(): 36 | op.add_column('container', 37 | sa.Column('cni_metadata', MediumText(), nullable=True)) 38 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/4a0c4f7a4a33_add_meta_addresses_to_container.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | """add meta addresses to container 14 | 15 | Revision ID: 4a0c4f7a4a33 16 | Revises: 43e1088c3389 17 | Create Date: 2016-11-20 12:18:44.086036 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = '4a0c4f7a4a33' 23 | down_revision = '43e1088c3389' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | from zun.db.sqlalchemy import models 31 | 32 | 33 | def upgrade(): 34 | op.add_column('container', 35 | sa.Column('meta', models.JSONEncodedDict(), 36 | nullable=True)) 37 | op.add_column('container', 38 | sa.Column('addresses', models.JSONEncodedDict(), 39 | nullable=True)) 40 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/531e4a890480_add_host_to_container.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); 2 | # you may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | """add host to container 14 | 15 | Revision ID: 531e4a890480 16 | Revises: 4a0c4f7a4a33 17 | Create Date: 2017-01-01 11:20:14.964792 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = '531e4a890480' 23 | down_revision = '4a0c4f7a4a33' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | 31 | def upgrade(): 32 | op.add_column('container', 33 | sa.Column('host', sa.String(length=255), 34 | nullable=True)) 35 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/5359d23b2322_add_websocket_url_and_websocket_token.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | """add websocket_url and websocket_token 14 | 15 | Revision ID: 5359d23b2322 16 | Revises: 17ab8b533cc8 17 | Create Date: 2017-05-03 15:54:26.194603 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = '5359d23b2322' 23 | down_revision = '17ab8b533cc8' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | 31 | def upgrade(): 32 | op.add_column('container', 33 | sa.Column('websocket_url', sa.String(length=255), 34 | nullable=True)) 35 | op.add_column('container', 36 | sa.Column('websocket_token', sa.String(length=255), 37 | nullable=True)) 38 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/53a8b515057e_add_memory_info_to_compute_node.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | """Add memory info to compute node 14 | 15 | Revision ID: 53a8b515057e 16 | Revises: eeac0d191f5a 17 | Create Date: 2017-04-13 10:12:41.088202 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = '53a8b515057e' 23 | down_revision = 'eeac0d191f5a' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | 31 | def upgrade(): 32 | op.add_column('compute_node', 33 | sa.Column('mem_total', sa.Integer(), nullable=False)) 34 | op.add_column('compute_node', 35 | sa.Column('mem_free', sa.Integer(), nullable=False)) 36 | op.add_column('compute_node', 37 | sa.Column('mem_available', sa.Integer(), nullable=False)) 38 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/5458f8394206_add_image_driver_field.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | 14 | """add image driver field 15 | 16 | Revision ID: 5458f8394206 17 | Revises: d1ef05fd92c8 18 | Create Date: 2017-01-25 19:01:46.033461 19 | 20 | """ 21 | 22 | # revision identifiers, used by Alembic. 23 | revision = '5458f8394206' 24 | down_revision = 'd1ef05fd92c8' 25 | branch_labels = None 26 | depends_on = None 27 | 28 | from alembic import op 29 | import sqlalchemy as sa 30 | 31 | 32 | def upgrade(): 33 | op.add_column('container', 34 | sa.Column('image_driver', sa.Text(), 35 | nullable=True)) 36 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/54bcb75afb32_add_init_containers_uuids_to_capsule.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | """Add init containers uuids to capsule 14 | 15 | Revision ID: 54bcb75afb32 16 | Revises: 02134de8e7d3 17 | Create Date: 2018-08-14 15:47:49.127773 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = '54bcb75afb32' 23 | down_revision = '02134de8e7d3' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | from zun.db.sqlalchemy import models 31 | 32 | 33 | def upgrade(): 34 | op.add_column('capsule', sa.Column('init_containers_uuids', 35 | models.JSONEncodedList(), 36 | nullable=True)) 37 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/5971a6844738_add_container_id_column_to_container.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | """add container_id column to container 14 | 15 | Revision ID: 5971a6844738 16 | Revises: 9fe371393a24 17 | Create Date: 2016-08-05 17:38:05.231740 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = '5971a6844738' 23 | down_revision = '9fe371393a24' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | 31 | def upgrade(): 32 | op.add_column('container', 33 | sa.Column('container_id', sa.String(length=255), 34 | nullable=True)) 35 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/63a08e32cc43_add_task_state_to_container.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | 14 | """add task state to container 15 | 16 | Revision ID: 63a08e32cc43 17 | Revises: 93fbb05b77b9 18 | Create Date: 2016-08-14 20:10:04.038358 19 | 20 | """ 21 | 22 | # revision identifiers, used by Alembic. 23 | revision = '63a08e32cc43' 24 | down_revision = '93fbb05b77b9' 25 | branch_labels = None 26 | depends_on = None 27 | 28 | from alembic import op 29 | import sqlalchemy as sa 30 | 31 | 32 | def upgrade(): 33 | op.add_column('container', 34 | sa.Column('task_state', sa.String(length=20), 35 | nullable=True)) 36 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/648c25faa0be_add_mem_used_to_compute_node.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | """add mem used to compute node 14 | 15 | Revision ID: 648c25faa0be 16 | Revises: 174cafda0857 17 | Create Date: 2017-05-24 09:39:42.021441 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = '648c25faa0be' 23 | down_revision = '174cafda0857' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | 31 | def upgrade(): 32 | op.add_column('compute_node', 33 | sa.Column('mem_used', sa.Integer(), nullable=False)) 34 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/6ff4d35f4334_change_property_of_restart_policy_in_.py: -------------------------------------------------------------------------------- 1 | # Copyright 2018 Arm Limited. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | """change properties of restart policy in capsule 16 | 17 | Revision ID: 6ff4d35f4334 18 | Revises: d9714eadbdc2 19 | Create Date: 2018-01-26 17:19:59.564188 20 | 21 | """ 22 | 23 | # revision identifiers, used by Alembic. 24 | revision = '6ff4d35f4334' 25 | down_revision = 'd9714eadbdc2' 26 | branch_labels = None 27 | depends_on = None 28 | 29 | from alembic import op 30 | 31 | import sqlalchemy as sa 32 | 33 | 34 | def upgrade(): 35 | op.alter_column('capsule', 'restart_policy', 36 | type_=sa.String(length=255) 37 | ) 38 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/74c97dca93d0_add_missing_index_and_foreign_key.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); 2 | # you may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | """add-missing-index-and-foreign-key 14 | 15 | Revision ID: 74c97dca93d0 16 | Revises: 47d79ffdc582 17 | Create Date: 2020-03-27 02:51:30.959226 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = '74c97dca93d0' 23 | down_revision = '47d79ffdc582' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | 29 | 30 | def upgrade(): 31 | # ### commands auto generated by Alembic - please adjust! ### 32 | with op.batch_alter_table('container', schema=None) as batch_op: 33 | batch_op.create_foreign_key( 34 | None, 'container', ['capsule_id'], ['id'], ondelete='CASCADE') 35 | # ### end Alembic commands ### 36 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/75315e219cfb_add_auto_remove_to_container.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | """Add auto_remove to container 14 | 15 | Revision ID: 75315e219cfb 16 | Revises: 648c25faa0be 17 | Create Date: 2017-06-30 22:10:22.261595 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = '75315e219cfb' 23 | down_revision = '648c25faa0be' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | 31 | def upgrade(): 32 | op.add_column('container', 33 | sa.Column('auto_remove', sa.Boolean(), 34 | nullable=True)) 35 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/8192905fd835_add_uuid_to_resource_class.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); 2 | # you may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | """add uuid_to_resource_class 14 | 15 | Revision ID: 8192905fd835 16 | Revises: e4d145e195f4 17 | Create Date: 2017-02-24 07:00:22.344162 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = '8192905fd835' 23 | down_revision = 'e4d145e195f4' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | 31 | def upgrade(): 32 | op.add_column('resource_class', 33 | sa.Column('uuid', sa.String(length=36), nullable=False)) 34 | op.create_unique_constraint('uniq_resource_class0uuid', 35 | 'resource_class', ['uuid']) 36 | op.drop_index('uniq_container0name', table_name='resource_class') 37 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/8c3d80e18eb5_add_container_cpus_cpu_used_to_compute_.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); 2 | # you may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | 14 | """Add container cpus,cpu_used to compute node 15 | 16 | Revision ID: 8c3d80e18eb5 17 | Revises: ce9944b346cb 18 | Create Date: 2017-04-25 09:26:02.374222 19 | 20 | """ 21 | 22 | # revision identifiers, used by Alembic. 23 | revision = '8c3d80e18eb5' 24 | down_revision = 'ce9944b346cb' 25 | branch_labels = None 26 | depends_on = None 27 | 28 | from alembic import op 29 | import sqlalchemy as sa 30 | 31 | 32 | def upgrade(): 33 | op.add_column('compute_node', 34 | sa.Column('cpus', sa.Integer(), nullable=False)) 35 | op.add_column('compute_node', 36 | sa.Column('cpu_used', sa.Float(), nullable=False)) 37 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/93fbb05b77b9_add_memory_field_to_container.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); 2 | # you may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | 14 | """add memory field to container 15 | 16 | Revision ID: 93fbb05b77b9 17 | Revises: 5971a6844738 18 | Create Date: 2016-08-05 19:03:03.764296 19 | 20 | """ 21 | 22 | # revision identifiers, used by Alembic. 23 | revision = '93fbb05b77b9' 24 | down_revision = '5971a6844738' 25 | branch_labels = None 26 | depends_on = None 27 | 28 | from alembic import op 29 | import sqlalchemy as sa 30 | 31 | 32 | def upgrade(): 33 | op.add_column('container', 34 | sa.Column('memory', sa.String(length=255), 35 | nullable=True)) 36 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/945569b3669f_add_runtime_column.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); 2 | # you may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | """add runtime column 14 | 15 | Revision ID: 945569b3669f 16 | Revises: a251f1f61217 17 | Create Date: 2017-08-04 09:10:47.810568 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = '945569b3669f' 23 | down_revision = 'a251f1f61217' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | 31 | def upgrade(): 32 | op.add_column('container', 33 | sa.Column('runtime', sa.String(32), nullable=True)) 34 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/ad43a2179cf2_add_status_detail.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); 2 | # you may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | 14 | """add_status_detail 15 | 16 | Revision ID: ad43a2179cf2 17 | Revises: bbcfa910a8a5 18 | Create Date: 2017-01-17 03:14:50.739446 19 | 20 | """ 21 | 22 | # revision identifiers, used by Alembic. 23 | revision = 'ad43a2179cf2' 24 | down_revision = 'bbcfa910a8a5' 25 | branch_labels = None 26 | depends_on = None 27 | 28 | from alembic import op 29 | import sqlalchemy as sa 30 | 31 | 32 | def upgrade(): 33 | op.add_column('container', sa.Column('status_detail', 34 | sa.String(length=50), nullable=True)) 35 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/b2bda272f4dd_add_tty_to_container.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | """add tty to container 14 | 15 | Revision ID: b2bda272f4dd 16 | Revises: 157a0595e13e 17 | Create Date: 2019-06-23 21:22:18.324322 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = 'b2bda272f4dd' 23 | down_revision = '157a0595e13e' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | 31 | def upgrade(): 32 | op.add_column('container', 33 | sa.Column('tty', sa.Boolean(), nullable=True)) 34 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/bbcfa910a8a5_add_restart_policy_column.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); 2 | # you may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | """add_restart_policy_column 14 | 15 | Revision ID: bbcfa910a8a5 16 | Revises: 531e4a890480 17 | Create Date: 2017-01-10 15:10:02.746131 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = 'bbcfa910a8a5' 23 | down_revision = '531e4a890480' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | import zun 31 | 32 | 33 | def upgrade(): 34 | op.add_column('container', 35 | sa.Column('restart_policy', 36 | zun.db.sqlalchemy.models.JSONEncodedDict(), 37 | nullable=True)) 38 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/bc56b9932dd9_add_runtime_to_compute_node.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | 14 | """add runtime to compute node 15 | 16 | Revision ID: bc56b9932dd9 17 | Revises: f746cd28bcac 18 | Create Date: 2018-08-06 18:30:43.890410 19 | 20 | """ 21 | 22 | # revision identifiers, used by Alembic. 23 | revision = 'bc56b9932dd9' 24 | down_revision = 'f746cd28bcac' 25 | branch_labels = None 26 | depends_on = None 27 | 28 | from alembic import op 29 | import sqlalchemy as sa 30 | 31 | import zun 32 | 33 | 34 | def upgrade(): 35 | op.add_column('compute_node', 36 | sa.Column('runtimes', 37 | zun.db.sqlalchemy.models.JSONEncodedList(), 38 | nullable=True)) 39 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/bcd6410d645e_add_host_to_capsule.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Arm Limited 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | """add host to capsule 16 | 17 | Revision ID: bcd6410d645e 18 | Revises: 37bce72463e3 19 | Create Date: 2017-09-20 17:23:49.346283 20 | 21 | """ 22 | 23 | # revision identifiers, used by Alembic. 24 | revision = 'bcd6410d645e' 25 | down_revision = '37bce72463e3' 26 | branch_labels = None 27 | depends_on = None 28 | 29 | from alembic import op 30 | import sqlalchemy as sa 31 | 32 | 33 | def upgrade(): 34 | op.add_column('capsule', 35 | sa.Column('host', sa.String(length=255), 36 | nullable=True)) 37 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/c2052ead4f95_remove_meta_from_container.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | """remove meta from container 14 | 15 | Revision ID: c2052ead4f95 16 | Revises: df87dbd4846c 17 | Create Date: 2019-12-30 17:11:48.838977 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = 'c2052ead4f95' 23 | down_revision = 'df87dbd4846c' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | 29 | 30 | def upgrade(): 31 | op.drop_column('container', 'meta') 32 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/c5565cbaa3de_insert_status_reason_to_container_table.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); 2 | # you may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | 14 | """Insert status_reason to Container table 15 | 16 | Revision ID: c5565cbaa3de 17 | Revises: 72c6947c6636 18 | Create Date: 2016-10-28 06:51:12.146721 19 | 20 | """ 21 | 22 | # revision identifiers, used by Alembic. 23 | revision = 'c5565cbaa3de' 24 | down_revision = '72c6947c6636' 25 | branch_labels = None 26 | depends_on = None 27 | 28 | from alembic import op 29 | import sqlalchemy as sa 30 | 31 | 32 | def upgrade(): 33 | op.add_column('container', 34 | sa.Column('status_reason', sa.Text(), 35 | nullable=True)) 36 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/ce9944b346cb_combine_tty_and_stdin_open.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); 2 | # you may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | """combine tty and stdin_open 14 | 15 | Revision ID: ce9944b346cb 16 | Revises: 4bf34495d060 17 | Create Date: 2017-04-21 12:24:50.201662 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = 'ce9944b346cb' 23 | down_revision = '4bf34495d060' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | 31 | def upgrade(): 32 | with op.batch_alter_table('container', schema=None) as batch_op: 33 | batch_op.add_column(sa.Column('interactive', sa.Boolean(), 34 | nullable=True)) 35 | batch_op.drop_column('tty') 36 | batch_op.drop_column('stdin_open') 37 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/cff60402dd86_add_capsule_id_to_containers.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | """add capsule_id to containers 14 | 15 | Revision ID: cff60402dd86 16 | Revises: 2b045cb595db 17 | Create Date: 2018-04-29 21:27:00.722445 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = 'cff60402dd86' 23 | down_revision = '2b045cb595db' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | 31 | def upgrade(): 32 | op.add_column('container', 33 | sa.Column('capsule_id', sa.Integer(), 34 | nullable=True)) 35 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/d0c606fdec3c_add_disk_info_to_compute_node.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); 2 | # you may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | """add disk total and used to compute node 14 | 15 | Revision ID: d0c606fdec3c 16 | Revises: 3f49fa520409 17 | Create Date: 2018-03-06 18:44:27.630273 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = 'd0c606fdec3c' 23 | down_revision = '3f49fa520409' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | 31 | def upgrade(): 32 | with op.batch_alter_table('compute_node', schema=None) as batch_op: 33 | batch_op.add_column(sa.Column('disk_total', 34 | sa.Integer(), nullable=False)) 35 | batch_op.add_column(sa.Column('disk_used', 36 | sa.Integer(), nullable=False)) 37 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/d1ef05fd92c8_add_tty_stdin_open.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); 2 | # you may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | """add tty stdin_open 14 | 15 | Revision ID: d1ef05fd92c8 16 | Revises: ad43a2179cf2 17 | Create Date: 2016-11-09 09:40:59.839380 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = 'd1ef05fd92c8' 23 | down_revision = 'ad43a2179cf2' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | 31 | def upgrade(): 32 | op.add_column('container', 33 | sa.Column('tty', sa.Boolean, 34 | nullable=True)) 35 | op.add_column('container', 36 | sa.Column('stdin_open', sa.Boolean, 37 | nullable=True)) 38 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/d2affd5b4172_add_auto_remove_to_volume_mapping.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 ARM Limited 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | # revision identifiers, used by Alembic. 16 | revision = 'd2affd5b4172' 17 | down_revision = 'f046346d1d87' 18 | branch_labels = None 19 | depends_on = None 20 | 21 | from alembic import op 22 | import sqlalchemy as sa 23 | 24 | 25 | def upgrade(): 26 | op.add_column('volume_mapping', 27 | sa.Column('auto_remove', sa.Boolean, nullable=True)) 28 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/d73b72ab7cc6_add_container_type_to_container.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); 2 | # you may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 10 | # implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | """add container_type to container 15 | 16 | Revision ID: d73b72ab7cc6 17 | Revises: 1bc34e18180b 18 | Create Date: 2019-02-12 04:34:30.993517 19 | 20 | """ 21 | 22 | # revision identifiers, used by Alembic. 23 | revision = 'd73b72ab7cc6' 24 | down_revision = '1bc34e18180b' 25 | branch_labels = None 26 | depends_on = None 27 | 28 | from alembic import op 29 | import sqlalchemy as sa 30 | 31 | from zun.common import consts 32 | 33 | 34 | def upgrade(): 35 | op.add_column('container', 36 | sa.Column('container_type', sa.Integer(), index=True, 37 | default=consts.TYPE_CONTAINER, 38 | server_default=str(consts.TYPE_CONTAINER))) 39 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/d9714eadbdc2_add_disk_to_container.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); 2 | # you may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | """add disk to container 14 | 15 | Revision ID: d9714eadbdc2 16 | Revises: 71f8b4cf1dbf 17 | Create Date: 2018-01-30 13:47:11.871600 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = 'd9714eadbdc2' 23 | down_revision = '71f8b4cf1dbf' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | 31 | def upgrade(): 32 | with op.batch_alter_table('container', schema=None) as batch_op: 33 | batch_op.add_column(sa.Column('disk', sa.Integer(), nullable=True)) 34 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/df87dbd4846c_add_annotations_to_container.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); 2 | # you may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | """add annotations to container 14 | 15 | Revision ID: df87dbd4846c 16 | Revises: d502ce8fb705 17 | Create Date: 2019-12-21 16:47:11.503444 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = 'df87dbd4846c' 23 | down_revision = 'd502ce8fb705' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | 31 | def MediumText(): 32 | return sa.Text().with_variant(sa.dialects.mysql.MEDIUMTEXT(), 'mysql') 33 | 34 | 35 | def upgrade(): 36 | op.add_column('container', 37 | sa.Column('annotations', MediumText(), nullable=True)) 38 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/f746cd28bcac_add_host_to_volume_mapping.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | 14 | """add host to volume mapping 15 | 16 | Revision ID: f746cd28bcac 17 | Revises: 2fb377a5a519 18 | Create Date: 2018-08-03 10:53:45.920787 19 | 20 | """ 21 | 22 | # revision identifiers, used by Alembic. 23 | revision = 'f746cd28bcac' 24 | down_revision = '2fb377a5a519' 25 | branch_labels = None 26 | depends_on = None 27 | 28 | from alembic import op 29 | import sqlalchemy as sa 30 | 31 | 32 | def upgrade(): 33 | op.add_column('volume_mapping', 34 | sa.Column('host', sa.String(length=255), nullable=True)) 35 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/fc27c7415d9c_change_the_properties_of_meta_labels.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Arm Limited. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | """change the properties of meta_labels 16 | 17 | Revision ID: fc27c7415d9c 18 | Revises: bcd6410d645e 19 | Create Date: 2017-09-07 10:56:07.489031 20 | 21 | """ 22 | 23 | # revision identifiers, used by Alembic. 24 | revision = 'fc27c7415d9c' 25 | down_revision = 'bcd6410d645e' 26 | branch_labels = None 27 | depends_on = None 28 | 29 | from alembic import op 30 | 31 | import zun 32 | 33 | 34 | def upgrade(): 35 | op.alter_column('capsule', 'meta_labels', 36 | type_=zun.db.sqlalchemy.models.JSONEncodedDict() 37 | ) 38 | -------------------------------------------------------------------------------- /zun/db/sqlalchemy/alembic/versions/ff7b9665d504_add_pci_stats_to_compute_node.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); 2 | # you may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | """add pci stats to compute node 14 | 15 | Revision ID: ff7b9665d504 16 | Revises: fc27c7415d9c 17 | Create Date: 2017-09-26 13:49:11.470002 18 | 19 | """ 20 | 21 | # revision identifiers, used by Alembic. 22 | revision = 'ff7b9665d504' 23 | down_revision = 'fc27c7415d9c' 24 | branch_labels = None 25 | depends_on = None 26 | 27 | from alembic import op 28 | import sqlalchemy as sa 29 | 30 | 31 | def upgrade(): 32 | op.add_column('compute_node', 33 | sa.Column('pci_stats', sa.Text())) 34 | -------------------------------------------------------------------------------- /zun/hacking/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/hacking/__init__.py -------------------------------------------------------------------------------- /zun/image/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/image/__init__.py -------------------------------------------------------------------------------- /zun/image/docker/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/image/docker/__init__.py -------------------------------------------------------------------------------- /zun/image/glance/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/image/glance/__init__.py -------------------------------------------------------------------------------- /zun/network/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/network/__init__.py -------------------------------------------------------------------------------- /zun/pci/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/pci/__init__.py -------------------------------------------------------------------------------- /zun/pci/request.py: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Intel Corporation 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | from zun.network import model as network_model 17 | from zun.objects import fields as obj_fields 18 | 19 | PCI_NET_TAG = 'physical_network' 20 | PCI_DEVICE_TYPE_TAG = 'dev_type' 21 | 22 | DEVICE_TYPE_FOR_VNIC_TYPE = { 23 | network_model.VNIC_TYPE_DIRECT_PHYSICAL: obj_fields.PciDeviceType.SRIOV_PF 24 | } 25 | -------------------------------------------------------------------------------- /zun/scheduler/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/scheduler/__init__.py -------------------------------------------------------------------------------- /zun/scheduler/client/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/scheduler/client/__init__.py -------------------------------------------------------------------------------- /zun/servicegroup/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/servicegroup/__init__.py -------------------------------------------------------------------------------- /zun/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/__init__.py -------------------------------------------------------------------------------- /zun/tests/fullstack/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/fullstack/__init__.py -------------------------------------------------------------------------------- /zun/tests/migration/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/migration/__init__.py -------------------------------------------------------------------------------- /zun/tests/policy_fixture.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | import fixtures 14 | from oslo_policy import _parser 15 | from oslo_policy import opts as policy_opts 16 | 17 | from zun.common import policy as zun_policy 18 | import zun.conf 19 | 20 | 21 | CONF = zun.conf.CONF 22 | 23 | 24 | class PolicyFixture(fixtures.Fixture): 25 | 26 | def _setUp(self): 27 | CONF(args=[], project='zun') 28 | policy_opts.set_defaults(CONF) 29 | zun_policy._ENFORCER = None 30 | self.addCleanup(zun_policy.init().clear) 31 | 32 | def set_rules(self, rules): 33 | policy = zun_policy._ENFORCER 34 | policy.set_rules({k: _parser.parse_rule(v) 35 | for k, v in rules.items()}) 36 | -------------------------------------------------------------------------------- /zun/tests/unit/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/unit/__init__.py -------------------------------------------------------------------------------- /zun/tests/unit/api/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/unit/api/__init__.py -------------------------------------------------------------------------------- /zun/tests/unit/api/controllers/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/unit/api/controllers/__init__.py -------------------------------------------------------------------------------- /zun/tests/unit/api/controllers/auth-paste.ini: -------------------------------------------------------------------------------- 1 | [pipeline:main] 2 | pipeline = cors request_id authtoken api_v1 3 | 4 | [app:api_v1] 5 | paste.app_factory = zun.api.app:app_factory 6 | 7 | [filter:authtoken] 8 | paste.filter_factory = zun.api.middleware.auth_token:AuthTokenMiddleware.factory 9 | 10 | [filter:request_id] 11 | paste.filter_factory = oslo_middleware:RequestId.factory 12 | 13 | [filter:cors] 14 | paste.filter_factory = oslo_middleware.cors:filter_factory 15 | oslo_config_project = zun 16 | -------------------------------------------------------------------------------- /zun/tests/unit/api/controllers/auth-root-access.ini: -------------------------------------------------------------------------------- 1 | [pipeline:main] 2 | pipeline = cors request_id authtoken api_v1 3 | 4 | [app:api_v1] 5 | paste.app_factory = zun.api.app:app_factory 6 | 7 | [filter:authtoken] 8 | acl_public_routes = / 9 | paste.filter_factory = zun.api.middleware.auth_token:AuthTokenMiddleware.factory 10 | 11 | [filter:request_id] 12 | paste.filter_factory = oslo_middleware:RequestId.factory 13 | 14 | [filter:cors] 15 | paste.filter_factory = oslo_middleware.cors:filter_factory 16 | oslo_config_project = zun 17 | -------------------------------------------------------------------------------- /zun/tests/unit/api/controllers/auth-v1-access.ini: -------------------------------------------------------------------------------- 1 | [pipeline:main] 2 | pipeline = cors request_id authtoken api_v1 3 | 4 | [app:api_v1] 5 | paste.app_factory = zun.api.app:app_factory 6 | 7 | [filter:authtoken] 8 | acl_public_routes = /v1 9 | paste.filter_factory = zun.api.middleware.auth_token:AuthTokenMiddleware.factory 10 | 11 | [filter:request_id] 12 | paste.filter_factory = oslo_middleware:RequestId.factory 13 | 14 | [filter:cors] 15 | paste.filter_factory = oslo_middleware.cors:filter_factory 16 | oslo_config_project = zun 17 | -------------------------------------------------------------------------------- /zun/tests/unit/api/controllers/noauth-paste.ini: -------------------------------------------------------------------------------- 1 | [pipeline:main] 2 | pipeline = cors request_id api_v1 3 | 4 | [app:api_v1] 5 | paste.app_factory = zun.api.app:app_factory 6 | 7 | [filter:authtoken] 8 | acl_public_routes = / 9 | paste.filter_factory = zun.api.middleware.auth_token:AuthTokenMiddleware.factory 10 | 11 | [filter:request_id] 12 | paste.filter_factory = oslo_middleware:RequestId.factory 13 | 14 | [filter:cors] 15 | paste.filter_factory = oslo_middleware.cors:filter_factory 16 | oslo_config_project = zun 17 | -------------------------------------------------------------------------------- /zun/tests/unit/api/controllers/test_link.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | import collections 14 | 15 | from zun.api.controllers import link as link_module 16 | from zun.tests import base as test_base 17 | 18 | 19 | class TestLink(test_base.BaseTestCase): 20 | 21 | def test_make_link(self): 22 | link = link_module.make_link( 23 | 'self', 'http://localhost:8080', 'v1', '', 24 | bookmark=True) 25 | 26 | ordered_link = collections.OrderedDict(sorted(link.items())) 27 | expected_value = collections.OrderedDict([ 28 | ('href', 'http://localhost:8080/v1/'), 29 | ('rel', 'self') 30 | ]) 31 | self.assertEqual(str(expected_value), 32 | str(ordered_link)) 33 | -------------------------------------------------------------------------------- /zun/tests/unit/api/controllers/v1/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/unit/api/controllers/v1/__init__.py -------------------------------------------------------------------------------- /zun/tests/unit/cmd/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/unit/cmd/__init__.py -------------------------------------------------------------------------------- /zun/tests/unit/common/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/unit/common/__init__.py -------------------------------------------------------------------------------- /zun/tests/unit/common/docker_image/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/unit/common/docker_image/__init__.py -------------------------------------------------------------------------------- /zun/tests/unit/compute/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/unit/compute/__init__.py -------------------------------------------------------------------------------- /zun/tests/unit/conf/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/unit/conf/__init__.py -------------------------------------------------------------------------------- /zun/tests/unit/container/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/unit/container/__init__.py -------------------------------------------------------------------------------- /zun/tests/unit/container/base.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | import zun.conf 14 | from zun.db import api as db_api 15 | from zun.db.sqlalchemy import api as sqla_api 16 | from zun.db.sqlalchemy import migration 17 | from zun.tests import base 18 | from zun.tests.unit.db.base import Database 19 | 20 | CONF = zun.conf.CONF 21 | 22 | _DB_CACHE = None 23 | 24 | 25 | class DriverTestCase(base.TestCase): 26 | def setUp(self): 27 | super(DriverTestCase, self).setUp() 28 | self.dbapi = db_api._get_dbdriver_instance() 29 | 30 | global _DB_CACHE 31 | if not _DB_CACHE: 32 | _DB_CACHE = Database(sqla_api, migration, 33 | sql_connection=CONF.database.connection) 34 | self.useFixture(_DB_CACHE) 35 | -------------------------------------------------------------------------------- /zun/tests/unit/container/docker/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/unit/container/docker/__init__.py -------------------------------------------------------------------------------- /zun/tests/unit/container/os_capability/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/unit/container/os_capability/__init__.py -------------------------------------------------------------------------------- /zun/tests/unit/container/os_capability/linux/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/unit/container/os_capability/linux/__init__.py -------------------------------------------------------------------------------- /zun/tests/unit/container/os_capability/linux/os_capability_linux/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/unit/container/os_capability/linux/os_capability_linux/__init__.py -------------------------------------------------------------------------------- /zun/tests/unit/db/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/unit/db/__init__.py -------------------------------------------------------------------------------- /zun/tests/unit/image/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/unit/image/__init__.py -------------------------------------------------------------------------------- /zun/tests/unit/image/docker/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/unit/image/docker/__init__.py -------------------------------------------------------------------------------- /zun/tests/unit/image/glance/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/unit/image/glance/__init__.py -------------------------------------------------------------------------------- /zun/tests/unit/network/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/unit/network/__init__.py -------------------------------------------------------------------------------- /zun/tests/unit/objects/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/unit/objects/__init__.py -------------------------------------------------------------------------------- /zun/tests/unit/pci/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/unit/pci/__init__.py -------------------------------------------------------------------------------- /zun/tests/unit/pci/fakes.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 OpenStack Foundation 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | import functools 17 | from unittest import mock 18 | 19 | 20 | from zun.pci import whitelist 21 | 22 | 23 | def fake_pci_whitelist(): 24 | devspec = mock.Mock() 25 | devspec.get_tags.return_value = None 26 | patcher = mock.patch.object(whitelist.Whitelist, 'get_devspec', 27 | return_value=devspec) 28 | patcher.start() 29 | return patcher 30 | 31 | 32 | def patch_pci_whitelist(f): 33 | @functools.wraps(f) 34 | def wrapper(self, *args, **kwargs): 35 | patcher = fake_pci_whitelist() 36 | f(self, *args, **kwargs) 37 | patcher.stop() 38 | return wrapper 39 | -------------------------------------------------------------------------------- /zun/tests/unit/scheduler/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/unit/scheduler/__init__.py -------------------------------------------------------------------------------- /zun/tests/unit/scheduler/client/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/unit/scheduler/client/__init__.py -------------------------------------------------------------------------------- /zun/tests/unit/scheduler/fake_loadables/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 OpenStack Foundation # All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | """ 15 | Fakes For Loadable class handling. 16 | """ 17 | 18 | from zun.scheduler import loadables 19 | 20 | 21 | class FakeLoadable(object): 22 | pass 23 | 24 | 25 | class FakeLoader(loadables.BaseLoader): 26 | def __init__(self): 27 | super(FakeLoader, self).__init__(FakeLoadable) 28 | -------------------------------------------------------------------------------- /zun/tests/unit/scheduler/fake_loadables/fake_loadable2.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 OpenStack Foundation # All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | """ 15 | Fake Loadable subclasses module #2 16 | """ 17 | 18 | from zun.tests.unit.scheduler import fake_loadables 19 | 20 | 21 | class FakeLoadableSubClass5(fake_loadables.FakeLoadable): 22 | pass 23 | 24 | 25 | class FakeLoadableSubClass6(fake_loadables.FakeLoadable): 26 | pass 27 | 28 | 29 | class _FakeLoadableSubClass7(fake_loadables.FakeLoadable): 30 | """Classes beginning with '_' will be ignored.""" 31 | pass 32 | 33 | 34 | class FakeLoadableSubClass8(BaseException): 35 | """Not a correct subclass.""" 36 | 37 | 38 | def return_valid_class(): 39 | return [FakeLoadableSubClass6] 40 | -------------------------------------------------------------------------------- /zun/tests/unit/scheduler/fakes.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | from zun.scheduler import driver 14 | from zun.scheduler import host_state 15 | 16 | 17 | class FakeScheduler(driver.Scheduler): 18 | 19 | def select_destinations(self, context, containers): 20 | return [] 21 | 22 | 23 | class FakeHostState(host_state.HostState): 24 | def __init__(self, host, attribute_dict=None): 25 | super(FakeHostState, self).__init__(host) 26 | if attribute_dict: 27 | for (key, val) in attribute_dict.items(): 28 | setattr(self, key, val) 29 | 30 | 31 | class FakeService(object): 32 | 33 | def __init__(self, name, host, disabled=False): 34 | self.name = name 35 | self.host = host 36 | self.disabled = disabled 37 | -------------------------------------------------------------------------------- /zun/tests/unit/scheduler/filters/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/unit/scheduler/filters/__init__.py -------------------------------------------------------------------------------- /zun/tests/unit/servicegroup/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/unit/servicegroup/__init__.py -------------------------------------------------------------------------------- /zun/tests/unit/test_zun.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | """ 16 | test_zun 17 | ---------------------------------- 18 | 19 | Tests for `zun` module. 20 | """ 21 | 22 | from zun.tests import base 23 | 24 | 25 | class TestZun(base.BaseTestCase): 26 | 27 | def test_something(self): 28 | pass 29 | -------------------------------------------------------------------------------- /zun/tests/unit/volume/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/tests/unit/volume/__init__.py -------------------------------------------------------------------------------- /zun/tests/uuidsentinel.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | import sys 14 | 15 | 16 | class UUIDSentinels(object): 17 | def __init__(self): 18 | from oslo_utils import uuidutils 19 | self._uuid_module = uuidutils 20 | self._sentinels = {} 21 | 22 | def __getattr__(self, name): 23 | if name.startswith('_'): 24 | raise ValueError('Sentinels must not start with _') 25 | if name not in self._sentinels: 26 | self._sentinels[name] = self._uuid_module.generate_uuid() 27 | return self._sentinels[name] 28 | 29 | 30 | sys.modules[__name__] = UUIDSentinels() 31 | -------------------------------------------------------------------------------- /zun/version.py: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 3 | # not use this file except in compliance with the License. You may obtain 4 | # a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 11 | # License for the specific language governing permissions and limitations 12 | # under the License. 13 | import pbr.version 14 | 15 | version_info = pbr.version.VersionInfo('zun') 16 | version_string = version_info.version_string 17 | -------------------------------------------------------------------------------- /zun/volume/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/volume/__init__.py -------------------------------------------------------------------------------- /zun/websocket/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/zun/eee3c483117e30e261951cbd4d58fdb8e4f5a832/zun/websocket/__init__.py --------------------------------------------------------------------------------