vSphere

  • 1.  Authentication timed out?

    Posted Nov 20, 2009 09:26 AM

    Hi,

    I'm trying to snapshot some VM's via vcbmounter.exe from a perl script. The first backup works fine, but on the second I got a authentication failure. I use this code in the beginning of the script for authentication (how do code tags work here?):

    eval ;

    if ($@) {

    1. error

    print LOG $@ . "\n";

    }

    This seems to work, since the first VM gets backup'ed. It takes about 1:15h, since in the first run I got an error about it not being able two write back the backup date to a custom field, I added exactly the same authentication into the loop after the backup. So the login should be valid when the next one starts. However I do get a

    SOAP Fault:

    -


    Fault string: Die Sitzung wurde nicht authentifiziert.

    Fault detail: NotAuthenticatedFault

    (the first one translates into "session not authenticated")

    Before I had added the additional authenication into the loop, I just would get a "Unable to find VM " from this within the loop:

    my $vm = Vim::find_entity_view(view_type => 'VirtualMachine',

    filter => {"config.name" => $_});

    unless ($vm) {

    print "Unable to find VM: \"$_\"!\n";

    exit 1

    }

    So it seems the authentication works fine for the first backup, and then times out. But why does the same authentication code from the start of the script not work again? How would I reauthenticate?

    I've attached the script if anyone wants to take a look...

    Lars



  • 2.  RE: Authentication timed out?

    Posted Nov 24, 2009 03:10 PM

    Your backup is taking about an hour, so I think you are indeed running timeout problems for your VI Perl Toolkit session. Have a look at or try searching the forums for timeout issues, there are quite a few threads on this topic (for instance ). If you can't come up with a heartbeat to keep your session alive, maybe you simply need to issue a Vim::logout before issuing another Vim::login?

    HTH

    Sebastian

    P.S.: You know about ghettoVCBg2.pl? It doesn't deal with custom fields as your script does, but i provides a ready-to-use simplistic backup solution.



  • 3.  RE: Authentication timed out?

    Posted Jan 19, 2010 09:18 AM

    finally I got some time again to look into this.

    hm, funny... I searched the forums for "perl timeout", and get 10 nonhelpful results of all sorts, none of them refers to perl. I even don't find this thread. These forums are quote strange, and I'm on a lot of forums without any problems :smileywink: