Commit 8907de3f by Czémán Arnold

vmdriver, ceph: change dump size limit to ram size

parent 032250b2
...@@ -14,8 +14,6 @@ from util import req_connection, wrap_libvirtError, Connection ...@@ -14,8 +14,6 @@ from util import req_connection, wrap_libvirtError, Connection
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
DUMP_SIZE_LIMIT = int(os.getenv("DUMP_SIZE_LIMIT", 20 * 1024 ** 3)) # 20GB
mon_regex_ipv6 = re.compile(r"^\[(?P<address>.+)\]\:(?P<port>\d+).*$") mon_regex_ipv6 = re.compile(r"^\[(?P<address>.+)\]\:(?P<port>\d+).*$")
mon_regex_ipv4 = re.compile(r"^(?P<address>.+)\:(?P<port>\d+).*$") mon_regex_ipv4 = re.compile(r"^(?P<address>.+)\:(?P<port>\d+).*$")
...@@ -109,12 +107,12 @@ def get_endpoints(user): ...@@ -109,12 +107,12 @@ def get_endpoints(user):
return _get_endpoints(conf) return _get_endpoints(conf)
def save(domain, poolname, diskname, user): def save(domain, poolname, diskname, ram_size, user):
diskname = str(diskname) diskname = str(diskname)
poolname = str(poolname) poolname = str(poolname)
ceph_path = os.path.join(poolname, diskname) ceph_path = os.path.join(poolname, diskname)
local_path = os.path.join("/dev/rbd", ceph_path) local_path = os.path.join("/dev/rbd", ceph_path)
disk_size = DUMP_SIZE_LIMIT disk_size = (ram_size + 100) * 1024 ** 2 # +100MB provision
with CephConnection(poolname, user=user) as conn: with CephConnection(poolname, user=user) as conn:
rbd_inst = rbd.RBD() rbd_inst = rbd.RBD()
......
...@@ -227,11 +227,11 @@ def suspend(name): ...@@ -227,11 +227,11 @@ def suspend(name):
@celery.task @celery.task
@req_connection @req_connection
@wrap_libvirtError @wrap_libvirtError
def save(name, data_store_type, dir, filename, ceph_user=None): def save(name, data_store_type, dir, filename, ram_size, ceph_user=None):
""" Stop virtual machine and save its memory to path. """ """ Stop virtual machine and save its memory to path. """
domain = lookupByName(name) domain = lookupByName(name)
if data_store_type == "ceph_block": if data_store_type == "ceph_block":
ceph.save(domain, dir, filename, ceph_user) ceph.save(domain, dir, filename, ram_size, ceph_user)
else: else:
path = os.path.join(dir, filename) path = os.path.join(dir, filename)
domain.save(path) domain.save(path)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment