SHA256
1
0
forked from pool/qemu

Accepting request 225407 from home:saschpe:branches:Virtualization

- Add qemu-ksm subpackage providing a systemd service file for 
  enabling / disabling Kernel Samepage Merging. It is independent of
  qemu (but recommended by it).

OBS-URL: https://build.opensuse.org/request/show/225407
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=191
This commit is contained in:
Andreas Färber 2014-03-19 14:11:16 +00:00 committed by Git OBS Bridge
parent 355fe82b0e
commit 64aeaf97d7
4 changed files with 94 additions and 0 deletions

13
ksm.service Normal file
View File

@ -0,0 +1,13 @@
[Unit]
Description=Kernel Samepage Merging
ConditionPathExists=/sys/kernel/mm/ksm
ConditionVirtualization=no
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/bash -c "echo 1 > /sys/kernel/mm/ksm/run"
ExecStop=/bin/bash -c "echo 0 > /sys/kernel/mm/ksm/run"
[Install]
WantedBy=multi-user.target

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Mar 7 14:44:34 UTC 2014 - speilicke@suse.com
- Add qemu-ksm subpackage providing a systemd service file for
enabling / disabling Kernel Samepage Merging. It is independent of
qemu (but recommended by it).
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Feb 28 18:21:37 UTC 2014 - afaerber@suse.de Fri Feb 28 18:21:37 UTC 2014 - afaerber@suse.de

View File

@ -36,6 +36,7 @@ Source2: qemu-ifup
Source3: kvm_stat Source3: kvm_stat
Source4: qemu-kvm.1.gz Source4: qemu-kvm.1.gz
Source5: 60-kvm.rules Source5: 60-kvm.rules
Source6: ksm.service
# This patch queue is auto-generated from https://github.com/openSUSE/qemu # This patch queue is auto-generated from https://github.com/openSUSE/qemu
Patch0001: 0001-XXX-dont-dump-core-on-sigabort.patc.patch Patch0001: 0001-XXX-dont-dump-core-on-sigabort.patc.patch
Patch0002: 0002-XXX-work-around-SA_RESTART-race-wit.patch Patch0002: 0002-XXX-work-around-SA_RESTART-race-wit.patch
@ -145,6 +146,10 @@ BuildRequires: python
BuildRequires: usbredir-devel BuildRequires: usbredir-devel
%endif %endif
%if 0%{?suse_version} >= 1210 %if 0%{?suse_version} >= 1210
BuildRequires: systemd
%{?systemd_requires}
%define with_systemd 1
Recommends: qemu-ksm = %{version}
%if 0%{?suse_version} >= 1220 %if 0%{?suse_version} >= 1220
BuildRequires: vte-devel BuildRequires: vte-devel
%else %else
@ -395,6 +400,18 @@ as PC and PowerMac systems.
This sub-package contains the guest agent. This sub-package contains the guest agent.
%if 0%{?with_systemd}
%package ksm
Summary: Kernel Samepage Merging services
Group: System/Emulators/PC
%description ksm
Kernel Samepage Merging (KSM) is a memory-saving de-duplication feature,
that merges anonymous (private) pages (not pagecache ones).
This package provides a service file for starting and stopping KSM.
%endif
%prep %prep
%setup -q #-n %name-1.7.0-rc2 %setup -q #-n %name-1.7.0-rc2
%patch0001 -p1 %patch0001 -p1
@ -544,6 +561,7 @@ install -D -m 755 %{SOURCE2} %{buildroot}/usr/share/qemu/qemu-ifup
install -D -m 755 %{SOURCE3} %{buildroot}%{_bindir}/kvm_stat install -D -m 755 %{SOURCE3} %{buildroot}%{_bindir}/kvm_stat
install -D -m 644 %{SOURCE4} %{buildroot}%{_mandir}/man1/qemu-kvm.1.gz install -D -m 644 %{SOURCE4} %{buildroot}%{_mandir}/man1/qemu-kvm.1.gz
%endif %endif
install -D -p -m 0744 %{SOURCE6} %{buildroot}%{_unitdir}/ksm.service
%fdupes -s $RPM_BUILD_ROOT %fdupes -s $RPM_BUILD_ROOT
%clean %clean
@ -572,6 +590,20 @@ fi
%verify_permissions %_libexecdir/qemu-bridge-helper %verify_permissions %_libexecdir/qemu-bridge-helper
%endif %endif
%if 0%{?with_systemd}
%pre ksm
%service_add_pre ksm.service
%post ksm
%service_add_post ksm.service
%preun ksm
%service_del_preun ksm.service
%postun ksm
%service_del_postun ksm.service
%endif
%files %files
%defattr(-, root, root) %defattr(-, root, root)
%doc COPYING COPYING.LIB Changelog README VERSION qemu-doc.html qemu-tech.html %doc COPYING COPYING.LIB Changelog README VERSION qemu-doc.html qemu-tech.html
@ -719,4 +751,9 @@ fi
%defattr(-, root, root) %defattr(-, root, root)
%attr(755,root,kvm) %_bindir/qemu-ga %attr(755,root,kvm) %_bindir/qemu-ga
%if 0%{?with_systemd}
%files ksm
%{_unitdir}/ksm.service
%endif
%changelog %changelog

View File

@ -36,6 +36,7 @@ Source2: qemu-ifup
Source3: kvm_stat Source3: kvm_stat
Source4: qemu-kvm.1.gz Source4: qemu-kvm.1.gz
Source5: 60-kvm.rules Source5: 60-kvm.rules
Source6: ksm.service
# This patch queue is auto-generated from https://github.com/openSUSE/qemu # This patch queue is auto-generated from https://github.com/openSUSE/qemu
PATCH_FILES PATCH_FILES
# Please do not add patches manually here, run update_git.sh. # Please do not add patches manually here, run update_git.sh.
@ -104,6 +105,10 @@ BuildRequires: python
BuildRequires: usbredir-devel BuildRequires: usbredir-devel
%endif %endif
%if 0%{?suse_version} >= 1210 %if 0%{?suse_version} >= 1210
BuildRequires: systemd
%{?systemd_requires}
%define with_systemd 1
Recommends: qemu-ksm = %{version}
%if 0%{?suse_version} >= 1220 %if 0%{?suse_version} >= 1220
BuildRequires: vte-devel BuildRequires: vte-devel
%else %else
@ -354,6 +359,18 @@ as PC and PowerMac systems.
This sub-package contains the guest agent. This sub-package contains the guest agent.
%if 0%{?with_systemd}
%package ksm
Summary: Kernel Samepage Merging services
Group: System/Emulators/PC
%description ksm
Kernel Samepage Merging (KSM) is a memory-saving de-duplication feature,
that merges anonymous (private) pages (not pagecache ones).
This package provides a service file for starting and stopping KSM.
%endif
%prep %prep
%setup -q #-n %name-1.7.0-rc2 %setup -q #-n %name-1.7.0-rc2
PATCH_EXEC PATCH_EXEC
@ -462,6 +479,7 @@ install -D -m 755 %{SOURCE2} %{buildroot}/usr/share/qemu/qemu-ifup
install -D -m 755 %{SOURCE3} %{buildroot}%{_bindir}/kvm_stat install -D -m 755 %{SOURCE3} %{buildroot}%{_bindir}/kvm_stat
install -D -m 644 %{SOURCE4} %{buildroot}%{_mandir}/man1/qemu-kvm.1.gz install -D -m 644 %{SOURCE4} %{buildroot}%{_mandir}/man1/qemu-kvm.1.gz
%endif %endif
install -D -p -m 0744 %{SOURCE6} %{buildroot}%{_unitdir}/ksm.service
%fdupes -s $RPM_BUILD_ROOT %fdupes -s $RPM_BUILD_ROOT
%clean %clean
@ -490,6 +508,20 @@ fi
%verify_permissions %_libexecdir/qemu-bridge-helper %verify_permissions %_libexecdir/qemu-bridge-helper
%endif %endif
%if 0%{?with_systemd}
%pre ksm
%service_add_pre ksm.service
%post ksm
%service_add_post ksm.service
%preun ksm
%service_del_preun ksm.service
%postun ksm
%service_del_postun ksm.service
%endif
%files %files
%defattr(-, root, root) %defattr(-, root, root)
%doc COPYING COPYING.LIB Changelog README VERSION qemu-doc.html qemu-tech.html %doc COPYING COPYING.LIB Changelog README VERSION qemu-doc.html qemu-tech.html
@ -637,4 +669,9 @@ fi
%defattr(-, root, root) %defattr(-, root, root)
%attr(755,root,kvm) %_bindir/qemu-ga %attr(755,root,kvm) %_bindir/qemu-ga
%if 0%{?with_systemd}
%files ksm
%{_unitdir}/ksm.service
%endif
%changelog %changelog