-
Notifications
You must be signed in to change notification settings - Fork 5
Example 6
Carlos Ruiz Lantero edited this page Oct 10, 2017
·
2 revisions
SFTP can be used to transfer files between the client and the virtual
machine using the ssh_download and ssh_upload methods, which rely on
Fabric's get and put respectively.
These methods needs the two SSH configuration values you can find in
the [Virtual Machine Remote Management] section of the configuration
(See Example 1).
You can also use the use_sudo and quiet flags.
>>> 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_upload(remote_path='remote/path', local_path='local/path', use_sudo=True)
Waiting for [Get IP] ... 0:01:03.292489
[admin@10.0.0.1] put: local/path -> remote/path
>>> vm.ssh_download(remote_path='remote/path', local_path='local/path', 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