store vmimages in /lmn/vm and mount media in /lmn/media
This commit is contained in:
parent
68239b56cb
commit
e64008c714
14 changed files with 150 additions and 94 deletions
|
@ -11,19 +11,19 @@ if [[ $# -ne 1 ]]; then
|
|||
fi
|
||||
|
||||
# change to image-directory
|
||||
cd /var/lib/libvirt/images
|
||||
cd /lmn/vm
|
||||
|
||||
VM_NAME=$1
|
||||
VM_DIR="/tmp/${UID}/vmimages"
|
||||
VM_XML="${VM_DIR}/xml/${VM_NAME}-clone.xml"
|
||||
VM_DIR="/tmp/${UID}/vm"
|
||||
VM_XML="${VM_DIR}/${VM_NAME}-clone.xml"
|
||||
|
||||
if ! [[ -f "xml/${VM_NAME}.xml" && -f "${VM_NAME}.qcow2" ]] && ! [[ -f "${VM_DIR}/xml/${VM_NAME}.xml" && -f "${VM_DIR}/${VM_NAME}.qcow2" ]]; then
|
||||
if ! [[ -f "${VM_NAME}.xml" && -f "${VM_NAME}.qcow2" ]] && ! [[ -f "${VM_DIR}/${VM_NAME}.xml" && -f "${VM_DIR}/${VM_NAME}.qcow2" ]]; then
|
||||
echo "xml or qcow2 File does not exists." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create User-VM-Dir and link system VM-Images
|
||||
[[ -d "${VM_DIR}/xml" ]] || mkdir -p "${VM_DIR}/xml"
|
||||
[[ -d "${VM_DIR}" ]] || mkdir -p "${VM_DIR}"
|
||||
sudo /usr/local/bin/link-images.sh
|
||||
|
||||
# Create backing file
|
||||
|
@ -31,7 +31,7 @@ cd "${VM_DIR}"
|
|||
qemu-img create -f qcow2 -F qcow2 -b "${VM_NAME}.qcow2" "${VM_NAME}-clone.qcow2"
|
||||
|
||||
# Create machine-definition-file
|
||||
cp "${VM_DIR}/xml/${VM_NAME}.xml" "${VM_XML}"
|
||||
cp "${VM_DIR}/${VM_NAME}.xml" "${VM_XML}"
|
||||
|
||||
# set VM_DIR:
|
||||
sed -i "s:VMIMAGEDIR:${VM_DIR}:" "${VM_XML}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue