Skip to content

Commit

Permalink
feat: Change qcow allocation (#555)
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese committed Jan 12, 2024
1 parent f935c1e commit 53e0330
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 0 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ docker run -it --rm -p 5000:5000 --device=/dev/kvm --cap-add NET_ADMIN --stop-ti

```yaml
environment:
ALLOCATE: "N"
DISK_FMT: "qcow2"
```

Expand Down
8 changes: 8 additions & 0 deletions src/disk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,14 @@ addDevice () {

DISK_EXT="$(fmt2ext "$DISK_FMT")" || exit $?

if [ -z "$ALLOCATE" ]; then
if [[ "${DISK_FMT,,}" == "raw" ]]; then
ALLOCATE="Y"
else
ALLOCATE="N"
fi
fi

if [[ "$ALLOCATE" == [Nn]* ]]; then
DISK_TYPE="growable"
DISK_ALLOC="preallocation=off"
Expand Down
2 changes: 1 addition & 1 deletion src/reset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ trap 'error "Status $? while: $BASH_COMMAND (line $LINENO/$BASH_LINENO)"' ERR
: ${DEBUG:='N'} # Disable debugging mode
: ${COUNTRY:=''} # Country code for mirror
: ${CONSOLE:='N'} # Disable console mode
: ${ALLOCATE:='Y'} # Preallocate diskspace
: ${ALLOCATE:=''} # Preallocate diskspace
: ${ARGUMENTS:=''} # Extra QEMU parameters
: ${CPU_CORES:='1'} # Amount of CPU cores
: ${RAM_SIZE:='1G'} # Maximum RAM amount
Expand Down

0 comments on commit 53e0330

Please sign in to comment.