Skip to content

Commit

Permalink
Merge pull request #24003 from pdvian/wip-35704-luminous
Browse files Browse the repository at this point in the history
luminous: rbd: fix error import when the input is a pipe

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
  • Loading branch information
yuriw committed Sep 17, 2018
2 parents 44a54c4 + 0a2ea85 commit efa7288
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/tools/rbd/action/Import.cc
Expand Up @@ -639,18 +639,14 @@ static int decode_imagemeta(int fd, uint64_t length, std::map<std::string, std::
return 0;
}

static int do_import_header(int fd, int import_format, uint64_t &size, librbd::ImageOptions& opts,
static int do_import_header(int fd, int import_format, librbd::ImageOptions& opts,
std::map<std::string, std::string>* imagemetas)
{
// There is no header in v1 image.
if (import_format == 1) {
return 0;
}

if (fd == STDIN_FILENO || size < utils::RBD_IMAGE_BANNER_V2.size()) {
return -EINVAL;
}

int r;
r = validate_banner(fd, utils::RBD_IMAGE_BANNER_V2);
if (r < 0) {
Expand Down Expand Up @@ -885,7 +881,7 @@ static int do_import(librados::Rados &rados, librbd::RBD &rbd,
#endif
}

r = do_import_header(fd, import_format, size, opts, &imagemetas);
r = do_import_header(fd, import_format, opts, &imagemetas);
if (r < 0) {
std::cerr << "rbd: import header failed." << std::endl;
goto done;
Expand Down

0 comments on commit efa7288

Please sign in to comment.