Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dbs-cli: several refactor in cmd tool #26

Merged
merged 1 commit into from
Nov 15, 2023

Conversation

studychao
Copy link
Member

@studychao studychao commented Nov 14, 2023

  1. Add all creation related args under Create command and all update related args under Update command.

  2. catagorize different args type to make more sense, like putting all cpu related commands under CpuArgs instead of putting them everywhere without order.

@studychao studychao force-pushed the chao/refactor branch 3 times, most recently from 0275430 to 93af16d Compare November 14, 2023 15:09
Copy link
Contributor

@justxuewei justxuewei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @studychao! A few comments here.

README.md Outdated
--log-file dbs-cli.log --log-level ERROR \
--kernel-path ~/path/to/kernel/vmlinux.bin \
--rootfs ~/path/to/rootfs/bionic.rootfs.ext4 \
--boot-args "console=ttyS0 console=ttyS1 earlyprintk=ttyS1 tty0 reboot=k debug panic=1 pci=off root=/dev/vda1" \
--virnets "[{\"iface_id\":\"eth0\",\"host_dev_name\":\"tap0\",\"num_queues\":2,\"queue_size\":0,\"guest_mac\":\"43:2D:9C:13:71:48\",\"allow_duplicate_mac\":true}]" \
create;
;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to previous line?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done and I remove all redundant ;

README.md Outdated
--log-file dbs-cli.log --log-level ERROR \
--kernel-path ~/path/to/kernel/vmlinux.bin \
--rootfs ~/path/to/rootfs/bionic.rootfs.ext4 \
--boot-args "console=ttyS0 console=ttyS1 earlyprintk=ttyS1 tty0 reboot=k debug panic=1 pci=off root=/dev/vda1" \
--virblks '[{"drive_id":"testblk","device_type":"RawBlock","path_on_host":"/path/to/test.img","is_root_device":false,"is_read_only":false,"is_direct":false,"no_drop":false,"num_queues":1,"queue_size":1024}]' \
create;
;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

README.md Outdated
@@ -117,9 +117,9 @@ Create hot-plug virtio-net devices via API Server:

```
sudo ./dbs-cli \
--api-sock-path [socket path]
--api-sock-path [socket path] update
--hotplug-virnets "[{\"iface_id\":\"eth0\",\"host_dev_name\":\"tap0\",\"num_queues\":2,\"queue_size\":0,\"guest_mac\":\"43:2D:9C:13:71:48\",\"allow_duplicate_mac\":true}]" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove \ at the end?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -129,11 +129,13 @@ Create hot-plug virtio-blk devices via API Server:

```
sudo ./dbs-cli \
--api-sock-path [socket path]
--api-sock-path [socket path] update
--hotplug-virblks '[{"drive_id":"testblk","device_type":"RawBlock","path_on_host":"/path/to/test.img","is_root_device":false,"is_read_only":false,"is_direct":false,"no_drop":false,"num_queues":1,"queue_size":1024}]' \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

#[clap(long, value_parser, default_value = "dbs-cli.log", display_order = 1)]
pub log_file: String,

#[clap(long, value_parser, default_value = "Info", display_order = 1)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "Debug" a better default value? The reason is that dbs-cli is a debug tool for Dragonball.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed.

README.md Outdated
--kernel-path ~/path/to/kernel/vmlinux.bin \
--rootfs ~/path/to/rootfs/rootfs.dmg \
--boot-args "console=ttyS0 console=ttyS1 earlyprintk=ttyS1 tty0 reboot=k debug panic=1 pci=off root=/dev/vda1" create ;
--boot-args "console=ttyS0 console=ttyS1 earlyprintk=ttyS1 tty0 reboot=k debug panic=1 pci=off root=/dev/vda1" ;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the space at the end.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

README.md Outdated
```

Set the log level and log file:

> The log-level argument is case-insensitive: ErrOR and InFO are valid.

```bash
./dbs-cli \
./dbs-cli create\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

README.md Outdated
@@ -44,12 +44,12 @@ Create a vsock console (communication with sock file)
> Otherwise, `dbs-cli` will create a vsock console with a sock file, namely the value of `serial-path`.

```
./dbs-cli \
./dbs-cli create\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

README.md Outdated
@@ -60,12 +60,12 @@ Create a virtio-vsock tunnel for Guest-to-Host communication.
> specified with the `--vsock` parameter.

```
./dbs-cli \
./dbs-cli create\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

README.md Outdated
@@ -89,13 +89,13 @@ Create virtio-blk devices.
> format of JSON.

```
./dbs-cli \
./dbs-cli create\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

1. Add all creation related args under Create command and all update
related args under Update command.

2. catagorize different args type to make more sense, like putting all
cpu related commands under CpuArgs instead of putting them everything
without order.

Signed-off-by: Chao Wu <[email protected]>
Copy link
Contributor

@justxuewei justxuewei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm, thanks @studychao!

@studychao studychao merged commit c57d44a into openanolis:main Nov 15, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants