Skip to content

Commit

Permalink
Merge #1965
Browse files Browse the repository at this point in the history
1965: Don't ask for IP when querying the daemon from the GUI r=townsend2010 a=luis4a0

The GUI issues one `list` request to the daemon per second. Since now `list` asks the instances for the IP's it's using, this consumes lots of resources.

This PR fixes that, by adding a hidden parameter to the `list` command, telling the daemon whether it should ask the instance for the IP's.

Co-authored-by: Luis Peñaranda <luis.penaranda@canonical.com>
  • Loading branch information
2 people authored and Saviq committed Feb 12, 2021
1 parent 9f27f43 commit c94d833
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/client/cli/cmd/list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ mp::ReturnCode cmd::List::run(mp::ArgParser* parser)

ListRequest request;
request.set_verbosity_level(parser->verbosityLevel());
request.set_request_ipv4(true);
return dispatch(&RpcMethod::list, request, on_success, on_failure);
}

Expand Down
1 change: 1 addition & 0 deletions src/client/gui/gui_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ mp::ListReply cmd::GuiCmd::retrieve_all_instances()
};

ListRequest request;
request.set_request_ipv4(false);
dispatch(&RpcMethod::list, request, on_success, on_failure);

return list_reply;
Expand Down
2 changes: 1 addition & 1 deletion src/daemon/daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,7 @@ try // clang-format on

entry->set_current_release(current_release);

if (mp::utils::is_running(present_state))
if (request->request_ipv4() && mp::utils::is_running(present_state))
{
auto vm_specs = vm_instance_specs[name];
mp::SSHSession session{vm->ssh_hostname(), vm->ssh_port(), vm_specs.ssh_username,
Expand Down
1 change: 1 addition & 0 deletions src/rpc/multipass.proto
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ message InfoReply {

message ListRequest {
int32 verbosity_level = 1;
bool request_ipv4 = 2;
}

message ListVMInstance {
Expand Down

0 comments on commit c94d833

Please sign in to comment.