VMWare—尝试在VM上上载时服务器出现错误500

VMWare—尝试在VM上上载时服务器出现错误500,vmware,vmware-server,esx,Vmware,Vmware Server,Esx,假设我有两个“物理”ESX,它们都由vSphere服务器负责。我试图做的是运行一个脚本,将文件上传到指定的VM。因此,基本上,我使用VMWare社区提供的VIFS.pl脚本,其文档在这里提供:代码源在这里: 源代码非常简单,它只是使用了VIExt模块中的http\u put\u file()函数,而这个函数实际上对我来说失败了,因为我得到了一个错误500,其日志在这里(我通过打印$resp->as_string()得到它): do_put()函数 sub do_put { my ($loc

假设我有两个“物理”ESX,它们都由vSphere服务器负责。我试图做的是运行一个脚本,将文件上传到指定的VM。因此,基本上,我使用VMWare社区提供的VIFS.pl脚本,其文档在这里提供:代码源在这里:

源代码非常简单,它只是使用了
VIExt
模块中的
http\u put\u file()
函数,而这个函数实际上对我来说失败了,因为我得到了一个错误500,其日志在这里(我通过打印
$resp->as_string()
得到它):

do_put()函数

sub do_put {
   my ($local_source, $remote_target, $datacenter) = @_;
   my ($mode, $dc, $ds, $filepath) = VIExt::parse_remote_path($remote_target);
   # bug 322577
   if (defined $local_source  and -d $local_source) {
      VIExt::fail("Error: File to be uploaded cannot be a folder.");
   }

   # bug 266936
   unless (-e $local_source) {
      VIExt::fail("Error: File $local_source does not exist.");
   }

   my $resp = VIExt::http_put_file($mode, $local_source, $filepath, $ds, $datacenter);
   # bug 301206
   print $resp->as_string();   # => Trace
   if ($resp && $resp->is_success) {
      print "Uploaded file $local_source to $filepath successfully.\n";
   } else {
      print "Failed to upload !";
   }
}
**痕迹**

# vSphere server : @192.168.20.2
# Datastore : nfs
# Datacenter : dc
# Target VM name : target_vm
# Target filename : VM.txt

>> perl vifs --server 192.168.20.2 --username root  --password root -p "/tmp/foo.txt" "[nfs] target_vm/VM.txt" -Z "dc"

HTTP/1.1 500 Internal Server Error
Connection: close
Date: Thu, 6 Dec 2012 10:32:30 GMT
Content-Length: 0
Content-Type: text; charset=plain
Client-Date: Thu, 06 Dec 2012 11:32:53 GMT
Client-Peer: 192.168.20.2:443
Client-Response-Num: 9
Client-SSL-Cert-Issuer: /C=US/ST=California/L=Palo Alto/O=VMware, Inc./CN=localhost.localdom CA 26fc6343/emailAddress=ssl-certificates@vmware.com
Client-SSL-Cert-Subject: /C=US/ST=California/L=Palo Alto/O=VMware, Inc./OU=VMware vCenter Server Certificate/emailAddress=ssl-certificates@vmware.com/CN=localhost.localdom/unstructuredName=1352217590,031bd875,564d7761726520496e632e
Client-SSL-Cipher: AES256-SHA
Client-SSL-Socket-Class: IO::Socket::SSL
Client-SSL-Warning: Peer certificate not verified

Failed to upload !
请注意,我检查了
http\u put\u file
函数中作为参数传递的所有变量的值,它们都是正确的


如果有人遇到过此问题,我将不胜感激……

我了解一些VMware,但不可否认,我从未尝试过做您在这里所做的事情,但我确实有一个想法要与您分享

如果我没有弄错的话,您的物理ESX主机(192.168.20.2)正在尝试将文件放置到您的VM(target_VM)上。因为通信是通过端口443进行的

    Client-Peer: 192.168.20.2:443
我猜您的虚拟机上的VMware证书可能与这些虚拟机已添加到的域(或未添加到域)不匹配。证书看起来来自“localhost.localdom”:

    CN=localhost.localdom
如果您的域中还没有证书颁发机构,那么您可以快速为您的域创建一个自签名证书,并将其放置在适当的证书存储中。您可能还想尝试其他一些API调用,如:

    --listds | -S
也许他们不需要SSL来连接,因为它不通过HTTPS?这可能会验证证书是否确实导致了您的问题