Skip to content

Commit

Permalink
Changed the default value for VM_IMAGE_DIR to ${HOME}/vms/virsh
Browse files Browse the repository at this point in the history
  • Loading branch information
earlruby committed Aug 6, 2023
1 parent d99ba64 commit bdb565c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ documentation on for cloud-init.

`create-vm` stores files as follows:

* `${VM_IMAGE_DIR}` - Directory used for for VM storage. Defaults to `${HOME}/vms`.
* `${VM_IMAGE_DIR}` - Directory used for for VM storage. Defaults to `${HOME}/vms/virsh`.
* `${VM_IMAGE_DIR}/base/` - Place to store your base Linux cloud images.
* `${VM_IMAGE_DIR}/images/` - `your-vm-name.img` and `your-vm-name-cidata.img` files.
* `${VM_IMAGE_DIR}/init/` - `user-data` and `meta-data`.
Expand Down Expand Up @@ -163,7 +163,7 @@ libvirt-qemu:x:64055:libvirt-qemu

That shows that the group `earl`, group ID 1000, has a member `libvirt-qemu`. Since the group `earl` has read and execute permissions on my home directory, `libvirt-qemu` has read and execute permissions on my home directory.

Note: The `libvirtd` daemon will chown some of the files in the directory, including the files in the `~/vms/images` directory, to be owned by `libvirt-qemu` group `kvm`. In order to delete these files without sudo, add yourself to the `kvm` group, e.g.:
Note: The `libvirtd` daemon will chown some of the files in the directory, including the files in the `~/vms/virsh/images` directory, to be owned by `libvirt-qemu` group `kvm`. In order to delete these files without sudo, add yourself to the `kvm` group, e.g.:

```
$ sudo usermod --append --groups kvm earl
Expand Down Expand Up @@ -198,15 +198,15 @@ This creates an Ubuntu 22.04 "Jammy Jellyfish" VM with a 40G hard drive.
First download a copy of the Ubuntu 22.04 "Jammy Jellyfish" cloud image:

```
mkdir -p ~/vms/base
cd ~/vms/base
mkdir -p ~/vms/virsh/base
cd ~/vms/virsh/base
wget http://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img
```

Then create the VM:
```
create-vm -n node1 \
-i ~/vms/base/jammy-server-cloudimg-amd64.img \
-i ~/vms/virsh/base/jammy-server-cloudimg-amd64.img \
-k ~/.ssh/id_rsa_ansible.pub \
-s 40
```
Expand Down Expand Up @@ -274,7 +274,7 @@ This starts the VM creation process and exits. Creation of the VMs continues in

```
for n in `seq 1 8`; do
create-vm -n node$n -i ~/vms/base/jammy-server-cloudimg-amd64.img -k ~/.ssh/id_rsa_ansible.pub
create-vm -n node$n -i ~/vms/virsh/base/jammy-server-cloudimg-amd64.img -k ~/.ssh/id_rsa_ansible.pub
done
```

Expand Down
2 changes: 1 addition & 1 deletion create-vm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# See the License for the specific language governing permissions and

# Set VM_IMAGE_DIR environment variable to override default storage location for VMs
VM_IMAGE_DIR=${VM_IMAGE_DIR:-"${HOME}/vms"}
VM_IMAGE_DIR=${VM_IMAGE_DIR:-"${HOME}/vms/virsh"}

HOSTNAME=
IMG_FQN=
Expand Down
2 changes: 1 addition & 1 deletion delete-vm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
VM=$1

# Set VM_IMAGE_DIR environment variable to override default storage location for VMs
VM_IMAGE_DIR=${VM_IMAGE_DIR:-"${HOME}/vms"}
VM_IMAGE_DIR=${VM_IMAGE_DIR:-"${HOME}/vms/virsh"}

VM_IMAGE="${VM_IMAGE_DIR}/images/$VM.img"
CI_IMAGE="${VM_IMAGE_DIR}/images/$VM-cidata.img"
Expand Down

0 comments on commit bdb565c

Please sign in to comment.