mirror of
https://github.com/vmware/vsphere-automation-sdk-python.git
synced 2024-11-26 11:19:59 -05:00
Modified script to incorporate Review comments
This commit is contained in:
parent
ead9df5c42
commit
be3b51e4b7
@ -11,60 +11,20 @@
|
||||
* WARRANTIES OR CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY,
|
||||
* NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
"""
|
||||
import atexit
|
||||
|
||||
from com.vmware.vcenter.vm_client import Power
|
||||
from samples.vsphere.common import vapiconnect
|
||||
from samples.vsphere.common.sample_util import parse_cli_args_vm
|
||||
from samples.vsphere.common.sample_util import parse_cli_args
|
||||
from samples.vsphere.common.sample_util import pp
|
||||
from samples.vsphere.vcenter.setup import testbed
|
||||
|
||||
from samples.vsphere.vcenter.helper.vm_helper import get_vm
|
||||
from com.vmware.vcenter_client import VM
|
||||
|
||||
"""
|
||||
Demonstrates getting list of VMs present in vCenter
|
||||
|
||||
Sample Prerequisites:
|
||||
vCenter/ESX
|
||||
"""
|
||||
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
* *******************************************************
|
||||
* Copyright (c) VMware, Inc. 2016. All Rights Reserved.
|
||||
* *******************************************************
|
||||
*
|
||||
* DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, WHETHER ORAL OR WRITTEN,
|
||||
* EXPRESS OR IMPLIED. THE AUTHOR SPECIFICALLY DISCLAIMS ANY IMPLIED
|
||||
* WARRANTIES OR CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY,
|
||||
* NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
"""
|
||||
|
||||
from com.vmware.vcenter.vm.hardware.boot_client import Device as BootDevice
|
||||
from com.vmware.vcenter.vm.hardware_client import (
|
||||
Disk, Ethernet)
|
||||
from com.vmware.vcenter.vm.hardware_client import ScsiAddressSpec
|
||||
from com.vmware.vcenter.vm_client import (Power)
|
||||
from com.vmware.vcenter_client import VM
|
||||
from samples.vsphere.common import vapiconnect
|
||||
from samples.vsphere.common.sample_util import parse_cli_args
|
||||
from samples.vsphere.vcenter.setup import testbed
|
||||
|
||||
from samples.vsphere.vcenter.helper.vm_helper import get_vm
|
||||
|
||||
"""
|
||||
Demonstrates how to List the VMs present in a vCenter server:
|
||||
|
||||
Sample Prerequisites:
|
||||
- VC
|
||||
- ESX
|
||||
- datacenter
|
||||
"""
|
||||
|
||||
stub_config = None
|
||||
|
||||
cleardata = False
|
||||
|
||||
def setup(context=None):
|
||||
global stub_config, cleardata
|
||||
@ -74,6 +34,7 @@ def setup(context=None):
|
||||
username,
|
||||
password,
|
||||
skip_verification)
|
||||
#atexit.register(vapiconnect.logout, stub_config)
|
||||
|
||||
|
||||
def run():
|
||||
@ -83,7 +44,6 @@ def run():
|
||||
def list_vms(stub_config):
|
||||
"""
|
||||
List VMs present in server
|
||||
|
||||
"""
|
||||
vm_svc = VM(stub_config)
|
||||
list_of_vms = vm_svc.list()
|
||||
|
Loading…
Reference in New Issue
Block a user