mirror of
https://github.com/kneutron/ansitest.git
synced 2025-01-16 04:42:55 +08:00
Add files via upload
This commit is contained in:
parent
26addc9b5a
commit
6c4c7103d0
@ -1,12 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# NOTE proxmox can import/convert .vdi disks without having to .qcow them 1st
|
||||||
|
|
||||||
source ~/bin/failexit.mrg
|
source ~/bin/failexit.mrg
|
||||||
|
|
||||||
# converted qcows from vbox are here
|
# converted qcows from vbox
|
||||||
cd /mnt/seatera4-xfs
|
cd /mnt/seatera4-xfs
|
||||||
|
|
||||||
echo "Usage: \$1=name-of-vm \$2=RAM-in-GB [optional] \$3=newvmnumber [optional]"
|
echo "Usage: \$1=name-of-vm \$2=RAM-in-GB [optional] \$3=newvmnumber"
|
||||||
# Use 3rd arg in case of new vm number not taking containers into account
|
|
||||||
|
|
||||||
if [ "$1" = "" ]; then
|
if [ "$1" = "" ]; then
|
||||||
failexit 101 "1st arg not supplied, must be VMNAME"
|
failexit 101 "1st arg not supplied, must be VMNAME"
|
||||||
@ -18,7 +19,7 @@ fi
|
|||||||
#oldlinux=l24
|
#oldlinux=l24
|
||||||
|
|
||||||
# integer / number
|
# integer / number
|
||||||
declare -i ram lastid newid
|
declare -i ram lastid newid #newidarg
|
||||||
|
|
||||||
if [ "$2" = "" ]; then
|
if [ "$2" = "" ]; then
|
||||||
ram=4096
|
ram=4096
|
||||||
@ -26,9 +27,9 @@ else
|
|||||||
ram=$2
|
ram=$2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$(date) - Getting last VM number"
|
#echo "$(date) - Getting last VM number"
|
||||||
lastid=$(qm list |tail -n 1 |awk '{print $1}')
|
#lastid=$(qm list |tail -n 1 |awk '{print $1}')
|
||||||
date
|
#date
|
||||||
# qm list
|
# qm list
|
||||||
# VMID NAME STATUS MEM(MB) BOOTDISK(GB) PID
|
# VMID NAME STATUS MEM(MB) BOOTDISK(GB) PID
|
||||||
# 100 lmde stopped 4096 21.00 0
|
# 100 lmde stopped 4096 21.00 0
|
||||||
@ -36,9 +37,10 @@ date
|
|||||||
# 103 win10-restore-from-vbox-choco stopped 6144 80.00 0
|
# 103 win10-restore-from-vbox-choco stopped 6144 80.00 0
|
||||||
# 104 pfsense-272 running 1500 20.00 813250
|
# 104 pfsense-272 running 1500 20.00 813250
|
||||||
|
|
||||||
let newid=$lastid+1
|
# more reliable method
|
||||||
|
let newid=$(pvesh get /cluster/nextid)
|
||||||
[ "$3" = "" ] || newid=$3
|
[ "$3" = "" ] || newid=$3
|
||||||
echo "Last vmid: $lastid - New id: $newid -- RAM: $ram -- PK"
|
echo "New id: $newid -- RAM: $ram -- PK"
|
||||||
read -n 1
|
read -n 1
|
||||||
|
|
||||||
# --ostype l26 \
|
# --ostype l26 \
|
||||||
@ -50,7 +52,7 @@ qm create $newid \
|
|||||||
--net2 virtio,bridge=vmbr1,link_down=0,firewall=0 \
|
--net2 virtio,bridge=vmbr1,link_down=0,firewall=0 \
|
||||||
--name "$newname" \
|
--name "$newname" \
|
||||||
--scsihw virtio-scsi-single \
|
--scsihw virtio-scsi-single \
|
||||||
--cores 1 --sockets 1 --cpu cputype=host \
|
--cores 2 --sockets 1 --cpu cputype=host \
|
||||||
--ide2 none,media=cdrom \
|
--ide2 none,media=cdrom \
|
||||||
--memory $ram \
|
--memory $ram \
|
||||||
--vga=virtio,memory=128 \
|
--vga=virtio,memory=128 \
|
||||||
@ -58,7 +60,7 @@ qm create $newid \
|
|||||||
--start 0 \
|
--start 0 \
|
||||||
--onboot 0 \
|
--onboot 0 \
|
||||||
--boot order="ide2;sata0" \
|
--boot order="ide2;sata0" \
|
||||||
--sata0 zfs1:0,cache=writeback,import-from=$PWD/suse-tumbleweed-20240219-desktop-kde-disk0.qcow2 \
|
--sata0 tosh10-xfs-multi:0,cache=writeback,import-from=$PWD/test-zfs-21-Draid-sata0-0.vdi \
|
||||||
|| failexit 40 "Failed to create VM $newid $newname"
|
|| failexit 40 "Failed to create VM $newid $newname"
|
||||||
# --sata1 zfs1:0,cache=writeback,import-from=$PWD/cubietruck-temp-replacement-squid-pihole-sata0-1-squidextend.vdi.qcow2 \
|
# --sata1 zfs1:0,cache=writeback,import-from=$PWD/cubietruck-temp-replacement-squid-pihole-sata0-1-squidextend.vdi.qcow2 \
|
||||||
|
|
||||||
@ -68,3 +70,7 @@ exit;
|
|||||||
|
|
||||||
L, not One
|
L, not One
|
||||||
--ostype <l24 | l26 | other | solaris | w2k | w2k3 | w2k8 | win10 | win11 | win7 | win8 | wvista | wxp>
|
--ostype <l24 | l26 | other | solaris | w2k | w2k3 | w2k8 | win10 | win11 | win7 | win8 | wvista | wxp>
|
||||||
|
|
||||||
|
# create a disk commandline and attach to vm
|
||||||
|
pvesm alloc local-lvm 2002 vm-2002-disk-3 1
|
||||||
|
qm set 2002 -scsihw virtio-scsi-pci --scsi2 local-lvm:vm-2002-disk-3
|
||||||
|
Loading…
x
Reference in New Issue
Block a user