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

Qubes Settings GUI / setting Initial memory to less than 1/10th Max mem. requires enabling memory balancing #3569

Open
taradiddles opened this Issue Feb 11, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@taradiddles

taradiddles commented Feb 11, 2018

[ very low prio ]

Qubes OS version:

4.0rc4


Steps to reproduce the behavior:

  • Choose a VM that is not included in memory balancing (eg. sys-net) and open its Qubes Settings gui / advanced tab
  • Try to change the Initial Memory to a lower value than 1/10th the value of the greyed out "Max memory" value.

Expected behavior:

Initial Memory is set to a lower value.

Actual behavior:

Error message - "Initial memory can't be less than one tenth Max Memory". However "Max Memory" is greyed out so one has to enable memory balancing, decrease the max memory, set a lower Initial memory value and then disable memory balancing.

General notes:

IMHO, more generally (= also for VMs with memory balancing enabled) setting a lower value than 1/10th the Max memory should automatically decrease the Max memory to 10 times the new Initial memory value - maybe with a notification message.


Related issues:

@donob4n

This comment has been minimized.

Show comment
Hide comment
@donob4n

donob4n Feb 11, 2018

I had a similar problem. If you try to set more than more 'Max memory', you will get a warning message and the max value will be updated.

https://github.com/QubesOS/qubes-manager/blob/cb2aa56413a85d456af0b2fab10654ccd0186294/qubesmanager/settings.py#L431

This needs to check if the VM is not included in balancing. I've fixed it in my 3.2 dom0 but I considered it pretty dummy for requesting a pull. Also I thought it don't affect Qubes 4.

Probably it shouldn't be called if the VM is not in memory balance.

donob4n commented Feb 11, 2018

I had a similar problem. If you try to set more than more 'Max memory', you will get a warning message and the max value will be updated.

https://github.com/QubesOS/qubes-manager/blob/cb2aa56413a85d456af0b2fab10654ccd0186294/qubesmanager/settings.py#L431

This needs to check if the VM is not included in balancing. I've fixed it in my 3.2 dom0 but I considered it pretty dummy for requesting a pull. Also I thought it don't affect Qubes 4.

Probably it shouldn't be called if the VM is not in memory balance.

@donob4n

This comment has been minimized.

Show comment
Hide comment
@donob4n

donob4n Feb 11, 2018

It's hard to avoid it being called since it's called by the gui, so maybe a good solution could be:

def check_mem_changes(self):
    # skip VMs not included in memory balancing
    if not self.include_in_balancing.isChecked()
        self.max_mem_size.setValue(self.init_mem.value())
        return

    if self.max_mem_size.value() < self.init_mem.value():
        QtGui.QMessageBox.warning(
            None,
            self.tr("Warning!"),
            self.tr("Max memory can not be less than initial memory.<br>"
                    "Setting max memory to equal initial memory."))
        self.max_mem_size.setValue(self.init_mem.value())
    # Linux specific limit: init memory must not be below
    # max_mem_size/10.79 in order to allow scaling up to
    # max_mem_size (or else "add_memory() failed: -17" problem)
    if self.init_mem.value() * 10 < self.max_mem_size.value():
        QtGui.QMessageBox.warning(
            None,
            self.tr("Warning!"),
            self.tr("Initial memory can not be less than one tenth "
                    "Max memory.<br>Setting initial memory to the minimum "
                    "allowed value."))
        self.init_mem.setValue(self.max_mem_size.value() / 10)

donob4n commented Feb 11, 2018

It's hard to avoid it being called since it's called by the gui, so maybe a good solution could be:

def check_mem_changes(self):
    # skip VMs not included in memory balancing
    if not self.include_in_balancing.isChecked()
        self.max_mem_size.setValue(self.init_mem.value())
        return

    if self.max_mem_size.value() < self.init_mem.value():
        QtGui.QMessageBox.warning(
            None,
            self.tr("Warning!"),
            self.tr("Max memory can not be less than initial memory.<br>"
                    "Setting max memory to equal initial memory."))
        self.max_mem_size.setValue(self.init_mem.value())
    # Linux specific limit: init memory must not be below
    # max_mem_size/10.79 in order to allow scaling up to
    # max_mem_size (or else "add_memory() failed: -17" problem)
    if self.init_mem.value() * 10 < self.max_mem_size.value():
        QtGui.QMessageBox.warning(
            None,
            self.tr("Warning!"),
            self.tr("Initial memory can not be less than one tenth "
                    "Max memory.<br>Setting initial memory to the minimum "
                    "allowed value."))
        self.init_mem.setValue(self.max_mem_size.value() / 10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment