Skip to content

Support ps subcommand on podcvd#2814

Open
0405ysj wants to merge 3 commits into
google:mainfrom
0405ysj:podcvd_ps
Open

Support ps subcommand on podcvd#2814
0405ysj wants to merge 3 commits into
google:mainfrom
0405ysj:podcvd_ps

Conversation

@0405ysj

@0405ysj 0405ysj commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Suggested output format of cvd ps:

$ cvd ps 2>/dev/null
GROUPS   NAMES   ID   STATUS    CREATED               ADB_SERIAL       WEB_ACCESS                                                   
cvd_1    1       1    Running   2026-07-10 07:56:55   localhost:6520   https://localhost:1443/devices/cvd_1-1-1/files/client.html

Suggested output format of podcvd ps:

GROUPS   NAMES   ID   STATUS    CREATED               ADB_SERIAL           WEB_ACCESS
cvd_1    1       1    Running   2026-07-13 01:16:15   192.168.112.1:6520   https://192.168.112.1:11443/devices/cvd_1-1-1/files/client.html
cvd_2    1       1    Running   2026-07-13 01:16:27   192.168.112.2:6520   https://192.168.112.2:11443/devices/cvd_2-1-1/files/client.html

Context: b/530777084

@rickgonzalez

Copy link
Copy Markdown

Sharing an explanation of this PR I did during dev/test of Lenzon - Hope you find it helpful.
https://www.lenzon.ai/viewer/cmrb01fsy0000jcwzlwurvng2?voice=google-chirp3

@0405ysj 0405ysj force-pushed the podcvd_ps branch 4 times, most recently from 3984bd6 to 830944e Compare July 13, 2026 05:15
@0405ysj 0405ysj changed the title [WIP] Support ps subcommand on podcvd Support ps subcommand on podcvd Jul 13, 2026
@0405ysj 0405ysj requested review from dxapd, ikicha and k311093 July 13, 2026 05:17
@0405ysj 0405ysj marked this pull request as ready for review July 13, 2026 05:17
@0405ysj

0405ysj commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator Author

@dxapd Could I get the review for the modification on cvd ps as we talked on b/530777084? Now I'm ready for the review. Thanks!

@0405ysj

0405ysj commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator Author

@k311093 @ikicha Could I get review for the modification on podcvd code for ps subcommand support? Thanks!

@0405ysj 0405ysj added the kokoro:force-run Trigger a presubmit build unconditionally. label Jul 13, 2026
@GoogleCuttlefishTesterBot GoogleCuttlefishTesterBot removed the kokoro:force-run Trigger a presubmit build unconditionally. label Jul 13, 2026
@0405ysj 0405ysj added the kokoro:force-run Trigger a presubmit build unconditionally. label Jul 13, 2026
@GoogleCuttlefishTesterBot GoogleCuttlefishTesterBot removed the kokoro:force-run Trigger a presubmit build unconditionally. label Jul 13, 2026
return rowMap
}

func parsePsOutput(stdout, ipAddr string) ([]map[string]string, []psColumn, error) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is re-string parsing the human-readable output of cvd ps back into a data structure the best way to do this? The purpose of cvd ps is to grab all of the groups' information from instance_manager_ and convert it into human-readable output based on kHeaders. This seems to add a redundant step, when you could:

  • call cvd fleet and use standard JSON parsing to put it into a data structure, and then use kHeaders to format your output,
  • or possibly call into instance_manager_ yourself (not sure if this one is possible from podcvd).

But before that, do podcvd commands need to be formatted a specific way? If not, you may be able to just directly feed the output of cvd ps into stdout.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

But before that, do podcvd commands need to be formatted a specific way? If not, you may be able to just directly feed the output of cvd ps into stdout.

The only requirement is podcvd ps should have same format as cvd ps. When multiple Cuttlefish instance groups exist, each group is in separated container instances. When executing cvd ps from containers, podcvd ps needs to parse the data in advance, and then reconstruct it.

Leaving a representative example why not parsing the human-readable output can be problematic, difference on the padding.

$ podman exec -it <container_name_for_cvd_1> cvd ps
GROUPS   NAMES   ID   STATUS    CREATED               ADB_SERIAL           WEB_ACCESS
cvd_1    1       1    Running   2026-07-13 01:16:15   192.168.112.1:6520   https://192.168.112.1:11443/devices/cvd_1-1-1/files/client.html
$ podman exec -it <container_name_for_cvd_11> cvd ps
GROUPS    NAMES   ID   STATUS    CREATED               ADB_SERIAL            WEB_ACCESS
cvd_11    1       1    Running   2026-07-13 01:16:27   192.168.112.11:6520   https://192.168.112.11:11443/devices/cvd_2-1-1/files/client.html

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Also I should have considered potential format changes in the future. In case of having long-running Cuttlefish instance group via podcvd, its container instance has older version of cvd and there can have another running container instance with newer version of cvd perhpas. Even for such case, podcvd ps should provide information as possible as cvd ps does.

From podcvd modification, you could see any header row(e.g. GROUPS NAMES ID ...) isn't hardcoded there.

Comment thread base/cvd/cuttlefish/host/commands/cvd/cli/commands/ps.cpp
@0405ysj 0405ysj requested a review from dxapd July 15, 2026 05:46
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.

4 participants