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
|
mkdir -p $LOG_ROOT
|
||||||
LOG_FILE=$LOG_ROOT"controller_post_deployment.log"
|
LOG_FILE=$LOG_ROOT"controller_post_deployment.log"
|
||||||
|
|
||||||
function clear_images {
|
function replace_test_image {
|
||||||
for ID in $(glance image-list | awk 'NR>2{print $2}' | grep -v '^$');
|
|
||||||
do
|
|
||||||
glance image-delete $ID &>> $LOG_FILE
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
function create_image {
|
|
||||||
local image_name
|
local image_name
|
||||||
image_name="$1"
|
image_name="$1"
|
||||||
|
|
||||||
|
@ -21,16 +14,22 @@ function create_image {
|
||||||
local image_file
|
local image_file
|
||||||
image_file="$3"
|
image_file="$3"
|
||||||
|
|
||||||
if ! glance image-list | grep -q "$image_name"; then
|
image_id=$(glance image-list | grep "$image_name" | awk -F "|" '{print $2}' | grep -v '^$')
|
||||||
glance image-create \
|
|
||||||
--name "$image_name" \
|
if [[ -n "$image_id" ]]; then
|
||||||
--container-format ovf \
|
echo "Delete image $image_name" >> $LOG_FILE
|
||||||
--disk-format vhd \
|
glance image-delete $image_id &>> $LOG_FILE
|
||||||
--property vm_mode="$vm_mode" \
|
|
||||||
--visibility public \
|
|
||||||
--file "$image_file" \
|
|
||||||
&>> $LOG_FILE
|
|
||||||
fi
|
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 {
|
function mod_novnc {
|
||||||
|
@ -53,8 +52,12 @@ EOF
|
||||||
|
|
||||||
source /root/openrc admin
|
source /root/openrc admin
|
||||||
|
|
||||||
clear_images
|
echo "Before image replacement" >> $LOG_FILE
|
||||||
create_image "TestVM" "xen" cirros-0.3.4-x86_64-disk.vhd.tgz
|
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
|
glance image-list >> $LOG_FILE
|
||||||
|
|
||||||
mod_novnc
|
mod_novnc
|
||||||
|
|
|
@ -3,7 +3,7 @@ name: fuel-plugin-xenserver
|
||||||
# Human-readable name for your plugin
|
# Human-readable name for your plugin
|
||||||
title: XenServer Plugin
|
title: XenServer Plugin
|
||||||
# Plugin version
|
# Plugin version
|
||||||
version: '3.90.2'
|
version: '3.90.3'
|
||||||
# Description
|
# Description
|
||||||
description: Enable Mirantis OpenStack to integrate with Xenserver
|
description: Enable Mirantis OpenStack to integrate with Xenserver
|
||||||
# Required fuel version
|
# Required fuel version
|
||||||
|
|
Loading…
Reference in New Issue