forked from kubevirt/kubevirt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request kubevirt#1733 from vladikr/migrate_with_shared_pvc
Migrate with shared PVC
- Loading branch information
Showing
24 changed files
with
905 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ FROM fedora:28 | |
LABEL maintainer="The KubeVirt Project <[email protected]>" | ||
ENV container docker | ||
|
||
RUN dnf install -y nginx qemu-guest-agent \ | ||
RUN dnf install -y nginx qemu-guest-agent qemu-img scsi-target-utils \ | ||
&& dnf -y clean all | ||
|
||
RUN mkdir -p /usr/share/nginx/html/images \ | ||
|
@@ -33,3 +33,8 @@ RUN cp /usr/bin/qemu-ga /usr/share/nginx/html/ | |
ADD nginx.conf /etc/nginx/ | ||
|
||
EXPOSE 80 | ||
|
||
ADD entry-point.sh / | ||
ADD expose-as-iscsi.sh / | ||
|
||
CMD ["/entry-point.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
# | ||
# This file is part of the KubeVirt project | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# Copyright 2017 Red Hat, Inc. | ||
# | ||
|
||
# https://fedoraproject.org/wiki/Scsi-target-utils_Quickstart_Guide | ||
|
||
trap 'echo "Graceful exit"; exit 0' SIGINT SIGQUIT SIGTERM | ||
|
||
ALPINE_IMAGE_PATH=/usr/share/nginx/html/images/alpine.iso | ||
IMAGE_PATH=/images | ||
|
||
if [ -n "$AS_ISCSI" ]; then | ||
mkdir -p $IMAGE_PATH | ||
/usr/bin/qemu-img convert $ALPINE_IMAGE_PATH $IMAGE_PATH/alpine.raw | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to convert image $ALPINE_IMAGE_PATH to .raw file" | ||
exit 1 | ||
fi | ||
|
||
touch /tmp/healthy | ||
bash expose-as-iscsi.sh "${IMAGE_PATH}/alpine.raw" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/bash | ||
|
||
IMAGE_PATH="$1" | ||
|
||
if [ ! -f "$IMAGE_PATH" ]; then | ||
echo "vm image '$IMAGE_PATH' not found" | ||
exit 1 | ||
fi | ||
|
||
# USING 'set -e' error detection for everything below this point. | ||
set -e | ||
|
||
PORT=${PORT:-3260} | ||
WWN=${WWN:-iqn.2018-01.io.kubevirt:wrapper} | ||
LUNID=1 | ||
|
||
echo "Starting tgtd at port $PORT" | ||
tgtd -f --iscsi portal="0.0.0.0:${PORT}" & | ||
sleep 5 | ||
|
||
echo "Adding target and exposing it" | ||
tgtadm --lld iscsi --mode target --op new --tid=1 --targetname $WWN | ||
tgtadm --lld iscsi --mode target --op bind --tid=1 -I ALL | ||
|
||
if [ -n "$PASSWORD" ]; then | ||
echo "Adding authentication for user $USERNAME" | ||
tgtadm --lld iscsi --op new --mode account --user $USERNAME --password $PASSWORD | ||
tgtadm --lld iscsi --op bind --mode account --tid=1 --user $USERNAME | ||
fi | ||
|
||
echo "Adding volume file as LUN" | ||
tgtadm --lld iscsi --mode logicalunit --op new --tid=1 --lun=$LUNID -b $IMAGE_PATH | ||
tgtadm --lld iscsi --mode logicalunit --op update --tid=1 --lun=$LUNID --params thin_provisioning=1 | ||
|
||
echo "Start monitoring" | ||
touch previous_state | ||
while true; do | ||
tgtadm --lld iscsi --mode target --op show >current_state | ||
diff -q previous_state current_state || ( | ||
date | ||
cat current_state | ||
) | ||
mv -f current_state previous_state | ||
sleep 5 | ||
done |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.