fixed bugs
This commit is contained in:
parent
4e5eebe367
commit
983e915090
4 changed files with 20 additions and 9 deletions
|
@ -14,15 +14,14 @@ fi
|
|||
cd /var/lib/libvirt/images
|
||||
|
||||
VM_NAME=$1
|
||||
VM_DIR="/tmp/${UID}/vmimages"
|
||||
VM_XML="${VM_DIR}/xml/${VM_NAME}-clone.xml"
|
||||
|
||||
if [[ ! -f "xml/${VM_NAME}.xml" ]] || [[ ! -f "${VM_NAME}.qcow2" ]]; then
|
||||
if ! [[ -f "xml/${VM_NAME}.xml" && -f "${VM_NAME}.qcow2" ]] && ! [[ -f "${VM_DIR}/xml/${VM_NAME}.xml" && -f "${VM_DIR}/${VM_NAME}.qcow2" ]]; then
|
||||
echo "xml or qcow2 File does not exists." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VM_DIR="/tmp/${UID}/vmimages"
|
||||
VM_XML="${VM_DIR}/xml/${VM_NAME}-clone.xml"
|
||||
|
||||
# Create User-VM-Dir and link system VM-Images
|
||||
[[ -d "${VM_DIR}/xml" ]] || mkdir -p "${VM_DIR}/xml"
|
||||
sudo /usr/local/bin/link-images.sh
|
||||
|
@ -32,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 "/var/lib/libvirt/images/xml/${VM_NAME}.xml" "${VM_XML}"
|
||||
cp "${VM_DIR}/xml/${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