Skip to content

Commit

Permalink
feat: add useful scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
zjregee committed Aug 25, 2024
1 parent 66e3e67 commit 9db933d
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 22 deletions.
12 changes: 6 additions & 6 deletions .github/scripts/install_and_run_vm.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

sudo apt-get update
sudo apt-get install -y cloud-image-utils qemu qemu-kvm
sudo apt-get install cloud-image-utils qemu -y

cloud-localds seed.iso user-data meta-data

Expand All @@ -25,8 +25,8 @@ sudo umount /mnt/ubuntu-iso
sudo rm -rf /mnt/ubuntu-iso

sudo qemu-system-x86_64 --enable-kvm -smp 2 \
-m 4G -object memory-backend-file,id=mem,size=4G,mem-path=/dev/shm,share=on -numa node,memdev=mem \
-chardev socket,id=char0,path=/tmp/vfsd.sock -device vhost-user-fs-pci,queue-size=1024,chardev=char0,tag=myfs \
-drive file=image.img,format=raw,cache=none,if=virtio \
-net user,hostfwd=tcp::2222-:22 -net nic \
-nographic -boot c
-m 4G -object memory-backend-file,id=mem,size=4G,mem-path=/dev/shm,share=on -numa node,memdev=mem \
-chardev socket,id=char0,path=/tmp/vfsd.sock -device vhost-user-fs-pci,queue-size=1024,chardev=char0,tag=myfs \
-drive file=image.img,format=raw,cache=none,if=virtio \
-net user,hostfwd=tcp::2222-:22 -net nic \
-nographic -boot c
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The following components are required:
### Install QEMU and VMs

```shell
$ sudo apt-get -y qemu # debian/ubuntu
$ sudo apt-get install qemu -y # debian/ubuntu
```

Download and install the VM, taking Ubuntu as an example:
Expand All @@ -25,7 +25,7 @@ $ truncate -s 10G image.img
$ sudo qemu-system-x86_64 -enable-kvm -smp 2 -m 4G \
-cdrom ubuntu-20.04.6-live-server-amd64.iso \
-drive file=image.img,format=raw,cache=none,if=virtio \
-boot d
-no-reboot -boot d
```

### Mount shared directory on VMs
Expand All @@ -40,7 +40,7 @@ host# cargo run --release <socket-path> <backend-url>

```markdown
- fs://?root=<path>
- s3://?root=<path>&bucket=<bucket>&endpoint=<endpoint>&region=<region>&access_key_id=<access-key-id>&secret_access_key=<secret-access-key>
- s3://?bucket=<bucket>&endpoint=<endpoint>&access_key_id=<access-key-id>&secret_access_key=<secret-access-key>&region=<region>
```

Run the VM through QEMU and create a VirtioFS device:
Expand All @@ -59,12 +59,11 @@ Mount a shared directory in the VM:
guest# sudo mount -t virtiofs <fs-tag> <mount-point>
```

For more examples, please refer to the test scripts in github actions of this repository.
> Notes: For more examples or some useful Ubuntu unattended autoinstall scripts, see the scripts [here](./scripts/).
## Periodic Reports During GSoC 2024 And Acknowledgements

The following are reports from the implementation phase, all synchronized in the [OpenDAL dev mailing list](https://lists.apache.org/[email protected]).

- [05.12-05.19](./docs/reports/05.12-05.19.md)
- [05.20-06.02](./docs/reports/05.20-06.02.md)
- [06.02-06.27](./docs/reports/06.02-06.27.md)
Expand Down
3 changes: 3 additions & 0 deletions scripts/example.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
OpenDAL: access data freely.
OpenDAL: access data freely.
OpenDAL: access data freely.
11 changes: 5 additions & 6 deletions scripts/install_and_run_vm.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/usr/bin/env bash

sudo apt-get update
sudo apt-get install cloud-image-utils
sudo apt-get install qemu qemu-kvm
sudo apt-get install cloud-image-utils qemu -y

cloud-localds seed.iso user-data meta-data

Expand All @@ -11,9 +10,10 @@ wget https://releases.ubuntu.com/20.04/ubuntu-20.04.6-live-server-amd64.iso
sudo mkdir /mnt/ubuntu-iso
sudo mount -o loop ubuntu-20.04.6-live-server-amd64.iso /mnt/ubuntu-iso

truncate -s 20G image.img
truncate -s 10G image.img

qemu-system-x86_64 -enable-kvm -smp 8 -m 16G \
# Notes: The user and password of the VM created unattended here are both ubuntu.
sudo qemu-system-x86_64 -enable-kvm -smp 2 -m 4G \
-drive file=image.img,format=raw,cache=none,if=virtio \
-drive file=seed.iso,format=raw,cache=none,if=virtio \
-cdrom ubuntu-20.04.6-live-server-amd64.iso \
Expand All @@ -25,7 +25,6 @@ qemu-system-x86_64 -enable-kvm -smp 8 -m 16G \
sudo umount /mnt/ubuntu-iso
sudo rm -rf /mnt/ubuntu-iso

qemu-system-x86_64 -enable-kvm -smp 8 -m 16G \
sudo qemu-system-x86_64 -enable-kvm -smp 2 -m 4G \
-drive file=image.img,format=raw,cache=none,if=virtio \
-net user,hostfwd=tcp::2222-:22 -net nic \
-nographic -boot c
32 changes: 32 additions & 0 deletions scripts/install_and_run_vm_with_virtiofs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

sudo apt-get update
sudo apt-get install cloud-image-utils qemu -y

cloud-localds seed.iso user-data meta-data

wget https://releases.ubuntu.com/20.04/ubuntu-20.04.6-live-server-amd64.iso

sudo mkdir /mnt/ubuntu-iso
sudo mount -o loop ubuntu-20.04.6-live-server-amd64.iso /mnt/ubuntu-iso

truncate -s 10G image.img

# Notes: The user and password of the VM created unattended here are both ubuntu.
sudo qemu-system-x86_64 -enable-kvm -smp 2 -m 4G \
-drive file=image.img,format=raw,cache=none,if=virtio \
-drive file=seed.iso,format=raw,cache=none,if=virtio \
-cdrom ubuntu-20.04.6-live-server-amd64.iso \
-kernel /mnt/ubuntu-iso/casper/vmlinuz \
-initrd /mnt/ubuntu-iso/casper/initrd \
-append "console=ttyS0 autoinstall" \
-nographic -no-reboot -boot d

sudo umount /mnt/ubuntu-iso
sudo rm -rf /mnt/ubuntu-iso

sudo qemu-system-x86_64 --enable-kvm -smp 2 \
-m 4G -object memory-backend-file,id=mem,size=4G,mem-path=/dev/shm,share=on -numa node,memdev=mem \
-chardev socket,id=char0,path=/tmp/vfsd.sock -device vhost-user-fs-pci,queue-size=1024,chardev=char0,tag=myfs \
-drive file=image.img,format=raw,cache=none,if=virtio \
-nographic -boot c
5 changes: 5 additions & 0 deletions scripts/run_ovfs_with_fs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

RUST_LOG=debug cargo run --manifest-path ../Cargo.toml --release \
/tmp/vfsd.sock \
fs://?root=$PWD
5 changes: 5 additions & 0 deletions scripts/run_ovfs_with_s3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

RUST_LOG=debug cargo run --manifest-path ../Cargo.toml --release \
/tmp/vfsd.sock \
"s3://?bucket=test&endpoint=http://127.0.0.1:9000&access_key_id=minioadmin&secret_access_key=minioadmin&region=us-east-1"
9 changes: 9 additions & 0 deletions scripts/run_s3_with_minio.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
#!/usr/bin/env bash

sudo apt-get update
sudo apt-get install awscli -y

docker compose -f docker-compose-minio.yml up -d --wait

export AWS_ACCESS_KEY_ID="minioadmin"
export AWS_SECRET_ACCESS_KEY="minioadmin"
export AWS_EC2_METADATA_DISABLED="true"

aws --endpoint-url http://127.0.0.1:9000/ s3 mb s3://test
aws --endpoint-url http://127.0.0.1:9000/ s3 cp example.txt s3://test
aws --endpoint-url http://127.0.0.1:9000/ s3 ls s3://test
aws --endpoint-url http://127.0.0.1:9000/ s3 cp s3://test/example.txt -
5 changes: 0 additions & 5 deletions scripts/s3_scripts.sh

This file was deleted.

0 comments on commit 9db933d

Please sign in to comment.