diff --git a/vc-worker.py b/vc-worker.py index bad0917..6f7fce9 100755 --- a/vc-worker.py +++ b/vc-worker.py @@ -82,6 +82,7 @@ def process_deploy_action(conn, action, vc): ) if network_interface: vc.config_network(uuid, interface_name=network_interface) + vc.config_memcpu(uuid) machine_info = vc.get_machine_info(uuid) except Exception as e: settings.raven.captureException(exc_info=True) diff --git a/vcenter/vcenter.py b/vcenter/vcenter.py index 95f29c2..6d825b3 100644 --- a/vcenter/vcenter.py +++ b/vcenter/vcenter.py @@ -629,6 +629,22 @@ def config_network(self, uuid, **kwargs): except Exception: self.__sleep_between_tries() + def config_memcpu(self, uuid, **kwargs): + self.__logger.debug('config_memcpu') + self.__check_connection() + for i in range(settings.app['vsphere']['retries']['config_network']): + try: + + vm = self.content.searchIndex.FindByUuid(None, uuid, True) + config = vim.vm.ConfigSpec() + config.numCPUs = 4 + config.memoryMB = 8192 + task = vm.ReconfigVM_Task(spec=config) + self.wait_for_task(task) + break + except Exception: + self.__sleep_between_tries() + def _get_machine_nos_id(self, vm, uuid): result = '' try: