Compare commits

...

11 Commits

Author SHA1 Message Date
snoweay
63b61275c9 merge master to 20.04-SP4 to update to v0.2 2023-11-27 16:27:19 +08:00
openeuler-ci-bot
0d2ee91e04
!26 fix-specfile-error
From: @haomi0602 
Reviewed-by: @snoweay 
Signed-off-by: @snoweay
2022-09-07 03:04:24 +00:00
haomimi
fbdc5bacc0 Modify specfile-error in changelog 2022-07-28 16:32:33 +08:00
openeuler-ci-bot
8fc81c77a1 !22 支持nginx服务dump/restore
From: @anatas
Reviewed-by: @snoweay
Signed-off-by: @snoweay
2021-08-06 14:02:03 +00:00
anatasluo
a39bbe377c add support for nginx service dump/restore
1. add --skip-in-flight and --enable-external-masters options

For nginx service, it has a mount point in /run/user
which was used by pam_systemd to store non-essential
runtime files or objects(check more info in pam_systemd manpage).

To support dumpping such a mount point, criu needs enable
--enable-external-masters.

For in flight connections, we simply drop it.

2. restore pid file after restore from systemd

When I use systemd to restore nginx service,
I find that systemd will check pid file and it will
timeout since no value can be found in pid file.

To slove this problem, nvwa will supply this value
for systemd.

Signed-off-by: anatasluo <luolongjuna@gmail.com>
2021-08-06 21:37:54 +08:00
openeuler-ci-bot
416f649640 !20 合入0.2版本的必要patch
From: @anatas
Reviewed-by: @snoweay
Signed-off-by: @snoweay
2021-07-31 06:36:02 +00:00
anatasluo
3299128568 add necessary patches from version 0.2
Including following update:
1. do kexec load before criu dump
2. move nvwa socket from tmp to run
3. kexec add x
4. move pin tool from tools to tools/pin

Signed-off-by: anatasluo <luolongjuna@gmail.com>
2021-07-31 14:26:48 +08:00
openeuler-ci-bot
3386e47381 !16 添加kernel4.19版本下的use fork pid支持
From: @anatas
Reviewed-by: @snoweay
Signed-off-by: @snoweay
2021-07-30 03:02:21 +00:00
anatasluo
81599bcded add fork pid support for kernel 4.19
Signed-off-by: anatasluo <luolongjuna@gmail.com>
2021-07-30 02:22:49 +00:00
openeuler-ci-bot
f2f79df786 !15 更新版本至v0.1-2
From: @anatas
Reviewed-by: @yaqiangchen
Signed-off-by: @yaqiangchen
2021-04-21 15:08:21 +08:00
anatasluo
9bde36ed54 nvwa: update version to v0.1-2
Signed-off-by: anatasluo <luolongjuna@gmail.com>
2021-04-20 15:56:19 +08:00
5 changed files with 185 additions and 23 deletions

View File

@ -0,0 +1,39 @@
From fe0b709d2fe196097796b3b964803226c6ca9578 Mon Sep 17 00:00:00 2001
From: hejingxian <hejingxian@huawei.com>
Date: Thu, 1 Dec 2022 23:02:21 +0800
Subject: [PATCH] ignore pin memory init in x86
Signed-off-by: hejingxian <hejingxian@huawei.com>
---
misc/nvwa-pre.sh | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/misc/nvwa-pre.sh b/misc/nvwa-pre.sh
index 69f6de9..18960e7 100644
--- a/misc/nvwa-pre.sh
+++ b/misc/nvwa-pre.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-set -e
+#set -e
# 1. Increase last pid by 2011 from saved last pid.
# So services restoring may use its old pid.
@@ -32,8 +32,11 @@ else
fi
# 2. Enable Pin Memory
-modprobe pin_memory
-/usr/bin/nvwa-pin --init-pagemap-read
+is_x86=`uname -a | grep x86`
+if [[ $is_x86"X" == "X" ]]; then
+ modprobe pin_memory
+ /usr/bin/nvwa-pin --init-pagemap-read
+fi
# 3. Enable PMEM
grep -q "Persistent Memory" /proc/iomem || exit 0
--
2.20.1.windows.1

View File

@ -1,37 +1,62 @@
# nvwa
#### 介绍
A daemon process for kernel online update
#### 软件架构
软件架构说明
一个用于自动化openEuler热升级过程的工具
#### 构建方式
```
cd src
go get nvwa
go build
```
#### 关于配置
配置文件放置在config目录下运行时二进制会去三个地方寻找配置文件按照先后为
1. 运行目录
2. 运行目录的config子目录
3. /etc/nvwa
配置文件包括:
1. nvwa-restore.yaml
需要进行现场恢复的进程和服务两者区别在于对于每一个服务nvwa会去修改systemd的配置通过systemd恢复运行状态
2. nvwa-server.yaml
热升级使用中需要用到的目录,日志,二进制目录配置等等
#### 安装教程
#### 支持的命令
1. xxxx
2. xxxx
3. xxxx
+ nvwa check -- 运行环境检查
#### 使用说明
+ nvwa update <version> -- 热升级到相应的内核版本(相关文件需放置在/boot下)
1. xxxx
2. xxxx
3. xxxx
nvwa将会去/boot目录下寻找需要的kernel和rootfskernel的命名格式需为vmlinuz-<version>, rootfs命名格式需为initramfs-<version>.img
#### 参与贡献
+ nvwa restore <process> -- 恢复某个之前freeze的进程
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
+ nvwa help
显示client相关的帮助信息
#### 特技
+ nvwa --help
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
显示server相关的帮助信息
#### 开发计划
+ 将/boot目录下kernel和rootfs的命名格式放入配置项
+ 支持日志重定向至文件
+ 配置文件改变后,服务自动重新加载
+ server必须以root权限运行
+ server/client帮助文本的问题
+ 优化使用体验
+ 配置文件存在模糊的地方
+ nvwa的启动时机存在一定问题(criu对lsm之类存在依赖)
+ 网络dump/restore变成可选(否则会造成开机网络失效)

BIN
nvwa-v0.2.tar.gz Normal file

Binary file not shown.

98
nvwa.spec Normal file
View File

@ -0,0 +1,98 @@
Name: nvwa
Version: 0.2
Release: 2
Summary: a tool used for openEuler kernel update
License: MulanPSL-2.0 and Apache-2.0 and MIT and MPL-2.0
URL: https://gitee.com/openeuler/nvwa
Source: %{name}-v%{version}.tar.gz
#source1 version sys@v0.0.0-20220908164124-27713097b956
Source1: sys.tar.gz
Patch1: 0001-ignore-pin-memory-init-in-x86.patch
BuildRequires: golang >= 1.13
Requires: kexec-tools criu
Requires: systemd-units iptables-services iproute
Requires: gcc
%description
A tool used to automate the process of seamless update of the openEuler.
%global debug_package %{nil}
%prep
%autosetup -n %{name}-v%{version} -p1
%ifarch loongarch64
rm -rf src/vendor/golang.org/x/sys
tar -xf %{SOURCE1} -C src/vendor/golang.org/x/
%endif
%build
cd src
go build -mod=vendor -buildmode=pie
cd -
cd tools/pin
gcc %{name}-pin.c -o %{name}-pin -fstack-protector-all -fPIE -pie -Wl,-z,noexecstack,-z,relo,-z,now
cd -
%install
mkdir -p %{buildroot}/%{_bindir}
mkdir -p %{buildroot}/etc/%{name}
mkdir -p %{buildroot}/etc/%{name}/log
mkdir -p %{buildroot}/usr/lib/systemd/system
mkdir -p %{buildroot}/var/%{name}
mkdir -p %{buildroot}/var/%{name}/running
install -m 0750 %{_builddir}/%{name}-v%{version}/src/%{name} %{buildroot}/%{_bindir}/
install -m 0750 %{_builddir}/%{name}-v%{version}/tools/pin/%{name}-pin %{buildroot}/%{_bindir}/
install -m 0640 %{_builddir}/%{name}-v%{version}/src/config/%{name}-restore.yaml %{buildroot}/etc/%{name}/
install -m 0640 %{_builddir}/%{name}-v%{version}/src/config/%{name}-server.yaml %{buildroot}/etc/%{name}/
install -m 0750 %{_builddir}/%{name}-v%{version}/misc/%{name}-pre.sh %{buildroot}/%{_bindir}/
install -m 0644 %{_builddir}/%{name}-v%{version}/misc/%{name}.service %{buildroot}/usr/lib/systemd/system
install -m 0644 %{_builddir}/%{name}-v%{version}/misc/%{name}-pre.service %{buildroot}/usr/lib/systemd/system
install -d $RPM_BUILD_ROOT/usr/share/bash-completion/completions
install -p -m 0644 %{_builddir}/%{name}-v%{version}/completion/nvwa %{buildroot}/usr/share/bash-completion/completions/nvwa
%post
%systemd_post %{name}.service
%systemd_post %{name}-pre.service
source /usr/share/bash-completion/completions/nvwa
%preun
%systemd_preun %{name}.service
%postun
%systemd_postun_with_restart %{name}.service
%files
%license LICENSE
%dir /etc/%{name}/
%dir /etc/%{name}/log
%dir /var/%{name}
%dir /var/%{name}/running
/etc/%{name}/%{name}-restore.yaml
/etc/%{name}/%{name}-server.yaml
/usr/lib/systemd/system/%{name}.service
/usr/lib/systemd/system/%{name}-pre.service
/usr/share/bash-completion/completions/nvwa
%{_bindir}/%{name}
%{_bindir}/%{name}-pin
%{_bindir}/%{name}-pre.sh
%changelog
* Thu Jul 13 2023 huajingyun <huajingyun@loongson.cn> - 0.2-2
- add loong64 support
* Fri Jul 30 2021 anatasluo <luolongjun@huawei.com> - 0.2-1
- Update to 0.2
* Fri Mar 19 2021 snoweay <snoweay@163.com> - 0.1-3
- Add secure compile args
* Thu Mar 18 2021 anatasluo <luolongjun@huawei.com> 0.1-2
- Update to 0.1-r2
* Thu Feb 18 2021 anatasluo <luolongjun@huawei.com> - 0.0.1-1
- Update to 0.0.1

BIN
sys.tar.gz Normal file

Binary file not shown.