Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: possibility to increase mem & cpu #63

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions vc-worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 16 additions & 0 deletions vcenter/vcenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down