saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Install Salt from the Salt package repositories here:
https://docs.saltproject.io/salt/install-guide/en/latest/
Apache License 2.0
14.22k stars 5.49k forks source link

Getting error: [Object Not Found]: Could not find a VM named 'windows7Server64Guest' Error: There was a profile error: Failed to deploy VM, using salt-cloud command.... #33136

Closed akshya-github closed 6 years ago

akshya-github commented 8 years ago

Description of Issue/Question

using this command to create VM:

salt-cloud -p vmware-Win2K8 vmware-Win2K8

here: vmware-Win2K8 is profile name.

Setup

Want to create VM on: VMWARE vSphere ESXi 5.5.

In Provider configuration:

Driver: vsphere 

Profile configuration:-

vmware-Win2K8:
 provider: my-vsphere-config
 num_cpus: 2
 memory: 4GB
  devices:
  cd:
   CD/DVD drive 1:
   device_type: datastore_iso_file
   iso_path: "[DataStore] /ISO/Windows_server_2008_r2.iso"
  disk:
   Hard disk 1:
    size: 30
  network:
   Network adapter 1:
    name: eth007
    switch_type: standard
    ip: 192.168.110.201
    gateway: [192.168.110.211]
    subnet_mask: 255.255.255.0
 dns_servers:
  -8.8.8.8
 resourcepool: MyResources
 datastore: Datastore
 host: 192.168.109.213
 template: False
 power_on: True

 deploy: True
 #private_key: /root/.ssh/mykey.pem
 #ssh_username: cloud-user
 #password: 'Admin@123'
 minion:
  master: 192.168.104.111
 #file_map:
  #/path/to/local/custom/script: /path/to/remote/script
  #/path/to/local/file: /path/to/remote/file
  #/srv/salt/yum/epel.repo: /etc/yum.repos.d/epel.repo
 hardware_version: 8
 image: windows7Server64Guest
 win_username: Admin
 win_password: 'Admin@123'
 win_installer: "[Data store] /ISO/Salt-Minion-2015.8.8-2-AMD64-Setup.exe"

Steps to Reproduce Issue

(Include debug logs if possible and relevant.)

Versions Report

Salt Version:
            Salt: 2015.8.8.2

Dependency Versions:
 Apache Libcloud: 0.20.0
          Jinja2: 2.7.2
        M2Crypto: Not Installed
            Mako: Not Installed
          PyYAML: 3.11
           PyZMQ: 14.7.0
          Python: 2.7.5 (default, Nov 20 2015, 02:00:19)
            RAET: Not Installed
         Tornado: 4.2.1
             ZMQ: 4.0.5
            cffi: 1.6.0
        cherrypy: 3.2.2
        dateutil: Not Installed
           gitdb: Not Installed
       gitpython: Not Installed
           ioflo: Not Installed
         libgit2: Not Installed
         libnacl: Not Installed
    msgpack-pure: Not Installed
  msgpack-python: 0.4.6
    mysql-python: Not Installed
       pycparser: 2.14
        pycrypto: 2.6.1
          pygit2: Not Installed
    python-gnupg: Not Installed
           smmap: Not Installed
         timelib: 0.2.4
jfindlay commented 8 years ago

@akshya-github, thanks for reporting. Is it possible for you to post the output of salt-cloud -l debug -p vmware-Win2K8 vmware-Win2K8?

akshya-github commented 8 years ago

@jfindlay, Sure...Please find the attachment. err.txt

I am getting desired output for these commands:

salt-cloud --query salt-cloud --list-locations my-vsphere-config

This means I am able to connect "vSphere ESXi" Server.

jfindlay commented 8 years ago

@akshya-github, thanks for the extra information. Ping @nmadhok.

nmadhok commented 8 years ago

@akshya-github Change your driver to vmware instead of vsphere in your provider configuration. The vsphere driver is no longer supported and will be removed in Salt Carbon release. Looking at your logs:

[WARNING ] /usr/lib/python2.7/site-packages/salt/cloud/clouds/vsphere.py:143: DeprecationWarning: The vsphere driver is deprecated in favor of the vmware driver and will be removed in Salt Carbon. Please convert your vsphere provider configs to use the vmware driver.

The traceback confirms that it's trying to use the vsphere driver which uses a deprecated and unsupported library (pysphere) instead of using the vmware driver:

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/salt/cloud/clouds/vsphere.py", line 311, in create
    template = conn.get_vm_by_name(vm_['image'])
  File "/usr/lib/python2.7/site-packages/pysphere/vi_server.py", line 323, in get_vm_by_name
    FaultTypes.OBJECT_NOT_FOUND)

Here's documentation on how to use the vmware cloud driver: https://docs.saltstack.com/en/latest/topics/cloud/vmware.html https://docs.saltstack.com/en/latest/ref/clouds/all/salt.cloud.clouds.vmware.html

akshya-github commented 8 years ago

@nmadhok, I have changed driver to 'vmware', Now I am not able to connect vSphere server.

Provider file looks like:

my-vsphere-config: driver: vmware user: 'root' password: 'Admin@123' url: 'https://192.168.8.28:443/sdk' esxi_host_user: 'root' esxi_host_password: 'Admin@123' esxi_host_ssl_thumbprint: '1E:3D:48:38:C1:FC:1D:9D:2C:B8:A7:08:A7:84:12:F8:59:B4:29:32'

Provider is: VMware vSphere 5 Hypervisor

I have tried with different urls like:

url: 'https://192.168.8.28:443/' https://192.168.8.28:9443/admin-app https://192.168.8.28:9443/vsphere-client

nmadhok commented 8 years ago

@akshya-github The document I listed before clearly lists an example for how providers config file should look like:

vcenter01:
  driver: vmware
  user: 'DOMAIN\user'
  password: 'verybadpass'
  url: 'vcenter01.domain.com'
  protocol: 'https'
  port: 443

In your case it should be the following (protocol https and port 443 are the defaults):

my-vmware-config:
  driver: vmware
  user: 'root'
  password: 'Admin@123'
  url: '192.168.8.28'
akshya-github commented 8 years ago

Thanks Bro,

A little error is still there: [ERROR ] There was a profile error: argument of type 'NoneType' is not iterable

can you please help me..!!

akshya-github commented 8 years ago

[INFO ] salt-cloud starting [INFO ] Creating Test2 from vm(Win2k12-R2-DS Client) [ERROR ] Error creating Test2: (vmodl.fault.NotSupported) { dynamicType = , dynamicProperty = (vmodl.DynamicProperty) [], msg = 'The operation is not supported on the object.', faultCause = , faultMessage = (vmodl.LocalizableMessage) [] } Test2:

Error:
    Error creating Test2: (vmodl.fault.NotSupported) {
       dynamicType = <unset>,
       dynamicProperty = (vmodl.DynamicProperty) [],
       msg = 'The operation is not supported on the object.',
       faultCause = <unset>,
       faultMessage = (vmodl.LocalizableMessage) []
    }
nmadhok commented 8 years ago

Need to look at the debug log. Looks like you are trying to do a clone operation on an ESXi which is only supported through a vCenter.

akshya-github commented 8 years ago

Yes....OK !! Can I create vm without cloning, using iso image. Basically, I am trying to create vm using salt-cloud on vmware vSphere 5.

What should be the profile options? When I remove clonefrom option, It throws an error: [ERROR ] The required 'clonefrom' configuration setting is missing from the 'my-vm' profile, which is configured under the 'my-vsphere-config' alias. Error: There was a profile error: Failed to deploy VM

akshya-github commented 8 years ago

@nmadhok, Below are the log:

[root@localhost cloud.profiles.d]# salt-cloud -p vmware-Win2K12 test18 -l debug [DEBUG ] Reading configuration from /etc/salt/cloud [DEBUG ] Reading configuration from /etc/salt/master [DEBUG ] Using cached minion ID from /etc/salt/minion_id: 192.168.9.139 [DEBUG ] Key 'file_ignore_glob' with value None has an invalid type of NoneType, a list is required for this value [DEBUG ] Missing configuration file: /etc/salt/cloud.providers [DEBUG ] Including configuration from '/etc/salt/cloud.providers.d/vsphere.conf' [DEBUG ] Reading configuration from /etc/salt/cloud.providers.d/vsphere.conf [DEBUG ] Missing configuration file: /etc/salt/cloud.profiles [DEBUG ] Including configuration from '/etc/salt/cloud.profiles.d/mynewvm.conf' [DEBUG ] Reading configuration from /etc/salt/cloud.profiles.d/mynewvm.conf [DEBUG ] Including configuration from '/etc/salt/cloud.profiles.d/new.conf' [DEBUG ] Reading configuration from /etc/salt/cloud.profiles.d/new.conf [DEBUG ] Including configuration from '/etc/salt/cloud.profiles.d/vsphere.conf' [DEBUG ] Reading configuration from /etc/salt/cloud.profiles.d/vsphere.conf [DEBUG ] Including configuration from '/etc/salt/cloud.profiles.d/vsphere_BKP.conf' [DEBUG ] Reading configuration from /etc/salt/cloud.profiles.d/vsphere_BKP.conf [DEBUG ] Configuration file path: /etc/salt/cloud [WARNING ] Insecure logging configuration detected! Sensitive data may be logged. [INFO ] salt-cloud starting [DEBUG ] Could not LazyLoad parallels.avail_sizes [DEBUG ] LazyLoaded parallels.avail_locations [DEBUG ] LazyLoaded proxmox.avail_sizes [DEBUG ] Could not LazyLoad saltify.destroy [DEBUG ] Could not LazyLoad saltify.avail_sizes [DEBUG ] Could not LazyLoad saltify.avail_images [DEBUG ] Could not LazyLoad saltify.avail_locations [DEBUG ] LazyLoaded rackspace.reboot [DEBUG ] LazyLoaded openstack.list_locations [DEBUG ] LazyLoaded rackspace.list_locations [DEBUG ] Could not LazyLoad vmware.optimize_providers [DEBUG ] The 'vmware' cloud driver is unable to be optimized. [DEBUG ] Could not LazyLoad parallels.avail_sizes [DEBUG ] LazyLoaded parallels.avail_locations [DEBUG ] LazyLoaded proxmox.avail_sizes [DEBUG ] Could not LazyLoad saltify.destroy [DEBUG ] Could not LazyLoad saltify.avail_sizes [DEBUG ] Could not LazyLoad saltify.avail_images [DEBUG ] Could not LazyLoad saltify.avail_locations [DEBUG ] LazyLoaded rackspace.reboot [DEBUG ] LazyLoaded openstack.list_locations [DEBUG ] LazyLoaded rackspace.list_locations [DEBUG ] Generating minion keys for 'test18' [ERROR ] The required 'clonefrom' configuration setting is missing from the 'vmware-Win2K12' profile, which is configured under the 'my-vsphere-config' alias. Error: There was a profile error: Failed to deploy VM

nmadhok commented 8 years ago

@akshya-github The ability to create VM's from scratch was recently added to Salt develop branch. I don't see that it was back ported to 2015.8 branch. You can either test it by installing Salt from latest develop branch or you can wait for the next Salt release.

akshya-github commented 8 years ago

Thanks @nmadhok !!.. I am able to create VM using clonefrom option in VMWARE VCenter, but VM is not getting IP specified in Profile and getiing apipa address. How i can resolve this?

I am cloning from sysprep Windows server 2012r2. This is the network setting in profile:

network: Network adapter 1: name: VM Network switch_type: standard ip: 192.168.139.23 gateway: 192.168.139.1 subnet_mask: 255.255.255.0

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.