Skip to content

Commit

Permalink
rbd: fix import image path parsing on Windows
Browse files Browse the repository at this point in the history
When importing an image, the rbd command uses only the file name
and expects "/" to be used as a separator. On Windows, it will
use the entire path as image name since the path separator is not
the same.

This change updates it so that the "\\" path separator can be
properly handled as well.

Signed-off-by: Lucian Petrut <[email protected]>
  • Loading branch information
petrutlucian94 committed Nov 18, 2020
1 parent 00a5cd1 commit 1dbe03a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tools/rbd/action/Import.cc
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ int execute(const po::variables_map &vm,
if (vm.count(at::IMAGE_NAME)) {
deprecated_image_name = vm[at::IMAGE_NAME].as<std::string>();
} else {
deprecated_image_name = path.substr(path.find_last_of("/") + 1);
deprecated_image_name = path.substr(path.find_last_of("/\\") + 1);
}

std::string deprecated_snap_name;
Expand Down

0 comments on commit 1dbe03a

Please sign in to comment.