Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Windows - How to start vcd #528

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions system_tests/vm_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class VmTest(BaseTestCase):
_computer_name_update = 'mycom'
_boot_delay_update = 60
_enter_bios_setup_update = True
_new_ovf_info = 'new info'

def test_0000_setup(self):
"""Load configuration and create a click runner to invoke CLI."""
Expand Down Expand Up @@ -542,6 +543,21 @@ def _power_off_and_undeploy(self, vapp):
task = vapp.undeploy()
VmTest._client.get_task_monitor().wait_for_success(task)

def test_0340_list_os_section(self):
# list os section properties
result = VmTest._runner.invoke(
vm, args=['list-os-section',
VAppConstants.name, VAppConstants.vm1_name])
self.assertEqual(0, result.exit_code)

def test_0340_update_os_section(self):
# update os section properties
result = VmTest._runner.invoke(
vm, args=['update-os-section',
VAppConstants.name, VAppConstants.vm1_name,
'--ovf-info', VmTest._new_ovf_info])
self.assertEqual(0, result.exit_code)

def test_9998_tearDown(self):
"""Delete the vApp created during setup.

Expand Down
52 changes: 52 additions & 0 deletions vcd_cli/vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,15 @@ def vm(ctx):
--datastore-id 0d8c7358-3e8d-4862-9364-68155069d252
Relocate VM to given datastore.

\b
vcd vm list-os-section vapp1 vm1
List OS section properties of VM.

\b
vcd vm update-os-section vapp1 vm1
--ovf-info newInfo
--description newDescription
Update OS section properties of VM.
"""
pass

Expand Down Expand Up @@ -1198,3 +1207,46 @@ def relocate(ctx, vapp_name, vm_name, datastore_id):
stdout(task, ctx)
except Exception as e:
stderr(e, ctx)

@vm.command('list-os-section', short_help='list operating system section '
'properties of VM')
@click.pass_context
@click.argument('vapp-name', metavar='<vapp-name>', required=True)
@click.argument('vm-name', metavar='<vm-name>', required=True)
def list_os_section(ctx, vapp_name, vm_name):
try:
restore_session(ctx, vdc_required=True)
vm = _get_vm(ctx, vapp_name, vm_name)
result = vm.list_os_section()
stdout(result, ctx)
except Exception as e:
stderr(e, ctx)

@vm.command(
'update-os-section', short_help='update os section properties of VM')
@click.pass_context
@click.argument('vapp-name', metavar='<vapp-name>', required=True)
@click.argument('vm-name', metavar='<vm-name>', required=True)
@click.option(
'ovf_info',
'--ovf-info',
required=False,
default=None,
metavar='<ovf_info>',
help='ovf info')
@click.option(
'description',
'--d',
required=False,
default=None,
metavar='<description>',
help='description')
def update_os_section(ctx, vapp_name, vm_name, ovf_info, description):
try:
restore_session(ctx, vdc_required=True)
vm = _get_vm(ctx, vapp_name, vm_name)
task = vm.update_operating_system_section(ovf_info=ovf_info,
description=description)
stdout(task, ctx)
except Exception as e:
stderr(e, ctx)