首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >VMWare --服务器在VM上上载时出错500

VMWare --服务器在VM上上载时出错500
EN

Stack Overflow用户
提问于 2012-12-06 11:07:15
回答 1查看 5.1K关注 0票数 0

假设我有两个“物理”ESX,它们都是由vSphere服务器领导的。我想要做的是运行一个脚本,它将一个文件上传到一个指定的VM。因此,基本上,我使用了由VIFS.pl社区提供的VMWare脚本,其文档可以在这里获得:http://pubs.vmware.com/vsphere-51/index.jsp?topic=%2Fcom.vmware.vcli.ref.doc%2Fvifs.html,代码源代码在这里:http://communities.vmware.com/docs/DOC-10774

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

do_put()函数

代码语言:javascript
复制
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 !";
   }
}

**追踪**

代码语言:javascript
复制
# 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_put_file函数中作为参数传递的所有变量的值,它们都是正确的。

如果有人经历过这个问题,我会很感激的.

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-12-13 17:40:57

我知道一些VMware,但必须承认,我从来没有尝试过做您在这里所做的事情,但我确实有一个想法要与您分享。

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

代码语言:javascript
复制
    Client-Peer: 192.168.20.2:443

我猜想,可能在VM上的VMware证书与那些VM添加到的域不匹配(或者它们没有添加到域中)。证书看起来来自“localhost.localdom”:

代码语言:javascript
复制
    CN=localhost.localdom

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

代码语言:javascript
复制
    --listds | -S

也许他们不需要SSL来连接,因为它没有经过HTTPS?这可能会验证证书确实导致了您的问题?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13742290

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档