| Total Complexity | 2 |
| Total Lines | 14 |
| Duplicated Lines | 0 % |
| 1 | # Licensed to the StackStorm, Inc ('StackStorm') under one or more |
||
| 24 | class VMEditCPUMem(BaseAction): |
||
| 25 | |||
| 26 | def run(self, vm_id, cpu, memory): |
||
| 27 | # convert ids to stubs |
||
| 28 | vm = inventory.get_virtualmachine(self.si_content, moid=vm_id) |
||
| 29 | spec = vim.vm.ConfigSpec() |
||
| 30 | spec.numCPUs = cpu |
||
| 31 | spec.memoryMB = memory |
||
| 32 | task = vm.ReconfigVM_Task(spec) |
||
| 33 | |||
| 34 | while task.info.state == vim.TaskInfo.State.running: |
||
| 35 | eventlet.sleep(1) |
||
| 36 | |||
| 37 | return {'state': str(task.info.state)} |
||
| 38 |