Project

General

Profile

Actions

Bug #54289

open

rbd command struggles with zero length files and images

Added by Neil Wilson about 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
ceph cli
Target version:
-
% Done:

0%

Source:
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

The rbd import and clone options fail when referencing zero length sources.

[root@ps163 ~]# touch /tmp/img-blank
[root@ps163 ~]# rbd --id libvirt import /tmp/img-blank servers/srv-testy-vol
rbd: unable to get size of file/block device
Importing image: 0% complete...failed.
rbd: import failed: (25) Inappropriate ioctl for device
[root@ps163 ~]# rbd --version
ceph version 16.2.7 (dd0603118f56ab514f133c8d2e3adfc983942503) pacific (stable)

The workaround is to redirect the input

[root@ps163 ~]# rbd --id libvirt import - </tmp/img-blank servers/srv-testy-vol
Importing image: 100% complete...done

Clone similarly fails if the source is zero length

[root@ps163 ~]# rbd --id libvirt create -s 0 servers/img-blank
[root@ps163 ~]# rbd --id libvirt snap create servers/img-blank@base
Creating snap: 100% complete...done.
[root@ps163 ~]# rbd --id libvirt snap protect servers/img-blank@base
[root@ps163 ~]# rbd clone --id libvirt 'servers/img-blank@base' 'servers/srv-testy-vol'
2022-02-15T14:20:20.959+0000 7fd34634c700 -1 librbd::image::AttachParentRequest: 0x7fd32c06d8c0 handle_attach_parent: attach parent encountered an error: (22) Invalid argument
2022-02-15T14:20:20.959+0000 7fd34634c700 -1 librbd::image::CloneRequest: 0x555734c8e170 handle_attach_parent: failed to attach parent: (22) Invalid argument
rbd: clone error: (22) Invalid argument
[root@ps163 ~]# rbd --version
ceph version 16.2.7 (dd0603118f56ab514f133c8d2e3adfc983942503) pacific (stable)

There is no issue at all with files or images with a single byte in them.

No data to display

Actions

Also available in: Atom PDF