proxmox:ct_op_basis_van_csv
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| proxmox:ct_op_basis_van_csv [2025/11/23 15:58] – [context] admin | proxmox:ct_op_basis_van_csv [2025/11/23 16:05] (current) – admin | ||
|---|---|---|---|
| Line 18: | Line 18: | ||
| CSV_FILE=" | CSV_FILE=" | ||
| - | # Prefix | + | # Prefix |
| VMID_PREFIX=1 | VMID_PREFIX=1 | ||
| + | |||
| + | # Minimum free space warning threshold for thin pool (in %) | ||
| + | THIN_POOL_WARNING=90 | ||
| + | THIN_POOL=" | ||
| + | |||
| + | # Function to find next available VMID | ||
| + | get_next_vmid() { | ||
| + | local start=$1 | ||
| + | while pct status " | ||
| + | start=$((start + 1)) | ||
| + | done | ||
| + | echo " | ||
| + | } | ||
| + | |||
| + | # Function to check thin pool usage | ||
| + | check_thin_pool() { | ||
| + | local usage | ||
| + | usage=$(lvs --noheadings -o data_percent " | ||
| + | if [ " | ||
| + | echo " | ||
| + | exit 1 | ||
| + | fi | ||
| + | } | ||
| # Loop through CSV, skip header | # Loop through CSV, skip header | ||
| tail -n +2 " | tail -n +2 " | ||
| - | # Ensure VMID is >= 100 | + | |
| + | check_thin_pool | ||
| + | |||
| + | | ||
| if [ " | if [ " | ||
| - | | + | |
| else | else | ||
| - | | + | |
| fi | fi | ||
| - | echo " | + | |
| + | VMID=$(get_next_vmid " | ||
| + | |||
| + | # Sanitize hostname: replace underscores with hyphens | ||
| + | SAFE_HOSTNAME=$(echo " | ||
| + | |||
| + | | ||
| # Clone the container | # Clone the container | ||
| - | pct clone " | + | pct clone " |
| # Configure network after cloning | # Configure network after cloning | ||
| Line 41: | Line 73: | ||
| pct start " | pct start " | ||
| - | echo " | + | echo " |
| done | done | ||
| + | |||
| </ | </ | ||
| ===== meer info ===== | ===== meer info ===== | ||
proxmox/ct_op_basis_van_csv.1763913526.txt.gz · Last modified: by admin
