Welcome to Lago’s documentation!¶
Releases¶
Release process¶
Versioning¶
For lago we use a similar approach to semantic versioning, that is:
X.Y[.Z]
For example:
0.1
1.2.123
2.0
2.0.1
Where:
Z
changes for each patch (number of patches sinceX.Y
tag)Y
changes from time to time, with milestones (arbitrary bump), only for backwards compatible changesX
changes if it’s a non-backwards compatible change or arbitrarily (we don’t likeY
getting too high, or big milestone reached, ...)
The source tree has tags with the X.Y
versions, that’s where the packaging
process gets them from.
On each X
or Y
change a new tag is created.
For now we have only one branch (master) and we will try to keep it that way as
long as possible, if at some point we have to support old versions, then we
will create a branch for each X
version in the form:
vX
For example:
v0
v1
RPM Versioning¶
The rpm versions differ from the generic version in that they have the
-release
suffix, that has the value:
- If not in a tagged commit:
version =
X.Y.Z-1.git_hash
(if it bothers anyone, we can drop the hash easily)
- If in a tagged commit:
version =
X.Y.Z-1
Where the -1
is the release for that rpm (usually will never change, only
when repackaging without any code change, something that is not so easy for us
but if there’s any external packagers is helpful for them)
Repository layout¶
Tree schema of the repository:
lago
├── stable <-- subdirs for each major version to avoid accidental
│ │ non-backwards compatible ugrade
│ │
│ ├── 0.0 <-- Contains any 0.* release for lago
│ │ ├── ChangeLog_0.0.txt
│ │ ├── rpm
│ │ │ ├── el6
│ │ │ ├── el7
│ │ │ ├── fc22
│ │ │ └── fc23
│ │ └── sources
│ ├── 1.0
│ │ ├── ChangeLog_1.0.txt
│ │ ├── rpm
│ │ │ ├── el6
│ │ │ ├── el7
│ │ │ ├── fc22
│ │ │ └── fc23
│ │ └── sources
│ └── 2.0
│ ├── ChangeLog_2.0.txt
│ ├── rpm
│ │ ├── el6
│ │ ├── el7
│ │ ├── fc22
│ │ └── fc23
│ └── sources
└── unstable <-- Multiple subdirs are needed only if branching
├── 0.0 <-- Contains 0.* builds that might or might not have
│ │ been released
│ ├── latest <--- keeps the latest build from merged, static
│ │ url
│ ├── snapshot-lago_0.0_pipeline_1
│ ├── snapshot-lago_0.0_pipeline_2
│ │ ^ contains the rpms created on the pipeline build
│ │ number 2 for the 0.0 version, this is needed to
│ │ ease the automated testing of the rpms
│ │
│ └── ... <-- this is cleaned up from time to time to avoid
│ using too much space
├── 1.0
│ ├── latest
│ ├── snapshot-lago_1.0_pipeline_1
│ ├── snapshot-lago_pipeline_2
│ └── ...
└── 2.0
├── latest
├── snapshot-lago_2.0_pipeline_1
├── snapshot-lago_2.0_pipeline_2
└── ...
Promotion of artifacts to stable, aka. releasing¶
The goal is to have an automated set of tests, that check in depth lago, and run them in a timely fashion, and if passed, deploy to stable. As right now that’s not yet possible, so for now the tests and deploy is done manually.
The promotion of the artifacts is done in these cases:
- New major version bump (
X+1.0
, for example1.0 -> 2.0
)- New minor version bump (
X.Y+1
, for exampyre1.1 -> 1.2
)- If it passed certain time since the last
X
orY
version bumps (X.Y.Z+n
, for example1.0.1 -> 1.0.2
)- If there are blocking/important bugfixes (
X.Y.Z+n
)- If there are important new features (
X.Y+1
orX.Y.Z+n
)
The release procedure on the maintainer side¶
Select the snapshot repo you want to release
- Test the rpms, for now we only have the tests from projects that use it:
Run all the ovirt tests on it, make sure it does not break anything, if there are issues -> open bug
- Run vdsm functional tests, make sure it does not break anything, if
there are issues -> open bug
- On non-major version bump
X.Y+1
orX.Y.Z+n
- Create a changelog since the base of the tag and keep it aside
- On non-major version bump
- On Major version bump
X+1.0
- Create a changelog since the previous
.0
tag (X.0
) and keep it aside
- Create a changelog since the previous
- On Major version bump
Deploy the rpms from snapshot to dest repo and copy the
ChangeLog
from the tarball toChangeLog_X.0.txt
in the base of thestable/X.0/
dirSend email to lago-devel with the announcement and the changelog since the previous tag that you kept aside, feel free to change the body to your liking:
Subject: [day-month-year] New lago release - X.Y.Z Hi everyone! There's a new lago release with version X.Y.Z ready for you to upgrade! Here are the changes: <CHANGELOG HERE> Enjoy!
Contents¶
lago package¶
-
class
lago.
Prefix
(prefix)[source]¶ Bases:
object
A prefix is a directory that will contain all the data needed to setup the environment.
-
_prefix
¶ str
Path to the directory of this prefix
-
_paths
¶ lago.path.Paths
Path handler class
-
_virt_env
¶ lago.virt.VirtEnv
Lazily loaded virtual env handler
-
_metadata
¶ dict
Lazily loaded metadata
-
_add_nic_to_mapping
(net, dom, nic)[source]¶ Populates the given net spec mapping entry with the nicks of the given domain
Parameters: Returns: None
-
_allocate_ips_to_nics
(conf)[source]¶ For all the nics of all the domains in the conf that have dynamic ip, allocate one and addit to the network mapping
Parameters: conf (dict) – Configuration spec to extract the domains from Returns: None
-
_allocate_subnets
(conf)[source]¶ Allocate all the subnets needed by the given configuration spec
Parameters: conf (dict) – Configuration spec where to get the nets definitions from Returns: allocated subnets Return type: list
-
_check_predefined_subnets
(conf)[source]¶ Checks if all of the nets defined in the config are inside the allowed range, throws exception if not
Parameters: conf (dict) – Configuration spec where to get the nets definitions from Returns: None Raises: RuntimeError
– If there are any subnets out of the allowed range
-
_config_net_topology
(conf)[source]¶ Initialize and populate all the network related elements, like reserving ips and populating network specs of the given confiiguration spec
Parameters: conf (dict) – Configuration spec to initalize Returns: None
-
_create_disk
(name, spec, template_repo=None, template_store=None)[source]¶ Creates a disc with the given name from the given repo or store.
Parameters: Returns: Tuple – Path with the disk and metadata
Return type: str, dict
Raises: RuntimeError
– If the type of the disk is not supported or failed to create the disk
-
_create_paths
()[source]¶ Get the path handler for this instance
Returns: Path handler Return type: lago.paths.Paths
-
_create_ssh_keys
()[source]¶ Generate a pair of ssh keys for this prefix
Returns: None Raises: RuntimeError
– if it fails to create the keys
-
_create_virt_env
()[source]¶ Create a new virt env from this prefix
Returns: virt env created from this prefix Return type: lago.virt.VirtEnv
-
_get_metadata
()[source]¶ Retrieve the metadata info for this prefix
Returns: metadata info Return type: dict
-
_init_net_specs
(conf)[source]¶ Given a configuration specification, initializes all the net definitions in it so they can be used comfortably
Parameters: conf (dict) – Configuration specification Returns: None
-
_register_preallocated_ips
(conf)[source]¶ Parse all the domains in the given conf and preallocate all their ips into the networks mappings, raising exception on duplicated ips or ips out of the allowed ranges
See also
Parameters: conf (dict) – Configuration spec to parse Returns: None Raises: RuntimeError
– if there are any duplicated ips or any ip out of the allowed range
-
_use_prototype
(spec, conf)[source]¶ Populates the given spec with the values of it’s declared prototype
Parameters: Returns: updated spec
Return type:
-
cleanup
()[source]¶ Stops any running entities in the prefix and uninitializes it, usually you want to do this if you are going to remove the prefix afterwards
Returns: None
-
create_snapshots
(name)[source]¶ Creates one snapshot on all the domains with the given name
Parameters: name (str) – Name of the snapshots to create Returns: None
-
initialize
()[source]¶ Initialize this prefix, this includes creating the destination path, and creating the uuid for the prefix, for any other actions see
Prefix.virt_conf()
Will safely roll back if any of those steps fail
Returns: None Raises: RuntimeError
– If it fails to create the prefix dir
-
paths
¶ Access the path handler for this prefix
Returns: Path handler Return type: lago.paths.Paths
-
revert_snapshots
(name)[source]¶ Revert all the snapshots with the given name from all the domains
Parameters: name (str) – Name of the snapshots to revert Returns: None
-
virt_conf
(conf, template_repo=None, template_store=None)[source]¶ Initializes all the virt infrastructure of the prefix, creating the domains disks, doing any network leases and creating all the virt related files and dirs inside this prefix.
Parameters: - conf (dict) – Configuration spec
- template_repo (TemplateRepository) – template repository intance
- template_store (TemplateStore) – template store instance
Returns: None
-
virt_env
¶ Getter for this instance’s virt env, creates it if needed
Returns: virt env instance used by this prefix Return type: lago.virt.VirtEnv
-
-
lago.
_create_ip
(subnet, index)[source]¶ Given a subnet or an ip and an index returns the ip with that lower index from the subnet (255.255.255.0 mask only subnets)
Parameters: - subnet (str) – Strign containing the three first elements of the decimal representation of a subnet (X.Y.Z) or a full ip (X.Y.Z.A)
- index (int or str) – Last element of a decimal ip representation, for example, 123 for the ip 1.2.3.123
Returns: The dotted decimal representation of the ip
Return type:
-
lago.
_ip_in_subnet
(subnet, ip)[source]¶ Checks if an ip is included in a subnet.
Note
only 255.255.255.0 masks allowed
Parameters: - subnet (str) – Strign containing the three first elements of the decimal representation of a subnet (X.Y.Z) or a full ip (X.Y.Z.A)
- ip (str or int) – Decimal ip representation
Returns: True
if ip is in subnet,False
otherwiseReturn type:
Submodules¶
lago.brctl module¶
lago.config module¶
lago.constants module¶
lago.dirlock module¶
lago.subnet_lease module¶
Module that handles the leases for the subnets of the virtual network interfaces.
Note
Currently only /24 ranges are handled, and all of them under the 192.168.MIN_SUBNET to 192.168.MAX_SUBNET ranges
The leases are stored under LEASE_DIR
as json files with the form:
[
"/path/to/prefix/uuid/file",
"uuid_hash",
]
Where the uuid_hash is the 32 char uuid of the prefix (the contents of the uuid file at the time of doing the lease)
-
lago.subnet_lease.
LEASE_DIR
= '/var/lib/lago/subnets/'¶ Path to the directory where the net leases are stored
-
lago.subnet_lease.
LOCK_FILE
= '/var/lib/lago/subnets/leases.lock'¶ Path to the net leases lock
-
lago.subnet_lease.
MAX_SUBNET
= 209¶ Upper range for the allowed subnets
-
lago.subnet_lease.
MIN_SUBNET
= 200¶ Lower range for the allowed subnets
-
lago.subnet_lease.
_acquire
(*args, **kwargs)[source]¶ Lease a free network for the given uuid path
Parameters: uuid_path (str) – Path to the uuid file of a lago.Prefix
Returns: the third element of the dotted ip of the leased network or None
if no lease was availableReturn type: int or None Todo
Raise exception or something instead of returning None so the caller can handle the failure case
-
lago.subnet_lease.
_lease_owned
(path, current_uuid_path)[source]¶ Checks if the given lease is owned by the prefix whose uuid is in the given path
Note
The prefix must be also in the same path it was when it took the lease
Parameters: Returns: True
if the given lease in owned by the prefix,False
otherwiseReturn type:
-
lago.subnet_lease.
_lease_valid
(path)[source]¶ Checs if the given lease still has a prefix that owns it
Parameters: path (str) – Path to the lease Returns: True
if the uuid path in the lease still exists and is the same as the one in the leaseReturn type: bool
-
lago.subnet_lease.
_locked
(func)[source]¶ Decorator that will make sure that you have the exclusive lock for the leases
-
lago.subnet_lease.
_release
(*args, **kwargs)[source]¶ Free the lease of the given subnet index
Parameters: index (int) – Third element of a dotted ip representation of the subnet, for example, for 1.2.3.4 it would be 3 Returns: None
-
lago.subnet_lease.
_take_lease
(path, uuid_path)[source]¶ Persist to the given leases path the prefix uuid that’s in the uuid path passed
Parameters: Returns: None
-
lago.subnet_lease.
_validate_lease_dir_present
(func)[source]¶ Decorator that will ensure that the lease dir exists, creating it if necessary
-
lago.subnet_lease.
acquire
(uuid_path)[source]¶ Lease a free network for the given uuid path
Parameters: uuid_path (str) – Path to the uuid file of a lago.Prefix
Returns: the dotted ip of the gateway for the leased net Return type: str Todo
_aquire might return None, this will throw a TypeError
lago.sysprep module¶
lago.templates module¶
lago.utils module¶
-
class
lago.utils.
CommandStatus
[source]¶ Bases:
lago.utils.CommandStatus
-
class
lago.utils.
RollbackContext
(*args)[source]¶ Bases:
object
A context manager for recording and playing rollback. The first exception will be remembered and re-raised after rollback
Sample usage: > with RollbackContext() as rollback: > step1() > rollback.prependDefer(lambda: undo step1) > def undoStep2(arg): pass > step2() > rollback.prependDefer(undoStep2, arg)
More examples see tests/utilsTests.py @ vdsm code
-
lago.utils.
_CommandStatus
¶ alias of
CommandStatus
-
lago.utils.
drain_ssh_channel
(chan, stdin=None, stdout=<open file '<stdout>', mode 'w'>, stderr=<open file '<stderr>', mode 'w'>)[source]¶
-
lago.utils.
interactive_ssh_channel
(chan, command=None, stdin=<open file '<stdin>', mode 'r'>)[source]¶
lago.virt module¶
-
class
lago.virt.
BridgeNetwork
(env, spec)[source]¶ Bases:
lago.virt.Network
-
class
lago.virt.
NATNetwork
(env, spec)[source]¶ Bases:
lago.virt.Network
-
class
lago.virt.
VM
(env, spec)[source]¶ Bases:
object
VM properties: * name * cpus * memory * disks * metadata * network/mac addr
-
metadata
¶
-
-
class
lago.virt.
VirtEnv
(prefix, vm_specs, net_specs)[source]¶ Bases:
object
Env properties: * prefix * vms * net
- libvirt_con
-
libvirt_con
¶
-
class
lago.virt.
_SysVInitService
(vm, name)[source]¶ Bases:
lago.virt._Service
-
BIN_PATH
= '/sbin/service'¶
-
-
class
lago.virt.
_SystemdContainerService
(vm, name)[source]¶ Bases:
lago.virt._Service
-
BIN_PATH
= '/usr/bin/docker'¶
-
HOST_BIN_PATH
= '/usr/bin/systemctl'¶
-
-
class
lago.virt.
_SystemdService
(vm, name)[source]¶ Bases:
lago.virt._Service
-
BIN_PATH
= '/usr/bin/systemctl'¶
-