Skip to content

Commit

Permalink
F #3124 Add DROP_CACHES option to kvmrc
Browse files Browse the repository at this point in the history
Signed-off-by: kvaps <kvapss@gmail.com>
  • Loading branch information
kvaps committed Sep 3, 2020
1 parent 8bd6804 commit 1ddb01e
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 5 deletions.
3 changes: 2 additions & 1 deletion share/pkgs/CentOS/opennebula.sudoers
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ Cmnd_Alias ONE_XEN = /usr/sbin/xentop, /usr/sbin/xl, /usr/sbin/xm
Cmnd_Alias ONE_CEPH = /usr/bin/rbd
Cmnd_Alias ONE_MARKET = /usr/lib/one/sh/create_container_image.sh
Cmnd_Alias ONE_HA = /usr/bin/systemctl start opennebula-flow, /usr/bin/systemctl stop opennebula-flow, /usr/bin/systemctl start opennebula-gate, /usr/bin/systemctl stop opennebula-gate, /usr/sbin/service opennebula-flow start, /usr/sbin/service opennebula-flow stop, /usr/sbin/service opennebula-gate start, /usr/sbin/service opennebula-gate stop
Cmnd_Alias ONE_SYSCTL = /usr/sbin/sysctl vm.drop_caches=1

oneadmin ALL=(ALL) NOPASSWD: ONE_MISC, ONE_NET, ONE_LVM, ONE_ISCSI, ONE_OVS, ONE_XEN, ONE_CEPH, ONE_MARKET, ONE_HA
oneadmin ALL=(ALL) NOPASSWD: ONE_MISC, ONE_NET, ONE_LVM, ONE_ISCSI, ONE_OVS, ONE_XEN, ONE_CEPH, ONE_MARKET, ONE_HA, ONE_SYSCTL
3 changes: 2 additions & 1 deletion share/pkgs/Debian7/opennebula.sudoers
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ Cmnd_Alias ONE_XEN = /usr/sbin/xentop, /usr/sbin/xl, /usr/sbin/xm
Cmnd_Alias ONE_CEPH = /usr/bin/rbd
Cmnd_Alias ONE_MARKET = /usr/lib/one/sh/create_container_image.sh
Cmnd_Alias ONE_HA = /bin/systemctl start opennebula-flow, /bin/systemctl stop opennebula-flow, /bin/systemctl start opennebula-gate, /bin/systemctl stop opennebula-gate, /usr/sbin/service opennebula-flow start, /usr/sbin/service opennebula-flow stop, /usr/sbin/service opennebula-gate start, /usr/sbin/service opennebula-gate stop
Cmnd_Alias ONE_SYSCTL = /sbin/sysctl vm.drop_caches=1

oneadmin ALL=(ALL) NOPASSWD: ONE_MISC, ONE_NET, ONE_LVM, ONE_ISCSI, ONE_OVS, ONE_XEN, ONE_CEPH, ONE_MARKET, ONE_HA
oneadmin ALL=(ALL) NOPASSWD: ONE_MISC, ONE_NET, ONE_LVM, ONE_ISCSI, ONE_OVS, ONE_XEN, ONE_CEPH, ONE_MARKET, ONE_HA, ONE_SYSCTL
3 changes: 2 additions & 1 deletion share/pkgs/Debian8/opennebula.sudoers
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ Cmnd_Alias ONE_XEN = /usr/sbin/xentop, /usr/sbin/xl, /usr/sbin/xm
Cmnd_Alias ONE_CEPH = /usr/bin/rbd
Cmnd_Alias ONE_MARKET = /usr/lib/one/sh/create_container_image.sh
Cmnd_Alias ONE_HA = /bin/systemctl start opennebula-flow, /bin/systemctl stop opennebula-flow, /bin/systemctl start opennebula-gate, /bin/systemctl stop opennebula-gate, /usr/sbin/service opennebula-flow start, /usr/sbin/service opennebula-flow stop, /usr/sbin/service opennebula-gate start, /usr/sbin/service opennebula-gate stop
Cmnd_Alias ONE_SYSCTL = /sbin/sysctl vm.drop_caches=1

oneadmin ALL=(ALL) NOPASSWD: ONE_MISC, ONE_NET, ONE_LVM, ONE_ISCSI, ONE_OVS, ONE_XEN, ONE_CEPH, ONE_MARKET, ONE_HA
oneadmin ALL=(ALL) NOPASSWD: ONE_MISC, ONE_NET, ONE_LVM, ONE_ISCSI, ONE_OVS, ONE_XEN, ONE_CEPH, ONE_MARKET, ONE_HA, ONE_SYSCTL
3 changes: 2 additions & 1 deletion share/pkgs/Ubuntu/opennebula.sudoers
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ Cmnd_Alias ONE_XEN = /usr/sbin/xentop, /usr/sbin/xl, /usr/sbin/xm
Cmnd_Alias ONE_CEPH = /usr/bin/rbd
Cmnd_Alias ONE_MARKET = /usr/lib/one/sh/create_container_image.sh
Cmnd_Alias ONE_HA = /bin/systemctl start opennebula-flow, /bin/systemctl stop opennebula-flow, /bin/systemctl start opennebula-gate, /bin/systemctl stop opennebula-gate, /usr/sbin/service opennebula-flow start, /usr/sbin/service opennebula-flow stop, /usr/sbin/service opennebula-gate start, /usr/sbin/service opennebula-gate stop
Cmnd_Alias ONE_SYSCTL = /sbin/sysctl vm.drop_caches=1

oneadmin ALL=(ALL) NOPASSWD: ONE_MISC, ONE_NET, ONE_LVM, ONE_ISCSI, ONE_OVS, ONE_XEN, ONE_CEPH, ONE_MARKET, ONE_HA
oneadmin ALL=(ALL) NOPASSWD: ONE_MISC, ONE_NET, ONE_LVM, ONE_ISCSI, ONE_OVS, ONE_XEN, ONE_CEPH, ONE_MARKET, ONE_HA, ONE_SYSCTL
3 changes: 2 additions & 1 deletion share/pkgs/openSUSE/opennebula.sudoers
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ Cmnd_Alias ONE_OVS = /usr/bin/ovs-ofctl, /usr/bin/ovs-vsctl
Cmnd_Alias ONE_XEN = /usr/sbin/xentop, /usr/sbin/xl, /usr/sbin/xm
Cmnd_Alias ONE_MARKET = /usr/lib/one/sh/create_container_image.sh
Cmnd_Alias ONE_HA = /usr/bin/systemctl start opennebula-flow, /usr/bin/systemctl stop opennebula-flow, /usr/bin/systemctl start opennebula-gate, /usr/bin/systemctl stop opennebula-gate, /sbin/service opennebula-flow start, /sbin/service opennebula-flow stop, /sbin/service opennebula-gate start, /sbin/service opennebula-gate stop
Cmnd_Alias ONE_SYSCTL = /usr/sbin/sysctl vm.drop_caches=1

oneadmin ALL=(ALL) NOPASSWD: ONE_MISC, ONE_NET, ONE_LVM, ONE_ISCSI, ONE_OVS, ONE_XEN, ONE_MARKET, ONE_HA
oneadmin ALL=(ALL) NOPASSWD: ONE_MISC, ONE_NET, ONE_LVM, ONE_ISCSI, ONE_OVS, ONE_XEN, ONE_MARKET, ONE_HA, ONE_SYSCTL
4 changes: 4 additions & 0 deletions src/vmm_mad/remotes/kvm/deploy
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ DEP_FILE_LOCATION=$(dirname $DEP_FILE)
mkdir -p $DEP_FILE_LOCATION
cat > $DEP_FILE

if [ "x$DROP_CACHES" = "xyes" ]; then
sudo sysctl vm.drop_caches=1 >/dev/null
fi

DATA=`virsh --connect $LIBVIRT_URI create $DEP_FILE`

if [ "x$?" = "x0" ]; then
Expand Down
6 changes: 6 additions & 0 deletions src/vmm_mad/remotes/kvm/kvmrc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ export LIBVIRT_MD_KEY=one
# Seconds to wait after shutdown until timeout
export SHUTDOWN_TIMEOUT=300

# Sometimes using writethrough cache may produce 'Cannot allocate memory'
# errors durting the VM allocation. Uncomment this line to drop caches each
# time before starting the VM, this would allow to free up memory and guarantee
# the needed capacity to fit the virtual machine on the host.
#export DROP_CACHES=yes

# Uncomment this line to force VM cancellation after shutdown timeout
#export FORCE_DESTROY=yes

Expand Down

1 comment on commit 1ddb01e

@GitCop
Copy link

@GitCop GitCop commented on 1ddb01e Sep 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were the following issues with your Pull Request

  • Subject needs to conform to "%{type} #%{issue_number}: %{description}"

Guidelines are available at https://github.com/OpenNebula/one/blob/master/share/doc/dev/COMMIT_MESSAGES.md


This message was auto-generated by https://gitcop.com

Please sign in to comment.