Skip to content

Commit

Permalink
[rpc] Change the name of instance-snapshot pairs
Browse files Browse the repository at this point in the history
In info and delete requests.
  • Loading branch information
ricab committed Oct 24, 2023
1 parent eebe75f commit 14a1fdc
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/client/cli/cmd/alias.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ mp::ParseCode cmd::Alias::parse_args(mp::ArgParser* parser)
auto instance = definition.left(colon_pos).toStdString();
auto working_directory = parser->isSet(no_alias_dir_mapping_option) ? "default" : "map";

info_request.add_instances_snapshots()->set_instance_name(instance);
info_request.add_instance_snapshot_pairs()->set_instance_name(instance);
info_request.set_verbosity_level(0);
info_request.set_no_runtime_information(true);

Expand Down
2 changes: 1 addition & 1 deletion src/client/cli/cmd/delete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ mp::ParseCode cmd::Delete::parse_instances_snapshots(mp::ArgParser* parser)
snapshot_found = true;

Check warning on line 135 in src/client/cli/cmd/delete.cpp

View check run for this annotation

Codecov / codecov/patch

src/client/cli/cmd/delete.cpp#L134-L135

Added lines #L134 - L135 were not covered by tests
}

request.add_instances_snapshots()->CopyFrom(item);
request.add_instance_snapshot_pairs()->CopyFrom(item);
}

return enforce_purged_snapshots(instances, snapshots, instance_found, snapshot_found);
Expand Down
2 changes: 1 addition & 1 deletion src/client/cli/cmd/exec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ mp::ReturnCode cmd::Exec::run(mp::ArgParser* parser)

info_request.set_verbosity_level(parser->verbosityLevel());

info_request.add_instances_snapshots()->set_instance_name(instance_name);
info_request.add_instance_snapshot_pairs()->set_instance_name(instance_name);
info_request.set_no_runtime_information(true);

dispatch(&RpcMethod::info, info_request, on_info_success, on_info_failure);
Expand Down
2 changes: 1 addition & 1 deletion src/client/cli/cmd/info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ mp::ParseCode cmd::Info::parse_args(mp::ArgParser* parser)
else
snapshot_found = true;

Check warning on line 103 in src/client/cli/cmd/info.cpp

View check run for this annotation

Codecov / codecov/patch

src/client/cli/cmd/info.cpp#L103

Added line #L103 was not covered by tests

request.add_instances_snapshots()->CopyFrom(item);
request.add_instance_snapshot_pairs()->CopyFrom(item);
}

request.set_no_runtime_information(parser->isSet(noRuntimeInfoOption));
Expand Down
8 changes: 4 additions & 4 deletions src/daemon/daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1776,13 +1776,13 @@ try // clang-format on

auto [instance_selection, status] = select_instances_and_react(operative_instances,
deleted_instances,
request->instances_snapshots(),
request->instance_snapshot_pairs(),
InstanceGroup::All,
require_existing_instances_reaction);

if (status.ok())
{
instance_snapshots_map = map_snapshots_to_instances(request->instances_snapshots());
instance_snapshots_map = map_snapshots_to_instances(request->instance_snapshot_pairs());

if ((status = cmd_vms(instance_selection.operative_selection, fetch_detailed_report)).ok())
{
Expand Down Expand Up @@ -2272,7 +2272,7 @@ try // clang-format on

auto [instance_selection, status] = select_instances_and_react(operative_instances,
deleted_instances,
request->instances_snapshots(),
request->instance_snapshot_pairs(),
InstanceGroup::All,
require_existing_instances_reaction);

Expand All @@ -2281,7 +2281,7 @@ try // clang-format on
const bool purge = request->purge();
auto instances_dirty = false;

auto instance_snapshots_map = map_snapshots_to_instances(request->instances_snapshots());
auto instance_snapshots_map = map_snapshots_to_instances(request->instance_snapshot_pairs());
verify_snapshot_picks(instance_selection, instance_snapshots_map); // avoid deleting if any snapshot is missing

// start with deleted instances, to avoid iterator invalidation when moving instances there
Expand Down
4 changes: 2 additions & 2 deletions src/rpc/multipass.proto
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ message InstanceSnapshotPair {
}

message InfoRequest {
repeated InstanceSnapshotPair instances_snapshots = 1;
repeated InstanceSnapshotPair instance_snapshot_pairs = 1;
int32 verbosity_level = 3;
bool no_runtime_information = 4;
bool snapshots = 5;
Expand Down Expand Up @@ -425,7 +425,7 @@ message RestartReply {
}

message DeleteRequest {
repeated InstanceSnapshotPair instances_snapshots = 1;
repeated InstanceSnapshotPair instance_snapshot_pairs = 1;
bool purge = 2;
int32 verbosity_level = 3;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ auto make_info_function(const std::string& source_path = "", const std::string&

mp::InfoReply info_reply;

if (request.instances_snapshots(0).instance_name() == "primary")
if (request.instance_snapshot_pairs(0).instance_name() == "primary")
{
auto vm_info = info_reply.add_details();
vm_info->set_name("primary");
Expand Down

0 comments on commit 14a1fdc

Please sign in to comment.