4 Replies Latest reply on Apr 7, 2011 10:10 AM by skayser

    Feature request: per-VM logfile, single VM at command line

    MillardJK Enthusiast
    vExpert

      Two requests that I'd like to see implemented:

      1. instead of putting all the logging into a single file (that may or may not get emailed), I'd like the ability to create a logfile per VM, appending as it goes. Even some sort of "macro substitution" would be nice.
      2. While I will certainly use the list-of-VMs mode for regular backups, there are times (especially during testing) that I want to backup an arbitrary VM; an option to let my specify a single VM as an argument would be awesome for those times I want to do an arbitrary manual backup.
        • 1. Re: Feature request: per-VM logfile, single VM at command line
          lamw Guru
          VMware EmployeesCommunity Warriors

          Hi,

           

          I'll take #1 into consideration, would backing up the log to the VM backup directory work for you?

           

          Regarding #2, you can easily just create a "test" file that contains the VMs you would like to backup

          • 2. Re: Feature request: per-VM logfile, single VM at command line
            MillardJK Enthusiast
            vExpert

            For #1: dropping the logfile into the backup dir would be awesome. I still like getting an email when the backup is completed, so I'd guess that the user would want a little more control over the log (location, append/clobber, rm after email, etc) that would actually be independent of the email function. Personally, if I have to choose between getting the email and getting the logfile along with the backup, I'll take the email.

             

            For #2, I've been doing:

             

            echo MyVM > MyVM; ./ghettoVCBg2.pl --vmlist MyVM; rm MyVM

             

            but it just doesn't seem as clean as a simple --guest "MyVM" would be. Plus, doing the latter would also make it easier to jump in, start the backup in a disconnected session and jump back out.

             

            Maybe I'll just write a wrapper script or alias to do it for me .

             

            Another thing that I've added to my local copy: When looping through the text list to add VMs to the working list, you look for a colon at the beginning or end of the VM name [if($line =~ /^\s*:|:\s*$/){...]. I've added another check following that for a leading hash (#) so that I can readily comment-out a guest from the backup (or add comment lines within the list for other reasons) if I want to temporarily remove it from processing but don't want to throw an error.

             

             

            Thanks for all the work!

            • 3. Re: Feature request: per-VM logfile, single VM at command line
              lamw Guru
              Community WarriorsVMware Employees

              Thanks for the info, I'll take a look when I get a chance on individual VM backup log.

               

              For #2, I'll see if the logic fits in, since most users will be backing up more than one VM, it didn't make sense to support this functionality and even with testing, it's pretty easy/trivial to echo a dummy VM for testing into a file

               

              Also, you're right, the parsing of the input file can be done in a better fashion, I haven't updated that code in awhile but something like the following would allow for your own comments/etc.

               

                      open(CONFIG, "$conf") || die "Error: Couldn't open the $conf!";
                      while (<CONFIG>) {
                              chomp;
                              s/#.*//; # Remove comments
                              s/^\s+//; # Remove opening whitespace
                              s/\s+$//;  # Remove closing whitespace

                      }

              • 4. Re: Feature request: per-VM logfile, single VM at command line
                skayser Enthusiast

                Re: #2, while there's no built-in option to specify a list of VMs on the command line, you can use bash's process substitution to backup a single VM.

                 

                ./ghettoVCBg2.pl --vmlist <( echo yourvmname )

                 

                The output of the command enclosed in parantheses will be available as /dev/fd/X and gvcb will thus happily read it's "vmlist file".