Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
update-images
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cloud
operations
update-images
Commits
3542c8a2
Commit
3542c8a2
authored
3 years ago
by
Alberto Colla
Browse files
Options
Downloads
Patches
Plain Diff
Update README.md
parent
5d2466ac
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+83
-81
83 additions, 81 deletions
README.md
with
83 additions
and
81 deletions
README.md
+
83
−
81
View file @
3542c8a2
Automatic Update of Glance Images
Automatic Update of Glance Images
=================================
=================================
This script automates the process of updating images of operating systems in OpenStack.
This script automates the process of updating images of operating systems in OpenStack.
### Currently the supported OS are:
### Currently the supported OS are:
-
CentOS 7
-
CentOS 7
-
CentOS 8
-
CentOS 8
-
Debian 9
-
Debian 9
-
Debian 10
-
Debian 10
-
~~Fedora 28~~
-
Debian 11
-
~~Fedora 29~~
-
~~Fedora 28~~
-
Fedora 30
-
~~Fedora 29~~
-
Fedora 31
-
Fedora 30
-
Ubuntu 16.04
-
Fedora 31
-
Ubuntu 18.04
-
Ubuntu 16.04
-
Ubuntu 18.04
Installation
-
Ubuntu 20.04
------------
Installation
$ sudo apt install python3 python3-dev python3-pip -y
------------
$ pip3 install --upgrade pip
$ pip3 install -r requirements.txt
$ sudo apt install python3 python3-dev python3-pip -y
$ git clone https://git.garr.it/cloud/admin/update-images.git
$ pip3 install --upgrade pip
$ pip3 install -r requirements.txt
Usage
$ 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
Source the
`admin`
credentials to gain access to
`OpenStack`
commands:
Execute the script
$ source admin.rc
$ python3 update-images.py
Execute the script
### Execution example
$ python3 update-images.py
$ python3 update-images.py
### Execution example
Download...
From: http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2
$ python3 update-images.py
To: downloads/centos7-1505262668.qcow2
Download...
downloads/centos7-1505262668.qcow2: 100%|████| 855M/855M [05:08<00:00, 2.77MB/s]
From: http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2
Download...
To: downloads/centos7-1505262668.qcow2
From: https://cdimage.debian.org/cdimage/openstack/current-9/debian-9-openstack-amd64.qcow2
downloads/centos7-1505262668.qcow2: 100%|████| 855M/855M [05:08<00:00, 2.77MB/s]
To: downloads/debian9-1507104230.qcow2
Download...
downloads/debian9-1507104230.qcow2: 585MB [00:32, 18.0MB/s]
From: https://cdimage.debian.org/cdimage/openstack/current-9/debian-9-openstack-amd64.qcow2
Download...
To: downloads/debian9-1507104230.qcow2
From: https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-amd64-disk1.img
downloads/debian9-1507104230.qcow2: 585MB [00:32, 18.0MB/s]
To: downloads/ubuntu-16.04-1505853444.qcow2
Download...
downloads/ubuntu-16.04-1505853444.qcow2: 100%|████| 291M/291M [03:31<00:00, 1.37MB/s]
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
Images are now present in OpenStack Glance.
downloads/ubuntu-16.04-1505853444.qcow2: 100%|████| 291M/291M [03:31<00:00, 1.37MB/s]
This script uploads all the images as 'Public', accessible by all users.
Images are now present in OpenStack Glance.
### Update simplestreams
This script uploads all the images as 'Public', accessible by all users.
After updating the images, update the simplestreams catalog:
### Update simplestreams
$ openstack object list simplestreams
After updating the images, update the simplestreams catalog:
$ 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
$ 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
$ python3 generate-files-for-simplestream.py
$ openstack object save simplestreams images/streams/v1/index.json --file index_backup.json
$ cd output/simplestreams
$ ls -lh images/streams/v1/
$ python3 generate-files-for-simplestream.py
$ openstack object create simplestreams images/streams/v1/com.ubuntu.cloud-released-imagemetadata.json images/streams/v1/index.json
$ 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
--------
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
1.
Fetch from config.yaml the url
2.
Download locally (in 'download' folder) the updated qcow2 of specified operating system
Notes
3.
Upload the qcow2 image on glance using openstack-cli commands
-----
Notes
This script is tested on Ubuntu 16.04 x64
-----
This script is tested on Ubuntu 16.04 x64
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment