Delete image TestVM only
Only the built-in image TestVM needs to be replaced. But the current
controller post deployment script will remove all images and may be
invoked to clear all user's images when environment is redeployed.
Change-Id: I36a6cdbe25a52512e508e6c758d8310c2fe4f349
Closes-Bug: #1593090
(cherry picked from commit 51162eddff
)
This commit is contained in:
parent
81210539be
commit
8b0701cced
|
@ -4,14 +4,7 @@ LOG_ROOT="/var/log/fuel-plugin-xenserver/"
|
|||
mkdir -p $LOG_ROOT
|
||||
LOG_FILE=$LOG_ROOT"controller_post_deployment.log"
|
||||
|
||||
function clear_images {
|
||||
for ID in $(glance image-list | awk 'NR>2{print $2}' | grep -v '^$');
|
||||
do
|
||||
glance image-delete $ID &>> $LOG_FILE
|
||||
done
|
||||
}
|
||||
|
||||
function create_image {
|
||||
function replace_test_image {
|
||||
local image_name
|
||||
image_name="$1"
|
||||
|
||||
|
@ -21,16 +14,22 @@ function create_image {
|
|||
local image_file
|
||||
image_file="$3"
|
||||
|
||||
if ! glance image-list | grep -q "$image_name"; then
|
||||
glance image-create \
|
||||
--name "$image_name" \
|
||||
--container-format ovf \
|
||||
--disk-format vhd \
|
||||
--property vm_mode="$vm_mode" \
|
||||
--visibility public \
|
||||
--file "$image_file" \
|
||||
&>> $LOG_FILE
|
||||
image_id=$(glance image-list | grep "$image_name" | awk -F "|" '{print $2}' | grep -v '^$')
|
||||
|
||||
if [[ -n "$image_id" ]]; then
|
||||
echo "Delete image $image_name" >> $LOG_FILE
|
||||
glance image-delete $image_id &>> $LOG_FILE
|
||||
fi
|
||||
|
||||
echo "Create image $image_name" >> $LOG_FILE
|
||||
glance image-create \
|
||||
--name "$image_name" \
|
||||
--container-format ovf \
|
||||
--disk-format vhd \
|
||||
--property vm_mode="$vm_mode" \
|
||||
--visibility public \
|
||||
--file "$image_file" \
|
||||
&>> $LOG_FILE
|
||||
}
|
||||
|
||||
function mod_novnc {
|
||||
|
@ -53,8 +52,12 @@ EOF
|
|||
|
||||
source /root/openrc admin
|
||||
|
||||
clear_images
|
||||
create_image "TestVM" "xen" cirros-0.3.4-x86_64-disk.vhd.tgz
|
||||
echo "Before image replacement" >> $LOG_FILE
|
||||
glance image-list >> $LOG_FILE
|
||||
|
||||
replace_test_image "TestVM" "xen" cirros-0.3.4-x86_64-disk.vhd.tgz
|
||||
|
||||
echo "After image replacement" >> $LOG_FILE
|
||||
glance image-list >> $LOG_FILE
|
||||
|
||||
mod_novnc
|
||||
|
|
|
@ -3,7 +3,7 @@ name: fuel-plugin-xenserver
|
|||
# Human-readable name for your plugin
|
||||
title: XenServer Plugin
|
||||
# Plugin version
|
||||
version: '3.90.2'
|
||||
version: '3.90.3'
|
||||
# Description
|
||||
description: Enable Mirantis OpenStack to integrate with Xenserver
|
||||
# Required fuel version
|
||||
|
|
Loading…
Reference in New Issue