Skip to content
Snippets Groups Projects
Commit 3542c8a2 authored by Alberto Colla's avatar Alberto Colla
Browse files

Update README.md

parent 5d2466ac
No related branches found
No related tags found
No related merge requests found
Automatic Update of Glance Images
=================================
This script automates the process of updating images of operating systems in OpenStack.
### Currently the supported OS are:
- CentOS 7
- CentOS 8
- Debian 9
- Debian 10
- ~~Fedora 28~~
- ~~Fedora 29~~
- Fedora 30
- Fedora 31
- Ubuntu 16.04
- Ubuntu 18.04
Installation
------------
$ sudo apt install python3 python3-dev python3-pip -y
$ pip3 install --upgrade pip
$ pip3 install -r requirements.txt
$ git clone https://git.garr.it/cloud/admin/update-images.git
Usage
-----
Source the `admin` credentials to gain access to `OpenStack` commands:
$ source admin.rc
Execute the script
$ python3 update-images.py
### Execution example
$ python3 update-images.py
Download...
From: http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2
To: downloads/centos7-1505262668.qcow2
downloads/centos7-1505262668.qcow2: 100%|████| 855M/855M [05:08<00:00, 2.77MB/s]
Download...
From: https://cdimage.debian.org/cdimage/openstack/current-9/debian-9-openstack-amd64.qcow2
To: downloads/debian9-1507104230.qcow2
downloads/debian9-1507104230.qcow2: 585MB [00:32, 18.0MB/s]
Download...
From: https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-amd64-disk1.img
To: downloads/ubuntu-16.04-1505853444.qcow2
downloads/ubuntu-16.04-1505853444.qcow2: 100%|████| 291M/291M [03:31<00:00, 1.37MB/s]
Images are now present in OpenStack Glance.
This script uploads all the images as 'Public', accessible by all users.
### Update simplestreams
After updating the images, update the simplestreams catalog:
$ openstack object list simplestreams
$ openstack object save simplestreams images/streams/v1/com.ubuntu.cloud-released-imagemetadata.json --file com.ubuntu.cloud-released-imagemetadata_backup.json
$ openstack object save simplestreams images/streams/v1/index.json --file index_backup.json
$ python3 generate-files-for-simplestream.py
$ cd output/simplestreams
$ ls -lh images/streams/v1/
$ openstack object create simplestreams images/streams/v1/com.ubuntu.cloud-released-imagemetadata.json images/streams/v1/index.json
Pipeline
--------
1. Fetch from config.yaml the url
2. Download locally (in 'download' folder) the updated qcow2 of specified operating system
3. Upload the qcow2 image on glance using openstack-cli commands
Notes
-----
This script is tested on Ubuntu 16.04 x64
Automatic Update of Glance Images
=================================
This script automates the process of updating images of operating systems in OpenStack.
### Currently the supported OS are:
- CentOS 7
- CentOS 8
- Debian 9
- Debian 10
- Debian 11
- ~~Fedora 28~~
- ~~Fedora 29~~
- Fedora 30
- Fedora 31
- Ubuntu 16.04
- Ubuntu 18.04
- Ubuntu 20.04
Installation
------------
$ sudo apt install python3 python3-dev python3-pip -y
$ pip3 install --upgrade pip
$ pip3 install -r requirements.txt
$ git clone https://git.garr.it/cloud/admin/update-images.git
Usage
-----
Source the `admin` credentials to gain access to `OpenStack` commands:
$ source admin.rc
Execute the script
$ python3 update-images.py
### Execution example
$ python3 update-images.py
Download...
From: http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2
To: downloads/centos7-1505262668.qcow2
downloads/centos7-1505262668.qcow2: 100%|████| 855M/855M [05:08<00:00, 2.77MB/s]
Download...
From: https://cdimage.debian.org/cdimage/openstack/current-9/debian-9-openstack-amd64.qcow2
To: downloads/debian9-1507104230.qcow2
downloads/debian9-1507104230.qcow2: 585MB [00:32, 18.0MB/s]
Download...
From: https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-amd64-disk1.img
To: downloads/ubuntu-16.04-1505853444.qcow2
downloads/ubuntu-16.04-1505853444.qcow2: 100%|████| 291M/291M [03:31<00:00, 1.37MB/s]
Images are now present in OpenStack Glance.
This script uploads all the images as 'Public', accessible by all users.
### Update simplestreams
After updating the images, update the simplestreams catalog:
$ openstack object list simplestreams
$ openstack object save simplestreams images/streams/v1/com.ubuntu.cloud-released-imagemetadata.json --file com.ubuntu.cloud-released-imagemetadata_backup.json
$ openstack object save simplestreams images/streams/v1/index.json --file index_backup.json
$ python3 generate-files-for-simplestream.py
$ cd output/simplestreams
$ ls -lh images/streams/v1/
$ openstack object create simplestreams images/streams/v1/com.ubuntu.cloud-released-imagemetadata.json images/streams/v1/index.json
Pipeline
--------
1. Fetch from config.yaml the url
2. Download locally (in 'download' folder) the updated qcow2 of specified operating system
3. Upload the qcow2 image on glance using openstack-cli commands
Notes
-----
This script is tested on Ubuntu 16.04 x64
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment