Skip to content

Commit 35cf8d2

Browse files
committed
ovirt-img: add name option for disk
Add '--name' option to the 'upload-disk' command to allow users to define a custom alias name for the new uploaded disk. If ommited, default behaviour remains, taking the source image filename as an alias. usage: ovirt-img upload-disk [-h] [-c CONFIG] [--engine-url ENGINE_URL] [--username USERNAME] [--password-file PASSWORD_FILE] [--cafile CAFILE] [--log-file LOG_FILE] [--log-level LOG_LEVEL] [--max-workers MAX_WORKERS] [--buffer-size BUFFER_SIZE] -s STORAGE_DOMAIN [-f {raw,qcow2}] [--preallocated] [--disk-id DISK_ID] [--name NAME] filename .... --name NAME Alias name for the new disk. If not specified, name will correspond with the image filename. Closes: oVirt#121 Signed-off-by: Albert Esteve <aesteve@redhat.com>
1 parent a7b9266 commit 35cf8d2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ovirt_imageio/client/_upload.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,14 @@ def register(parser):
5858
cmd.add_argument(
5959
"--disk-id",
6060
type=_options.UUID,
61-
help="A UUID for the new disk. If not specified oVirt will "
61+
help="A UUID for the new disk. If not specified, oVirt will "
6262
"create a new UUID.")
6363

64+
cmd.add_argument(
65+
"--name",
66+
help="Alias name for the new disk. If not specified, name will "
67+
"correspond with the image filename.")
68+
6469
cmd.add_argument(
6570
"filename",
6671
type=_options.File,
@@ -129,7 +134,7 @@ def _prepare(args):
129134
name = os.path.splitext(os.path.basename(img_info["filename"]))[0]
130135

131136
return DiskInfo(
132-
name=name,
137+
name=name if args.name is None else args.name,
133138
initial_size=initial_size,
134139
provisioned_size=img_info["virtual-size"],
135140
content_type=content_type,

0 commit comments

Comments
 (0)