-
Notifications
You must be signed in to change notification settings - Fork 5
Example 5
Carlos Ruiz Lantero edited this page Oct 10, 2017
·
3 revisions
Remote machines can be managed with SSH. This method needs the two
corresponding configuration values you can find in the [Virtual Machine Remote Management] section of the configuration (See
Example 1).
You can use the use_sudo and quiet modes, as per the example.
>>> from vcdriver.vm import VirtualMachine
>>> from vcdriver.config import load
>>> load('path/to/vcdriver.ini')
>>> vm = VirtualMachine(name='vm_name', template='vm_template')
>>> vm.create()
Vcenter session opened with ID 52d75977-360d-0923-39ff-b914fd323d61
Waiting for [Create virtual machine "vm_name" from template "vm_template"] ... 0:00:10.074632
>>> vm.ssh('ls')
Waiting for [Get IP] ... 0:01:03.292489
[admin@10.0.0.1] run: ls
>>> vm.ssh('ls', use_sudo=True)
[admin@10.0.0.1] sudo: ls
>>> vm.ssh('ls', quiet=True)
>>> - Example 1: Setting up vcdriver
- Example 2: Managing the session
- Example 3: Creating and finding virtual machines
- Example 4: Destroying virtual machines and power methods
- Example 5: Virtual machine management: SSH
- Example 6: Virtual machine management: SFTP
- Example 7: Virtual machine management: WinRM
- Example 8: Snapshots
- Example 9: Using vcdriver for testing
- Example 10: Further management