File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/zone.cpython-310.pyc
o
�N�g� � @ s� d Z ddlZddlZddlZddlZddlmZ ddlm Z m
Z
ddlmZ
ddlmZ e�e�ZddiZd Zd
d� Zdd
� Zdd� Zdd� Zdd� Zd)dd�Zd*dd�Zd)dd�Zd+dd�Zd,dd�Zd)dd �Zd)d!d"�Z d#d$� Z!d-d%d&�Z"d'd(� Z#dS ).a�
Management of Solaris Zones
:maintainer: Jorge Schrauwen <sjorge@blackdot.be>
:maturity: new
:depends: salt.modules.zoneadm, salt.modules.zonecfg
:platform: solaris
.. versionadded:: 2017.7.0
Below are some examples of how to use this state.
Lets start with creating a zone and installing it.
.. code-block:: yaml
omipkg1_configuration:
zone.present:
- name: omipkg1
- brand: ipkg
- zonepath: /zones/omipkg1
- properties:
- autoboot: true
- ip-type: exclusive
- cpu-shares: 50
- resources:
- attr:
- name: owner
- value: Jorge Schrauwen
- type: string
- attr:
- name: description
- value: OmniOS ipkg zone for testing
- type: string
- capped-memory:
- physical: 64M
omipkg1_installation:
zone.installed:
- name: omipkg1
- require:
- zone: omipkg1_configuration
omipkg1_running:
zone.booted:
- name: omipkg1
- require:
- zone: omipkg1_installation
A zone without network access is not very useful. We could update
the zone.present state in the example above to add a network interface
or we could use a separate state for this.
.. code-block:: yaml
omipkg1_network:
zone.resource_present:
- name: omipkg1
- resource_type: net
- resource_selector_property: mac-addr
- resource_selector_value: "02:08:20:a2:a3:10"
- physical: znic1
- require:
- zone: omipkg1_configuration
Since this is a single tenant system having the owner attribute is pointless.
Let's remove that attribute.
.. note::
The following state run the omipkg1_configuration state will add it again!
If the entire configuration is managed it would be better to add resource_prune
and optionally the resource_selector_property properties to the resource.
.. code-block:: yaml
omipkg1_strip_owner:
zone.resource_present:
- name: omipkg1
- resource_type: attr
- resource_selector_property: name
- resource_selector_value: owner
- require:
- zone: omipkg1_configuration
Let's bump the zone's CPU shares a bit.
.. note::
The following state run the omipkg1_configuration state will set it to 50 again.
Update the entire zone configuration is managed you should update it there instead.
.. code-block:: yaml
omipkg1_more_cpu:
zone.property_present:
- name: omipkg1
- property: cpu-shares
- value: 100
Or we can remove the limit altogether!
.. note::
The following state run the omipkg1_configuration state will set it to 50 again.
Update the entire zone configuration is managed you should set the
property to None (nothing after the :) instead.
.. code-block:: yaml
omipkg1_no_cpu:
zone.property_absent:
- name: omipkg1
- property: cpu-shares
� N)�CommandExecutionError)�_parse_value�#_zonecfg_resource_default_selectors)�merge)�OrderedDict�import_�import�zonec C s"