Skip to content

Commit

Permalink
2.20.6-build (#258)
Browse files Browse the repository at this point in the history
* 2.20.6-build

* Add support to adding devices to turned off vm (#257)

* add feature: attach port when the vm is powered off

 (by default vm was powered off in flow of task)

* Update __init__.py

* 2.20.6-flake8

* 2.20.6-py311-wagon

---------

Co-authored-by: Mateusz Mizerski <[email protected]>
  • Loading branch information
ahmadiesa-abu and mateuszmizer authored Sep 14, 2023
1 parent 3e151bf commit 37c3ad1
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 21 deletions.
5 changes: 5 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ workflows:
filters:
branches:
only: /([0-9\.]*\-build|master)/
- wagonorb/wagon_311:
filters:
branches:
only: /([0-9\.]*\-build|master)/
- wagonorb/arch64_wagon:
filters:
branches:
Expand All @@ -101,6 +105,7 @@ workflows:
only: /master/
requires:
- wagonorb/wagon
- wagonorb/wagon_311
- wagonorb/arch64_wagon
- wagonorb/rhel_wagon
- node/validate_version_job
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
2.20.6:
- Add support for attaching/detaching PCI/Serial on turned off machine already
2.20.5:
- Fix cdrom_image type instead of default in plugin yaml.
- add support of changing boot order during vm creation
Expand Down
2 changes: 1 addition & 1 deletion cloudify_vsphere/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = '2.20.5'
version = '2.20.6'
57 changes: 41 additions & 16 deletions cloudify_vsphere/devices/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,12 +412,19 @@ def attach_serial_port(ctx, **kwargs):
task = vm.obj.ReconfigVM_Task(spec=config_spec)
cl._wait_for_task(task, instance=ctx.source.instance)
temp_start_server(cl, vm, ctx.target.instance)
ctx.source.instance.runtime_properties['__attached'] = True
ctx.source.instance.runtime_properties.dirty = True
ctx.source.instance.update()
else:
raise NonRecoverableError(
'Serial Port can\'t be attached while VM is running')
if vm.obj.summary.runtime.powerState.lower() == "poweredon":
raise NonRecoverableError(
'Serial Port can\'t be attached while VM is running')
else:
ctx.logger.info(
'VM is poweredoff and will not be started automatically')
task = vm.obj.ReconfigVM_Task(spec=config_spec)
cl._wait_for_task(task, instance=ctx.source.instance)

ctx.source.instance.runtime_properties['__attached'] = True
ctx.source.instance.runtime_properties.dirty = True
ctx.source.instance.update()


@operation(resumable=True)
Expand Down Expand Up @@ -449,11 +456,17 @@ def detach_serial_port(ctx, **kwargs):
temp_stop_server(cl, vm, ctx.target.instance)
task = vm.obj.ReconfigVM_Task(spec=config_spec)
cl._wait_for_task(task, instance=ctx.source.instance)
del ctx.source.instance.runtime_properties['__attached']
temp_start_server(cl, vm, ctx.target.instance)
else:
raise NonRecoverableError(
'Serial Port can\'t be detached while VM is running')
if vm.obj.summary.runtime.powerState.lower() == "poweredon":
raise NonRecoverableError(
'Serial Port can\'t be detached while VM is running')
else:
ctx.logger.info(
'VM is poweredoff and will not be started automatically')
task = vm.obj.ReconfigVM_Task(spec=config_spec)
cl._wait_for_task(task, instance=ctx.source.instance)
del ctx.source.instance.runtime_properties['__attached']


def get_pci_device(content, vm_host_name, device_name):
Expand Down Expand Up @@ -525,12 +538,18 @@ def attach_pci_device(ctx, **kwargs):
task = vm.obj.ReconfigVM_Task(spec=config_spec)
cl._wait_for_task(task, instance=ctx.source.instance)
temp_start_server(cl, vm, ctx.target.instance)
ctx.source.instance.runtime_properties['__attached'] = True
ctx.source.instance.runtime_properties.dirty = True
ctx.source.instance.update()
else:
raise NonRecoverableError(
'PCI Device can\'t be attached while VM is running')
if vm.obj.summary.runtime.powerState.lower() == "poweredon":
raise NonRecoverableError(
'PCI Device can\'t be attached while VM is running')
else:
ctx.logger.info(
'VM is poweredoff and will not be started automatically')
task = vm.obj.ReconfigVM_Task(spec=config_spec)
cl._wait_for_task(task, instance=ctx.source.instance)
ctx.source.instance.runtime_properties['__attached'] = True
ctx.source.instance.runtime_properties.dirty = True
ctx.source.instance.update()


@operation(resumable=True)
Expand Down Expand Up @@ -565,11 +584,17 @@ def detach_pci_device(ctx, **kwargs):
temp_stop_server(cl, vm, ctx.target.instance)
task = vm.obj.ReconfigVM_Task(spec=config_spec)
cl._wait_for_task(task, instance=ctx.source.instance)
del ctx.source.instance.runtime_properties['__attached']
temp_start_server(cl, vm, ctx.target.instance)
else:
raise NonRecoverableError(
'PCI Device can\'t be detached while VM is running')
if vm.obj.summary.runtime.powerState.lower() == "poweredon":
raise NonRecoverableError(
'PCI Device can\'t be detached while VM is running')
else:
ctx.logger.info(
'VM is poweredoff and will not be started automatically')
task = vm.obj.ReconfigVM_Task(spec=config_spec)
cl._wait_for_task(task, instance=ctx.source.instance)
del ctx.source.instance.runtime_properties['__attached']


@op
Expand Down
2 changes: 1 addition & 1 deletion constraints.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
netaddr==0.7.19
pyvmomi==6.7.3
pyyaml>=3.10,<6.0
#pyyaml>=3.10,<6.0
rsa==4.5
cryptography==3.2.1
decorator>=4.4.2
Expand Down
4 changes: 4 additions & 0 deletions extra-packaging-instructions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
if [[ $PY311 == 1 ]]
then
git apply python311.patch
fi
2 changes: 1 addition & 1 deletion plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins:
vsphere:
executor: central_deployment_agent
package_name: cloudify-vsphere-plugin
package_version: '2.20.5'
package_version: '2.20.6'

data_types:

Expand Down
2 changes: 1 addition & 1 deletion plugin_1_4.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins:
vsphere:
executor: central_deployment_agent
package_name: cloudify-vsphere-plugin
package_version: '2.20.5'
package_version: '2.20.6'

data_types:

Expand Down
2 changes: 1 addition & 1 deletion v2_plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins:
vsphere:
executor: central_deployment_agent
package_name: cloudify-vsphere-plugin
package_version: '2.20.5'
package_version: '2.20.6'

data_types:

Expand Down

0 comments on commit 37c3ad1

Please sign in to comment.