mirror of
https://github.com/dkmstr/openuds.git
synced 2024-12-25 23:21:41 +03:00
Fixed several proxmox issues
This commit is contained in:
parent
6f8b67f3b8
commit
c23f95e903
@ -277,7 +277,6 @@ class ProxmoxClient:
|
|||||||
if linkedClone is False:
|
if linkedClone is False:
|
||||||
params.append(('format', 'qcow2')) # Ensure clone for templates is on qcow2 format
|
params.append(('format', 'qcow2')) # Ensure clone for templates is on qcow2 format
|
||||||
|
|
||||||
|
|
||||||
logger.debug('PARAMS: %s', params)
|
logger.debug('PARAMS: %s', params)
|
||||||
|
|
||||||
return types.VmCreationResult(
|
return types.VmCreationResult(
|
||||||
|
@ -2,7 +2,7 @@ import datetime
|
|||||||
import re
|
import re
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
networkRe = re.compile(r'([a-zA-Z0-9]+)=([^,]+)(,bridge=([^,]*),firewall=(.*))?')
|
networkRe = re.compile(r'([a-zA-Z0-9]+)=([^,]+)(,bridge=([^,]*),firewall=([^,]*))?') # May have vla id at end
|
||||||
|
|
||||||
# Conversor from dictionary to NamedTuple
|
# Conversor from dictionary to NamedTuple
|
||||||
conversors: typing.MutableMapping[typing.Type, typing.Callable] = {
|
conversors: typing.MutableMapping[typing.Type, typing.Callable] = {
|
||||||
|
@ -55,6 +55,8 @@ def getStorage(parameters: typing.Any) -> typing.List[typing.Dict[str, typing.An
|
|||||||
res = []
|
res = []
|
||||||
# Get storages for that datacenter
|
# Get storages for that datacenter
|
||||||
for storage in sorted(provider.listStorages(vmInfo.node), key=lambda x: int(not x.shared)):
|
for storage in sorted(provider.listStorages(vmInfo.node), key=lambda x: int(not x.shared)):
|
||||||
|
if storage.type in ('lvm', 'iscsi', 'iscsidirect'):
|
||||||
|
continue
|
||||||
space, free = storage.avail / 1024 / 1024 / 1024, (storage.avail - storage.used) / 1024 / 1024 / 1024
|
space, free = storage.avail / 1024 / 1024 / 1024, (storage.avail - storage.used) / 1024 / 1024 / 1024
|
||||||
extra = _(' shared') if storage.shared else _(' (bound to {})').format(vmInfo.node)
|
extra = _(' shared') if storage.shared else _(' (bound to {})').format(vmInfo.node)
|
||||||
res.append({'id': storage.storage, 'text': "%s (%4.2f GB/%4.2f GB)%s" % (storage.storage, space, free, extra)})
|
res.append({'id': storage.storage, 'text': "%s (%4.2f GB/%4.2f GB)%s" % (storage.storage, space, free, extra)})
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
.. moduleauthor:: Adolfo Gómez, dkmaster at dkmon dot com
|
.. moduleauthor:: Adolfo Gómez, dkmaster at dkmon dot com
|
||||||
"""
|
"""
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
import time
|
||||||
import logging
|
import logging
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
@ -126,13 +127,18 @@ class ProxmoxPublication(services.Publication):
|
|||||||
return self.destroy()
|
return self.destroy()
|
||||||
self._state = State.FINISHED
|
self._state = State.FINISHED
|
||||||
if self._operation == 'p': # not Destroying
|
if self._operation == 'p': # not Destroying
|
||||||
logger.debug('Marking as template')
|
|
||||||
# Mark vm as template
|
|
||||||
self.service().makeTemplate(int(self._vm))
|
|
||||||
# And add it to HA if
|
|
||||||
self.service().enableHA(int(self._vm))
|
|
||||||
# Disable Protection (removal)
|
# Disable Protection (removal)
|
||||||
self.service().setProtection(int(self._vm), protection=False)
|
self.service().setProtection(int(self._vm), protection=False)
|
||||||
|
time.sleep(0.5) # Give some tome to proxmox. We have observed some concurrency issues
|
||||||
|
# And add it to HA if
|
||||||
|
self.service().enableHA(int(self._vm))
|
||||||
|
time.sleep(0.5)
|
||||||
|
# Mark vm as template
|
||||||
|
self.service().makeTemplate(int(self._vm))
|
||||||
|
|
||||||
|
# This seems to cause problems on Proxmox
|
||||||
|
# makeTemplate --> setProtection (that calls "config"). Seems that the HD dissapears...
|
||||||
|
# Seems a concurrency problem?
|
||||||
|
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user