Hi Cole Thank you for a review and suggestion. > Patch looks fine to me. A small nitpick though: I'd change "Do you > really want to use the disk?" to "Do you really want to use this file?" > and add a newline at the start of the line to prevent it from wrapping. > Because I think that your suggestion is reasonable, I remake this patch. And I find the another point that had better add a new line. So this patch adds a new line to there. Thanks, Masayuki Sunou. ---------------------------------------------------------------------- diff -r 645217bda13b virt-install --- a/virt-install Sat Jul 21 13:03:07 2007 -0400 +++ b/virt-install Fri Jul 27 10:01:20 2007 +0900 @@ -48,6 +48,23 @@ def get_disk(disk, size, sparse, guest, if not size is None: msg = _("Please enter the path to the file you would like to use for storage. It will have size %sGB.") %(size,) disk = cli.prompt_for_input(msg, disk) + if os.path.exists(disk) and os.path.isfile(disk): + while 1: + retryFlg = False + warnmsg = _("You are going to overwrite file '%s'!\n") % disk + res = cli.prompt_for_input(warnmsg + _("Do you really want to use the file (yes or no)? ")) + try: + if cli.yes_or_no(res) is True: + break + else: + retryFlg = True + break + except ValueError, e: + print _("ERROR: "), e + continue + if retryFlg is True: + disk = None + continue while 1: if os.path.exists(disk): break @@ -64,8 +81,8 @@ def get_disk(disk, size, sparse, guest, if d.is_conflict_disk(conn) is True: while 1: retryFlg = False - warnmsg = _("Disk %s is already in use by another guest!") % disk - res = cli.prompt_for_input(warnmsg + _(" Do you really want to use the disk (yes or no)? ")) + warnmsg = _("Disk %s is already in use by another guest!\n") % disk + res = cli.prompt_for_input(warnmsg + _("Do you really want to use the disk (yes or no)? ")) try: if cli.yes_or_no(res) is True: break ---------------------------------------------------------------------- In message <46A75C03.8050404@xxxxxxxxxx> "Re: [PATCH] check the existing file in virt-install" "Cole Robinson <crobinso@xxxxxxxxxx>" wrote: > Masayuki Sunou wrote: > > Hi > > > > When the existing file is specified with virt-install, the file is > > compulsorily overwrited. > > Therefore the important file may be overwrited when a user makes a typo. > > > > This patch fixes so that virt-install displays warning message when > > the existing file is specified. > > > > Signed-off-by: Masayuki Sunou <fj1826dm@xxxxxxxxxxxxxxxxx> > > > > Thanks, > > Masayuki Sunou. > > Patch looks fine to me. A small nitpick though: I'd change "Do you > really want to use the disk?" to "Do you really want to use this file?" > and add a newline at the start of the line to prevent it from wrapping. > > - Cole > > -- > Cole Robinson > crobinso@xxxxxxxxxx > > _______________________________________________ > et-mgmt-tools mailing list > et-mgmt-tools@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/et-mgmt-tools _______________________________________________ et-mgmt-tools mailing list et-mgmt-tools@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/et-mgmt-tools