]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: fix import image path parsing on Windows
authorLucian Petrut <lpetrut@cloudbasesolutions.com>
Wed, 6 May 2020 10:59:39 +0000 (10:59 +0000)
committerLucian Petrut <lpetrut@cloudbasesolutions.com>
Wed, 18 Nov 2020 10:31:24 +0000 (10:31 +0000)
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 <lpetrut@cloudbasesolutions.com>
src/tools/rbd/action/Import.cc

index f8d2f936ffafdc47a52e1146c43a1826a7a4e4ee..0cdf3b713f8e05dca73964304f526cb34c808869 100644 (file)
@@ -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;