mirror of
https://github.com/vmware/vsphere-automation-sdk-python.git
synced 2024-11-29 20:09:58 -05:00
Mis changes
1. Use '_' to replace ' ' for objects in testbed.py 2. Update the path in README 3. Add README to sso and lib folder
This commit is contained in:
parent
af0f3f2634
commit
92c794364d
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,4 @@
|
|||||||
|
*.py[cod]
|
||||||
|
__pycache__/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.idea/*
|
.idea/*
|
||||||
|
@ -57,7 +57,7 @@ Before executing the samples we'll need to setup the vSphere test environment us
|
|||||||
|
|
||||||
First, from the command line change to the SDK ./bin folder.
|
First, from the command line change to the SDK ./bin folder.
|
||||||
|
|
||||||
$ cd /path/to/VMware-vSphere-Automation-SDK-Python-<version>/bin
|
$ cd /path/to/vsphere-automation-sdk-python-samples/bin
|
||||||
|
|
||||||
Next, using a text editor open ../samples/vsphere/vcenter/setup/testbed.py and edit the following settings replace everything in < > brackts with your environment information. Leave the rest of the settings in this file at their default values.
|
Next, using a text editor open ../samples/vsphere/vcenter/setup/testbed.py and edit the following settings replace everything in < > brackts with your environment information. Leave the rest of the settings in this file at their default values.
|
||||||
|
|
||||||
|
@ -163,10 +163,10 @@ You have two options to run samples inside this package:
|
|||||||
<ul>
|
<ul>
|
||||||
<li><code>$ cd /path/to/VMware-vSphere-Automation-SDK-Python-<version>/client/bin</code></li>
|
<li><code>$ cd /path/to/VMware-vSphere-Automation-SDK-Python-<version>/client/bin</code></li>
|
||||||
<li>Run the sample with the testbed settings specified in setup.py in a Linux machine:<br/>
|
<li>Run the sample with the testbed settings specified in setup.py in a Linux machine:<br/>
|
||||||
<code>$ ./run_sample.sh ../samples/src/vsphere/samples/vcenter/vm/create/create_default_vm.py -v</code>
|
<code>$ ./run_sample.sh ../samples/src/samples/vsphere/vcenter/vm/create/create_default_vm.py -v</code>
|
||||||
</li>
|
</li>
|
||||||
<li>Or specify the credentials using command line parameters:<br/>
|
<li>Or specify the credentials using command line parameters:<br/>
|
||||||
<code>$ ./run_sample.sh ../samples/src/vsphere/samples/vcenter/vm/create/create_default_vm.py -s <server> -u <username> -p <password> -v</code>
|
<code>$ ./run_sample.sh ../samples/src/samples/vsphere/vcenter/vm/create/create_default_vm.py -s <server> -u <username> -p <password> -v</code>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
@ -244,9 +244,9 @@ vApi connection workflow sample performs the following basic steps to connect
|
|||||||
|
|
||||||
The call sequence shown above is implemented in the samples framework through the following modules:</br>
|
The call sequence shown above is implemented in the samples framework through the following modules:</br>
|
||||||
<ul>
|
<ul>
|
||||||
<li><code>src/vsphere/samples/common/lookup_service_helper</code> provides methods for discovering management nodes and service endpoint URLs on management nodes from lookup service.</li>
|
<li><code>src/samples/vsphere/common/lookup_service_helper</code> provides methods for discovering management nodes and service endpoint URLs on management nodes from lookup service.</li>
|
||||||
<li><code>src/vsphere/samples/common/platform_service_controller</code> uses lookup_service_helper to discover the Single Sign-On URL (on any of the Platform Service Controller node) and then retrieves the SAML token from the Single Sign-On server by authenticating the given user.</li>
|
<li><code>src/samples/vsphere/common/platform_service_controller</code> uses lookup_service_helper to discover the Single Sign-On URL (on any of the Platform Service Controller node) and then retrieves the SAML token from the Single Sign-On server by authenticating the given user.</li>
|
||||||
<li><code>src/vsphere/samples/common/service_manager</code> login to the vAPI and vim service endpoints (on a management node).</li>
|
<li><code>src/samples/vsphere/common/service_manager</code> login to the vAPI and vim service endpoints (on a management node).</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h3>Running the Connection Workflow Samples:</h3>
|
<h3>Running the Connection Workflow Samples:</h3>
|
||||||
@ -311,7 +311,7 @@ Before running the samples:
|
|||||||
</p>
|
</p>
|
||||||
<pre>
|
<pre>
|
||||||
$cd /path/to/VMware-vSphere-Automation-SDK-Python-<version>/client/bin
|
$cd /path/to/VMware-vSphere-Automation-SDK-Python-<version>/client/bin
|
||||||
$run_sample.sh ../samples/src/vsphere/samples/workflow/connection_workflow.py \
|
$run_sample.sh ../samples/src/samples/vsphere/workflow/connection_workflow.py \
|
||||||
-vapiurl https://203.0.113.0/api \
|
-vapiurl https://203.0.113.0/api \
|
||||||
-stsurl https://203.0.113.0:443/sts/STSService/vsphere.local \
|
-stsurl https://203.0.113.0:443/sts/STSService/vsphere.local \
|
||||||
-username administrator@vsphere.local \
|
-username administrator@vsphere.local \
|
||||||
@ -322,7 +322,7 @@ $run_sample.sh ../samples/src/vsphere/samples/workflow/connection_workflow.py \
|
|||||||
Use the -h option to print information about a sample.
|
Use the -h option to print information about a sample.
|
||||||
The following example shows the help for the vAPI connection workflow sample.
|
The following example shows the help for the vAPI connection workflow sample.
|
||||||
<pre>
|
<pre>
|
||||||
$ ./run_sample.sh ../samples/src/vsphere/samples/workflow/vapi_connection_workflow.py -h
|
$ ./run_sample.sh ../samples/src/samples/vsphere/workflow/vapi_connection_workflow.py -h
|
||||||
usage: vapi_connection_workflow.py [-h] [-w LSWSDLURL] [-s LSSOAPURL]
|
usage: vapi_connection_workflow.py [-h] [-w LSWSDLURL] [-s LSSOAPURL]
|
||||||
[-m MGMTINSTANCENAME] [-u USERNAME]
|
[-m MGMTINSTANCENAME] [-u USERNAME]
|
||||||
[-p PASSWORD] [-v]
|
[-p PASSWORD] [-v]
|
||||||
|
9
lib/README.md
Normal file
9
lib/README.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
This directory contains samples for Platform Service Controller, SSO and Lookup Service APIs:
|
||||||
|
|
||||||
|
Running the samples
|
||||||
|
|
||||||
|
* $ cd /path/to/vsphere-automation-sdk-python-samples/bin
|
||||||
|
* $ ./run_sample.sh ../samples/vsphere/tagging/tagging_workflow.py --server <vCenter Server IP> --username <username> --password <password> --clustername <clustername> --categoryname <categoryname> --categorydesc <categorydesc> --tagname <tagname> -tagdesc <tagdesc> -v
|
||||||
|
|
||||||
|
* Testbed Requirement:
|
||||||
|
- 1 vCenter Server
|
@ -18,7 +18,7 @@ from vmware.vapi.security.sso import create_saml_bearer_security_context
|
|||||||
from samples.vsphere.common import sso
|
from samples.vsphere.common import sso
|
||||||
from samples.vsphere.common.lookup_service_helper import LookupServiceHelper
|
from samples.vsphere.common.lookup_service_helper import LookupServiceHelper
|
||||||
|
|
||||||
from samples.common.ssl_helper import get_unverified_context
|
from samples.vsphere.common.ssl_helper import get_unverified_context
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ __copyright__ = 'Copyright 2013, 2016 VMware, Inc. All rights reserved.'
|
|||||||
from pyVim.connect import SmartConnect, Disconnect
|
from pyVim.connect import SmartConnect, Disconnect
|
||||||
from samples.vsphere.common import vapiconnect
|
from samples.vsphere.common import vapiconnect
|
||||||
|
|
||||||
from samples.common.ssl_helper import get_unverified_context
|
from samples.vsphere.common.ssl_helper import get_unverified_context
|
||||||
|
|
||||||
|
|
||||||
class ServiceManager(object):
|
class ServiceManager(object):
|
||||||
|
@ -75,6 +75,7 @@ def logout(stub_config):
|
|||||||
"""
|
"""
|
||||||
Delete session with vCenter.
|
Delete session with vCenter.
|
||||||
"""
|
"""
|
||||||
|
if stub_config:
|
||||||
session_svc = Session(stub_config)
|
session_svc = Session(stub_config)
|
||||||
session_svc.delete()
|
session_svc.delete()
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ __copyright__ = 'Copyright 2013, 2016 VMware, Inc. All rights reserved.'
|
|||||||
from pyVmomi import vim
|
from pyVmomi import vim
|
||||||
|
|
||||||
from samples.vsphere.common.sample_base import SampleBase
|
from samples.vsphere.common.sample_base import SampleBase
|
||||||
from samples.vsphere.common.vim.helpers import get_obj
|
from samples.vsphere.common.vim.helpers.vim_utils import get_obj
|
||||||
|
|
||||||
|
|
||||||
class GetClusterByName(SampleBase):
|
class GetClusterByName(SampleBase):
|
||||||
|
@ -16,7 +16,7 @@ __copyright__ = 'Copyright 2013, 2016 VMware, Inc. All rights reserved.'
|
|||||||
from pyVmomi import vim
|
from pyVmomi import vim
|
||||||
|
|
||||||
from samples.vsphere.common.sample_base import SampleBase
|
from samples.vsphere.common.sample_base import SampleBase
|
||||||
from samples.vsphere.common.vim.helpers import get_obj
|
from samples.vsphere.common.vim.helpers.vim_utils import get_obj
|
||||||
|
|
||||||
|
|
||||||
class GetDatastoreByName(SampleBase):
|
class GetDatastoreByName(SampleBase):
|
||||||
|
@ -10,8 +10,8 @@ This directory contains samples for Content Library APIs:
|
|||||||
|
|
||||||
Running the samples
|
Running the samples
|
||||||
|
|
||||||
* $ cd /path/to/VMware-vSphere-Automation-SDK-Python-<version>/bin
|
* $ cd /path/to/vsphere-automation-sdk-python-samples/bin
|
||||||
* $ ./run_sample.sh ../vsphere/samples/contentlibrary/<sample-dir>/<sample>.py --server <vCenter Server IP> --name <username> --password <password> <additional-sample-parameters>
|
* $ ./run_sample.sh ../samples/vsphere/contentlibrary/<sample-dir>/<sample>.py --server <vCenter Server IP> --username <username> --password <password> <additional-sample-parameters>
|
||||||
|
|
||||||
The additional sample parameters are as follows (all parameters can be displayed for any sample using option --help)
|
The additional sample parameters are as follows (all parameters can be displayed for any sample using option --help)
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ from com.vmware.content_client import LibraryModel
|
|||||||
|
|
||||||
from samples.vsphere.common.id_generator import generate_random_uuid
|
from samples.vsphere.common.id_generator import generate_random_uuid
|
||||||
from samples.vsphere.common.sample_base import SampleBase
|
from samples.vsphere.common.sample_base import SampleBase
|
||||||
from samples.vsphere.common.vim.helpers import get_datastore_id
|
from samples.vsphere.common.vim.helpers.get_datastore_by_name import get_datastore_id
|
||||||
from samples.vsphere.contentlibrary.lib.cls_api_client import ClsApiClient
|
from samples.vsphere.contentlibrary.lib.cls_api_client import ClsApiClient
|
||||||
|
|
||||||
__author__ = 'VMware, Inc.'
|
__author__ = 'VMware, Inc.'
|
||||||
|
@ -27,7 +27,7 @@ from com.vmware.content.library.item_client import (DownloadSessionModel,
|
|||||||
from com.vmware.content.library.item.downloadsession_client import File as DownloadSessionFile
|
from com.vmware.content.library.item.downloadsession_client import File as DownloadSessionFile
|
||||||
from com.vmware.content.library.item.updatesession_client import File as UpdateSessionFile
|
from com.vmware.content.library.item.updatesession_client import File as UpdateSessionFile
|
||||||
from samples.vsphere.common.id_generator import generate_random_uuid
|
from samples.vsphere.common.id_generator import generate_random_uuid
|
||||||
from samples.vsphere.common.vim.helpers import get_datastore_id
|
from samples.vsphere.common.vim.helpers.get_datastore_by_name import get_datastore_id
|
||||||
|
|
||||||
__author__ = 'VMware, Inc.'
|
__author__ = 'VMware, Inc.'
|
||||||
__copyright__ = 'Copyright 2016 VMware, Inc. All rights reserved.'
|
__copyright__ = 'Copyright 2016 VMware, Inc. All rights reserved.'
|
||||||
|
@ -23,7 +23,7 @@ from pyVmomi import vim
|
|||||||
|
|
||||||
from samples.vsphere.common.id_generator import generate_random_uuid
|
from samples.vsphere.common.id_generator import generate_random_uuid
|
||||||
from samples.vsphere.common.sample_base import SampleBase
|
from samples.vsphere.common.sample_base import SampleBase
|
||||||
from samples.vsphere.common.vim.helpers import (
|
from samples.vsphere.common.vim.helpers.vim_utils import (
|
||||||
get_obj, get_obj_by_moId, poweron_vm, poweroff_vm, delete_object)
|
get_obj, get_obj_by_moId, poweron_vm, poweroff_vm, delete_object)
|
||||||
from samples.vsphere.contentlibrary.lib.cls_api_client import ClsApiClient
|
from samples.vsphere.contentlibrary.lib.cls_api_client import ClsApiClient
|
||||||
from samples.vsphere.contentlibrary.lib.cls_api_helper import ClsApiHelper
|
from samples.vsphere.contentlibrary.lib.cls_api_helper import ClsApiHelper
|
||||||
|
@ -25,7 +25,7 @@ from samples.vsphere.common.id_generator import generate_random_uuid
|
|||||||
from samples.vsphere.common.sample_base import SampleBase
|
from samples.vsphere.common.sample_base import SampleBase
|
||||||
from samples.vsphere.contentlibrary.lib.cls_api_client import ClsApiClient
|
from samples.vsphere.contentlibrary.lib.cls_api_client import ClsApiClient
|
||||||
from samples.vsphere.contentlibrary.lib.cls_api_helper import ClsApiHelper
|
from samples.vsphere.contentlibrary.lib.cls_api_helper import ClsApiHelper
|
||||||
from samples.vsphere.common.vim.helpers import get_datastore_id
|
from samples.vsphere.common.vim.helpers.get_datastore_by_name import get_datastore_id
|
||||||
|
|
||||||
|
|
||||||
__author__ = 'VMware, Inc.'
|
__author__ = 'VMware, Inc.'
|
||||||
|
9
samples/vsphere/sso/README.md
Normal file
9
samples/vsphere/sso/README.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
This directory contains samples for Platform Service Controller, SSO and Lookup Service APIs:
|
||||||
|
|
||||||
|
Running the samples
|
||||||
|
|
||||||
|
* $ cd /path/to/vsphere-automation-sdk-python-samples/bin
|
||||||
|
* $ ./run_sample.sh ../samples/vsphere/tagging/tagging_workflow.py --server <vCenter Server IP> --username <username> --password <password> --clustername <clustername> --categoryname <categoryname> --categorydesc <categorydesc> --tagname <tagname> -tagdesc <tagdesc> -v
|
||||||
|
|
||||||
|
* Testbed Requirement:
|
||||||
|
- 1 vCenter Server
|
@ -29,7 +29,7 @@ from vmware.vapi.security.sso import create_saml_bearer_security_context
|
|||||||
from vmware.vapi.security.session import create_session_security_context
|
from vmware.vapi.security.session import create_session_security_context
|
||||||
from vmware.vapi.stdlib.client.factories import StubConfigurationFactory
|
from vmware.vapi.stdlib.client.factories import StubConfigurationFactory
|
||||||
from vmware.vapi.lib.connect import get_requests_connector
|
from vmware.vapi.lib.connect import get_requests_connector
|
||||||
from samples.common.ssl_helper import get_unverified_context
|
from samples.vsphere.common.ssl_helper import get_unverified_context
|
||||||
|
|
||||||
|
|
||||||
class ConnectionWorkflow(object):
|
class ConnectionWorkflow(object):
|
||||||
|
@ -2,11 +2,10 @@ This directory contains samples for Tagging APIs:
|
|||||||
|
|
||||||
Running the samples
|
Running the samples
|
||||||
|
|
||||||
* $ cd /path/to/VMware-vSphere-Automation-SDK-Python-<version>/bin
|
* $ cd /path/to/vsphere-automation-sdk-python-samples/bin
|
||||||
* $ ./run_sample.sh ../vsphere/samples/tagging/tagging_workflow.py --server <vCenter Server IP> --name <username> --password <password> --clustername <clustername> --categoryname <categoryname> --tagname <tagname>
|
* $ ./run_sample.sh ../samples/vsphere/tagging/tagging_workflow.py --server <vCenter Server IP> --username <username> --password <password> --clustername <clustername> --categoryname <categoryname> --categorydesc <categorydesc> --tagname <tagname> -tagdesc <tagdesc> -v
|
||||||
|
|
||||||
* Testbed Requirement:
|
* Testbed Requirement:
|
||||||
- 1 vCenter Server
|
- 1 vCenter Server
|
||||||
- 1 ESX hosts
|
|
||||||
- 1 cluster
|
- 1 cluster
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ inside the vcenter.vm package.
|
|||||||
|
|
||||||
* Prepare testbed using setup script:
|
* Prepare testbed using setup script:
|
||||||
- Edit testbed.py with your settings. In particular, you need to set the IP addresses and credentials in this file.
|
- Edit testbed.py with your settings. In particular, you need to set the IP addresses and credentials in this file.
|
||||||
$ cd /path/to/VMware-vSphere-Automation-SDK-Python-<version>/client/bin
|
$ cd /path/to/vsphere-automation-sdk-python-samples/client/bin
|
||||||
$ ./run_sample.sh ../samples/vsphere/vcenter/setup/main.py -st
|
$ ./run_sample.sh ../samples/vsphere/vcenter/setup/main.py -st
|
||||||
|
|
||||||
* Run the vAPI vCenter sample suite:
|
* Run the vAPI vCenter sample suite:
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
* NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
|
* NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from samples.vsphere.vim.file import (detect_file, delete_file,
|
from samples.vsphere.common.vim.file import (detect_file, delete_file,
|
||||||
parse_datastore_path)
|
parse_datastore_path)
|
||||||
from samples.vsphere.vim.inventory import get_datastore_mo
|
from samples.vsphere.common.vim.inventory import get_datastore_mo
|
||||||
|
|
||||||
from samples.vsphere.common.vim import datastore_file
|
from samples.vsphere.common.vim import datastore_file
|
||||||
|
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
* NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
|
* NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from samples.vsphere.vim.file import (detect_file, delete_file,
|
from samples.vsphere.common.vim.file import (detect_file, delete_file,
|
||||||
parse_datastore_path)
|
parse_datastore_path)
|
||||||
from samples.vsphere.vim.inventory import get_datastore_mo
|
from samples.vsphere.common.vim.inventory import get_datastore_mo
|
||||||
|
|
||||||
from samples.vsphere.common.vim import datastore_file
|
from samples.vsphere.common.vim import datastore_file
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ from samples.vsphere.vcenter.setup.testbed_setup import validate as testbed_vali
|
|||||||
from samples.vsphere.vcenter.vm.main import cleanup as sample_cleanup
|
from samples.vsphere.vcenter.vm.main import cleanup as sample_cleanup
|
||||||
from samples.vsphere.vcenter.vm.main import run as sample_run
|
from samples.vsphere.vcenter.vm.main import run as sample_run
|
||||||
|
|
||||||
from samples.common.ssl_helper import get_unverified_context
|
from samples.vsphere.common.ssl_helper import get_unverified_context
|
||||||
|
|
||||||
|
|
||||||
# Parse command line params for setup script
|
# Parse command line params for setup script
|
||||||
|
@ -13,35 +13,35 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
config = {}
|
config = {}
|
||||||
config["SERVER"] = ""
|
config["SERVER"] = "10.192.34.73"
|
||||||
config["USERNAME"] = ""
|
config["USERNAME"] = "administrator@vsphere.local"
|
||||||
config["PASSWORD"] = ""
|
config["PASSWORD"] = "Admin!23"
|
||||||
|
|
||||||
config["ESX_HOST1"] = ""
|
config["ESX_HOST1"] = "10.192.49.29"
|
||||||
config["ESX_HOST2"] = ""
|
config["ESX_HOST2"] = "10.192.51.199"
|
||||||
config["ESX_USER"] = ""
|
config["ESX_USER"] = "root"
|
||||||
config["ESX_PASS"] = ""
|
config["ESX_PASS"] = ""
|
||||||
|
|
||||||
config["USE_NFS"] = True
|
config["USE_NFS"] = True
|
||||||
config["NFS_HOST"] = ""
|
config["NFS_HOST"] = "10.192.43.16"
|
||||||
config["NFS_REMOTE_PATH"] = "/store1"
|
config["NFS_REMOTE_PATH"] = "/store1"
|
||||||
config["NFS_DATASTORE_NAME"] = "Shared NFS Volume"
|
config["NFS_DATASTORE_NAME"] = "Shared_NFS_Volume"
|
||||||
|
|
||||||
config["ESX_HOST1_VMFS_DATASTORE"] = "Local VMFS Volume on Host1"
|
config["ESX_HOST1_VMFS_DATASTORE"] = "Local_VMFS_Volume_on_Host1"
|
||||||
config["ESX_HOST2_VMFS_DATASTORE"] = "Local VMFS Volume on Host2"
|
config["ESX_HOST2_VMFS_DATASTORE"] = "Local_VMFS_Volume_on_Host2"
|
||||||
|
|
||||||
config["DATACENTER1_NAME"] = "Sample DC 1"
|
config["DATACENTER1_NAME"] = "Sample_DC_1"
|
||||||
config["DATACENTER2_NAME"] = "Sample DC 2"
|
config["DATACENTER2_NAME"] = "Sample_DC_2"
|
||||||
|
|
||||||
config["VM_FOLDER1_NAME"] = "Sample VM Folder 1"
|
config["VM_FOLDER1_NAME"] = "Sample_VM_Folder_1"
|
||||||
config["VM_FOLDER2_NAME"] = "Sample VM Folder 2"
|
config["VM_FOLDER2_NAME"] = "Sample_VM_Folder_2"
|
||||||
|
|
||||||
config["CLUSTER1_NAME"] = "Cluster1"
|
config["CLUSTER1_NAME"] = "Cluster1"
|
||||||
|
|
||||||
config["VDSWITCH1_NAME"] = "DSwitch1"
|
config["VDSWITCH1_NAME"] = "DSwitch1"
|
||||||
config["VDPORTGROUP1_NAME"] = "Static Portgroup on DSwitch 1"
|
config["VDPORTGROUP1_NAME"] = "Static_Portgroup_on_DSwitch_1"
|
||||||
|
|
||||||
config["STDPORTGROUP_NAME"] = "VM Network"
|
config["STDPORTGROUP_NAME"] = "VM_Network"
|
||||||
|
|
||||||
# The main datacenter and datastore that will be used for the VM tests
|
# The main datacenter and datastore that will be used for the VM tests
|
||||||
config["VM_DATACENTER_NAME"] = config["DATACENTER2_NAME"]
|
config["VM_DATACENTER_NAME"] = config["DATACENTER2_NAME"]
|
||||||
@ -50,9 +50,9 @@ config["VM_DATASTORE_NAME"] = config["NFS_DATASTORE_NAME"]
|
|||||||
# GestOS should be one of the enumeration values in com.vmware.vcenter.vm.GuestOS
|
# GestOS should be one of the enumeration values in com.vmware.vcenter.vm.GuestOS
|
||||||
config["VM_GUESTOS"] = "WINDOWS_9_64"
|
config["VM_GUESTOS"] = "WINDOWS_9_64"
|
||||||
|
|
||||||
config["VM_NAME_DEFAULT"] = "Sample Default VM for Simple Testbed"
|
config["VM_NAME_DEFAULT"] = "Sample_Default_VM_for_Simple_Testbed"
|
||||||
config["VM_NAME_BASIC"] = "Sample Basic VM for Simple Testbed"
|
config["VM_NAME_BASIC"] = "Sample_Basic_VM_for_Simple_Testbed"
|
||||||
config["VM_NAME_EXHAUSTIVE"] = "Sample Exhaustive VM for Simple Testbed"
|
config["VM_NAME_EXHAUSTIVE"] = "Sample_Exhaustive_VM_for_Simple_Testbed"
|
||||||
|
|
||||||
config["BACKENDS_DATACENTER_NAME"] = config["VM_DATACENTER_NAME"]
|
config["BACKENDS_DATACENTER_NAME"] = config["VM_DATACENTER_NAME"]
|
||||||
|
|
||||||
|
@ -34,12 +34,12 @@ You have two options to run samples inside this package:
|
|||||||
|
|
||||||
For example, to run the create_default_vm sample in the samples.vsphere.vcenter.vm.create package:
|
For example, to run the create_default_vm sample in the samples.vsphere.vcenter.vm.create package:
|
||||||
|
|
||||||
* $ cd /path/to/VMware-vSphere-Automation-SDK-Python-<version>/client/bin
|
* $ cd /path/to/vsphere-automation-sdk-python-samples/bin
|
||||||
|
|
||||||
* Run the sample with the testbed settings specified in setup.py in a Linux machine:
|
* Run the sample with the testbed settings specified in setup.py in a Linux machine:
|
||||||
|
|
||||||
$ ./run_sample.sh ../samples/src/vsphere/samples/vcenter/vm/create/create_default_vm.py -v
|
$ ./run_sample.sh ../samples/vsphere/vcenter/vm/create/create_default_vm.py -v
|
||||||
|
|
||||||
* Or specify the credentials using command line parameters:
|
* Or specify the credentials using command line parameters:
|
||||||
|
|
||||||
$ ./run_sample.sh ../samples/src/vsphere/samples/vcenter/vm/create/create_default_vm.py -s <server> -u <username> -p <password> -v
|
$ ./run_sample.sh ../samples/vsphere/vcenter/vm/create/create_default_vm.py -s <server> -u <username> -p <password> -v
|
||||||
|
@ -19,7 +19,7 @@ from com.vmware.vcenter.vm.hardware_client import (IdeAddressSpec,
|
|||||||
SataAddressSpec,
|
SataAddressSpec,
|
||||||
ScsiAddressSpec)
|
ScsiAddressSpec)
|
||||||
from pyVim.connect import SmartConnect, Disconnect
|
from pyVim.connect import SmartConnect, Disconnect
|
||||||
from samples.vsphere.vim.vmdk import (create_vmdk, delete_vmdk, detect_vmdk)
|
from samples.vsphere.common.vim.vmdk import (create_vmdk, delete_vmdk, detect_vmdk)
|
||||||
|
|
||||||
from samples.vsphere.common import vapiconnect
|
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_vm
|
||||||
|
@ -29,35 +29,35 @@ from samples.vsphere.vcenter.helper.vm_helper import get_vm
|
|||||||
|
|
||||||
def setup(context):
|
def setup(context):
|
||||||
print('Setup vcenter.vm.hardware Samples Started')
|
print('Setup vcenter.vm.hardware Samples Started')
|
||||||
samples.vcenter.vm.hardware.cpu.setup(context)
|
samples.vsphere.vcenter.vm.hardware.cpu.setup(context)
|
||||||
samples.vcenter.vm.hardware.memory.setup(context)
|
samples.vsphere.vcenter.vm.hardware.memory.setup(context)
|
||||||
samples.vcenter.vm.hardware.disk.setup(context)
|
samples.vsphere.vcenter.vm.hardware.disk.setup(context)
|
||||||
samples.vcenter.vm.hardware.adapter.sata.setup(context)
|
samples.vsphere.vcenter.vm.hardware.adapter.sata.setup(context)
|
||||||
samples.vcenter.vm.hardware.adapter.scsi.setup(context)
|
samples.vsphere.vcenter.vm.hardware.adapter.scsi.setup(context)
|
||||||
samples.vcenter.vm.hardware.boot.setup(context)
|
samples.vsphere.vcenter.vm.hardware.boot.setup(context)
|
||||||
samples.vcenter.vm.hardware.boot_device.setup(context)
|
samples.vsphere.vcenter.vm.hardware.boot_device.setup(context)
|
||||||
samples.vcenter.vm.hardware.cdrom.setup(context)
|
samples.vsphere.vcenter.vm.hardware.cdrom.setup(context)
|
||||||
samples.vcenter.vm.hardware.ethernet.setup(context)
|
samples.vsphere.vcenter.vm.hardware.ethernet.setup(context)
|
||||||
samples.vcenter.vm.hardware.floppy.setup(context)
|
samples.vsphere.vcenter.vm.hardware.floppy.setup(context)
|
||||||
samples.vcenter.vm.hardware.serial.setup(context)
|
samples.vsphere.vcenter.vm.hardware.serial.setup(context)
|
||||||
samples.vcenter.vm.hardware.parallel.setup(context)
|
samples.vsphere.vcenter.vm.hardware.parallel.setup(context)
|
||||||
print('Setup vcenter.vm.hardware Samples Complete\n')
|
print('Setup vcenter.vm.hardware Samples Complete\n')
|
||||||
|
|
||||||
|
|
||||||
def cleanup():
|
def cleanup():
|
||||||
print('Cleanup vcenter.vm.hardware Samples Started')
|
print('Cleanup vcenter.vm.hardware Samples Started')
|
||||||
samples.vcenter.vm.hardware.cpu.cleanup()
|
samples.vsphere.vcenter.vm.hardware.cpu.cleanup()
|
||||||
samples.vcenter.vm.hardware.memory.cleanup()
|
samples.vsphere.vcenter.vm.hardware.memory.cleanup()
|
||||||
samples.vcenter.vm.hardware.disk.cleanup()
|
samples.vsphere.vcenter.vm.hardware.disk.cleanup()
|
||||||
samples.vcenter.vm.hardware.adapter.sata.cleanup()
|
samples.vsphere.vcenter.vm.hardware.adapter.sata.cleanup()
|
||||||
samples.vcenter.vm.hardware.adapter.scsi.cleanup()
|
samples.vsphere.vcenter.vm.hardware.adapter.scsi.cleanup()
|
||||||
samples.vcenter.vm.hardware.boot.cleanup()
|
samples.vsphere.vcenter.vm.hardware.boot.cleanup()
|
||||||
samples.vcenter.vm.hardware.boot_device.cleanup()
|
samples.vsphere.vcenter.vm.hardware.boot_device.cleanup()
|
||||||
samples.vcenter.vm.hardware.cdrom.cleanup()
|
samples.vsphere.vcenter.vm.hardware.cdrom.cleanup()
|
||||||
samples.vcenter.vm.hardware.ethernet.cleanup()
|
samples.vsphere.vcenter.vm.hardware.ethernet.cleanup()
|
||||||
samples.vcenter.vm.hardware.floppy.cleanup()
|
samples.vsphere.vcenter.vm.hardware.floppy.cleanup()
|
||||||
samples.vcenter.vm.hardware.serial.cleanup()
|
samples.vsphere.vcenter.vm.hardware.serial.cleanup()
|
||||||
samples.vcenter.vm.hardware.parallel.cleanup()
|
samples.vsphere.vcenter.vm.hardware.parallel.cleanup()
|
||||||
print('Cleanup vcenter.vm.hardware Samples Complete\n')
|
print('Cleanup vcenter.vm.hardware Samples Complete\n')
|
||||||
|
|
||||||
|
|
||||||
@ -99,18 +99,18 @@ def run():
|
|||||||
print('#' * 79)
|
print('#' * 79)
|
||||||
print('# vcenter.vm.hardware Samples')
|
print('# vcenter.vm.hardware Samples')
|
||||||
print('#' * 79)
|
print('#' * 79)
|
||||||
samples.vcenter.vm.hardware.cpu.run()
|
samples.vsphere.vcenter.vm.hardware.cpu.run()
|
||||||
samples.vcenter.vm.hardware.memory.run()
|
samples.vsphere.vcenter.vm.hardware.memory.run()
|
||||||
samples.vcenter.vm.hardware.disk.run()
|
samples.vsphere.vcenter.vm.hardware.disk.run()
|
||||||
samples.vcenter.vm.hardware.adapter.sata.run()
|
samples.vsphere.vcenter.vm.hardware.adapter.sata.run()
|
||||||
samples.vcenter.vm.hardware.adapter.scsi.run()
|
samples.vsphere.vcenter.vm.hardware.adapter.scsi.run()
|
||||||
samples.vcenter.vm.hardware.boot.run()
|
samples.vsphere.vcenter.vm.hardware.boot.run()
|
||||||
samples.vcenter.vm.hardware.boot_device.run()
|
samples.vsphere.vcenter.vm.hardware.boot_device.run()
|
||||||
samples.vcenter.vm.hardware.cdrom.run()
|
samples.vsphere.vcenter.vm.hardware.cdrom.run()
|
||||||
samples.vcenter.vm.hardware.ethernet.run()
|
samples.vsphere.vcenter.vm.hardware.ethernet.run()
|
||||||
samples.vcenter.vm.hardware.floppy.run()
|
samples.vsphere.vcenter.vm.hardware.floppy.run()
|
||||||
samples.vcenter.vm.hardware.serial.run()
|
samples.vsphere.vcenter.vm.hardware.serial.run()
|
||||||
samples.vcenter.vm.hardware.parallel.run()
|
samples.vsphere.vcenter.vm.hardware.parallel.run()
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# Virtual Hardware Upgrade Sample
|
# Virtual Hardware Upgrade Sample
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import samples.vsphere.vcenter.helper.network_helper
|
import samples.vsphere.vcenter.helper.network_helper
|
||||||
import samples.vcenter.vm.hardware.main
|
import samples.vsphere.vcenter.vm.hardware.main
|
||||||
import samples.vsphere.vcenter.vm.placement
|
import samples.vsphere.vcenter.vm.placement
|
||||||
import samples.vsphere.vcenter.vm.power
|
import samples.vsphere.vcenter.vm.power
|
||||||
from samples.vsphere.common.sample_util import pp
|
from samples.vsphere.common.sample_util import pp
|
||||||
@ -127,11 +127,11 @@ def run(context):
|
|||||||
#
|
#
|
||||||
###########################################################################
|
###########################################################################
|
||||||
if context.option['DO_SAMPLES_INCREMENTAL']:
|
if context.option['DO_SAMPLES_INCREMENTAL']:
|
||||||
samples.vcenter.vm.hardware.main.setup(context)
|
samples.vsphere.vcenter.vm.hardware.main.setup(context)
|
||||||
samples.vcenter.vm.hardware.main.validate(context)
|
samples.vsphere.vcenter.vm.hardware.main.validate(context)
|
||||||
samples.vcenter.vm.hardware.main.run()
|
samples.vsphere.vcenter.vm.hardware.main.run()
|
||||||
if context.option['DO_SAMPLES_CLEANUP']:
|
if context.option['DO_SAMPLES_CLEANUP']:
|
||||||
samples.vcenter.vm.hardware.main.cleanup()
|
samples.vsphere.vcenter.vm.hardware.main.cleanup()
|
||||||
|
|
||||||
|
|
||||||
# Sample cleanup
|
# Sample cleanup
|
||||||
|
Loading…
Reference in New Issue
Block a user