diff --git a/qemu-img.c b/qemu-img.c index 059bf42fc1bd7919ad2c0459e504afec7f9bf0b4..59f0f4960819a9ef9129cb52b42341d27bca9e37 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -496,12 +496,27 @@ static int64_t cvtnum(const char *name, const char *value) return cvtnum_full(name, value, 0, INT64_MAX); } +static bool startwith_rbd_dev(const char *filename) +{ + const char *blk = "/dev"; + const char *rbd = "rbd:"; + + if (strncmp(filename, blk, strlen(blk)) == 0 || + strncmp(filename, rbd, strlen(rbd)) == 0) { + return true; + } + return false; +} + static bool is_reg_file(const char *filename) { struct stat st; /* file not exist, file will be create later, so it's a reg file */ if (access(filename, F_OK) == -1) { + if (startwith_rbd_dev(filename)){ + return false; + } return true; }