Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

Commit 803d80f

Browse files
author
David Lutterkort
committed
Make the image.xml an argument, not a mandatory option
1 parent cb3bd56 commit 803d80f

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

virt-image

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ def get_graphics(domain, vnc, vncport, nographics, sdl, keymap, guest):
6969
### Option parsing
7070
def parse_args():
7171
parser = OptionParser()
72-
parser.add_option("-i", "--image", type="string", dest="image",
73-
action="callback", callback=cli.check_before_store,
74-
help=_("The XML description of the virtual image"))
72+
parser.set_usage("%prog [options] image.xml")
7573
parser.add_option("-n", "--name", type="string", dest="name",
7674
action="callback", callback=cli.check_before_store,
7775
help=_("Name of the guest instance"))
@@ -128,6 +126,10 @@ def parse_args():
128126
help=_("The zero-based index of the boot record to use"))
129127

130128
(options,args) = parser.parse_args()
129+
if len(args) < 1:
130+
parser.error(_("You need to provide an image XML descriptor"))
131+
options.image = args[0]
132+
131133
return options
132134

133135
def parse_image_xml(fname):

0 commit comments

Comments
 (0)