From 2094d96fc69a8af0e97fbc9accd95f2a72e1f4eb011996965ed5ff1aca61a694 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Wed, 22 Jul 2020 12:50:40 +0000 Subject: [PATCH 1/8] Accepting request 822192 from home:Guillaume_G:branches:openSUSE:Factory:ARM - Enable build on aarch64 OBS-URL: https://build.opensuse.org/request/show/822192 OBS-URL: https://build.opensuse.org/package/show/Virtualization/hyper-v?expand=0&rev=144 --- hyper-v.changes | 5 +++++ hyper-v.spec | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/hyper-v.changes b/hyper-v.changes index 8fbce23..5a35357 100644 --- a/hyper-v.changes +++ b/hyper-v.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Jul 22 09:12:44 UTC 2020 - Guillaume GARDET + +- Enable build on aarch64 + ------------------------------------------------------------------- Thu Feb 20 16:16:16 UTC 2020 - ohering@suse.de diff --git a/hyper-v.spec b/hyper-v.spec index d8ee039..d9ca781 100644 --- a/hyper-v.spec +++ b/hyper-v.spec @@ -22,7 +22,7 @@ %define helper_dir /usr/lib/%{name} Name: hyper-v -ExclusiveArch: %ix86 x86_64 +ExclusiveArch: %ix86 x86_64 aarch64 # systemd for post 13.1 releases %if 0%{?suse_version} > 1310 %define use_systemd 1 From 599863ea32c97c03496cb1453d161e64d74ae5e7def6ca638b9ce2f863b407f4 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Wed, 22 Jul 2020 12:55:27 +0000 Subject: [PATCH 2/8] - Remove dependency to network-online.target now that gethostname is used in kvp_daemon OBS-URL: https://build.opensuse.org/package/show/Virtualization/hyper-v?expand=0&rev=145 --- hyper-v.changes | 6 ++++++ hyper-v.spec | 4 +--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/hyper-v.changes b/hyper-v.changes index 5a35357..5a2c48f 100644 --- a/hyper-v.changes +++ b/hyper-v.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Jul 22 12:12:12 UTC 2020 - ohering@suse.de + +- Remove dependency to network-online.target now that gethostname + is used in kvp_daemon + ------------------------------------------------------------------- Wed Jul 22 09:12:44 UTC 2020 - Guillaume GARDET diff --git a/hyper-v.spec b/hyper-v.spec index d9ca781..258fb22 100644 --- a/hyper-v.spec +++ b/hyper-v.spec @@ -139,9 +139,7 @@ tee ${d}/%{hv_kvp_daemon}.service < Date: Wed, 22 Jul 2020 14:05:13 +0000 Subject: [PATCH 3/8] - Reopen the devices if read() or write() returns errors (9fc3c01a) OBS-URL: https://build.opensuse.org/package/show/Virtualization/hyper-v?expand=0&rev=146 --- hyper-v.changes | 1 + hyper-v.tools.hv.hv_fcopy_daemon.c | 37 +++++++++++++++++++--- hyper-v.tools.hv.hv_kvp_daemon.c | 36 +++++++++++++--------- hyper-v.tools.hv.hv_vss_daemon.c | 49 +++++++++++++++++++++++------- 4 files changed, 92 insertions(+), 31 deletions(-) diff --git a/hyper-v.changes b/hyper-v.changes index 5a2c48f..232f5ad 100644 --- a/hyper-v.changes +++ b/hyper-v.changes @@ -3,6 +3,7 @@ Wed Jul 22 12:12:12 UTC 2020 - ohering@suse.de - Remove dependency to network-online.target now that gethostname is used in kvp_daemon +- Reopen the devices if read() or write() returns errors (9fc3c01a) ------------------------------------------------------------------- Wed Jul 22 09:12:44 UTC 2020 - Guillaume GARDET diff --git a/hyper-v.tools.hv.hv_fcopy_daemon.c b/hyper-v.tools.hv.hv_fcopy_daemon.c index 5d64e20..11628d1 100644 --- a/hyper-v.tools.hv.hv_fcopy_daemon.c +++ b/hyper-v.tools.hv.hv_fcopy_daemon.c @@ -80,6 +80,8 @@ static int hv_start_fcopy(struct hv_start_fcopy *smsg) error = 0; done: + if (error) + target_fname[0] = '\0'; return error; } @@ -108,15 +110,29 @@ static int hv_copy_data(struct hv_do_fcopy *cpmsg) return ret; } +/* + * Reset target_fname to "" in the two below functions for hibernation: if + * the fcopy operation is aborted by hibernation, the daemon should remove the + * partially-copied file; to achieve this, the hv_utils driver always fakes a + * CANCEL_FCOPY message upon suspend, and later when the VM resumes back, + * the daemon calls hv_copy_cancel() to remove the file; if a file is copied + * successfully before suspend, hv_copy_finished() must reset target_fname to + * avoid that the file can be incorrectly removed upon resume, since the faked + * CANCEL_FCOPY message is spurious in this case. + */ static int hv_copy_finished(void) { close(target_fd); + target_fname[0] = '\0'; return 0; } static int hv_copy_cancel(void) { close(target_fd); - unlink(target_fname); + if (strlen(target_fname) > 0) { + unlink(target_fname); + target_fname[0] = '\0'; + } return 0; } @@ -131,7 +147,7 @@ void print_usage(char *argv[]) int main(int argc, char *argv[]) { - int fcopy_fd; + int fcopy_fd = -1; int error; int daemonize = 1, long_index = 0, opt; int version = FCOPY_CURRENT_VERSION; @@ -141,7 +157,7 @@ int main(int argc, char *argv[]) struct hv_do_fcopy copy; __u32 kernel_modver; } buffer = { }; - int in_handshake = 1; + int in_handshake; static struct option long_options[] = { {"help", no_argument, 0, 'h' }, @@ -170,6 +186,12 @@ int main(int argc, char *argv[]) openlog("HV_FCOPY", 0, LOG_USER); syslog(LOG_INFO, "starting; pid is:%d", getpid()); +reopen_fcopy_fd: + if (fcopy_fd != -1) + close(fcopy_fd); + /* Remove any possible partially-copied file on error */ + hv_copy_cancel(); + in_handshake = 1; fcopy_fd = open("/dev/vmbus/hv_fcopy", O_RDWR); if (fcopy_fd < 0) { @@ -196,7 +218,7 @@ int main(int argc, char *argv[]) len = pread(fcopy_fd, &buffer, sizeof(buffer), 0); if (len < 0) { syslog(LOG_ERR, "pread failed: %s", strerror(errno)); - exit(EXIT_FAILURE); + goto reopen_fcopy_fd; } if (in_handshake) { @@ -231,9 +253,14 @@ int main(int argc, char *argv[]) } + /* + * pwrite() may return an error due to the faked CANCEL_FCOPY + * message upon hibernation. Ignore the error by resetting the + * dev file, i.e. closing and re-opening it. + */ if (pwrite(fcopy_fd, &error, sizeof(int), 0) != sizeof(int)) { syslog(LOG_ERR, "pwrite failed: %s", strerror(errno)); - exit(EXIT_FAILURE); + goto reopen_fcopy_fd; } } } diff --git a/hyper-v.tools.hv.hv_kvp_daemon.c b/hyper-v.tools.hv.hv_kvp_daemon.c index 7986e62..3e07295 100644 --- a/hyper-v.tools.hv.hv_kvp_daemon.c +++ b/hyper-v.tools.hv.hv_kvp_daemon.c @@ -76,7 +76,7 @@ enum { DNS }; -static int in_hand_shake = 1; +static int in_hand_shake; static char *os_name = ""; static char *os_major = ""; @@ -1361,7 +1361,7 @@ void print_usage(char *argv[]) int main(int argc, char *argv[]) { - int kvp_fd, len; + int kvp_fd = -1, len; int error; struct pollfd pfd; char *p; @@ -1401,14 +1401,6 @@ int main(int argc, char *argv[]) openlog("KVP", 0, LOG_USER); syslog(LOG_INFO, "KVP starting; pid is:%d", getpid()); - kvp_fd = open("/dev/vmbus/hv_kvp", O_RDWR | O_CLOEXEC); - - if (kvp_fd < 0) { - syslog(LOG_ERR, "open /dev/vmbus/hv_kvp failed; error: %d %s", - errno, strerror(errno)); - exit(EXIT_FAILURE); - } - /* * Retrieve OS release information. */ @@ -1424,6 +1416,18 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } +reopen_kvp_fd: + if (kvp_fd != -1) + close(kvp_fd); + in_hand_shake = 1; + kvp_fd = open("/dev/vmbus/hv_kvp", O_RDWR | O_CLOEXEC); + + if (kvp_fd < 0) { + syslog(LOG_ERR, "open /dev/vmbus/hv_kvp failed; error: %d %s", + errno, strerror(errno)); + exit(EXIT_FAILURE); + } + /* * Register ourselves with the kernel. */ @@ -1457,9 +1461,7 @@ int main(int argc, char *argv[]) if (len != sizeof(struct hv_kvp_msg)) { syslog(LOG_ERR, "read failed; error:%d %s", errno, strerror(errno)); - - close(kvp_fd); - return EXIT_FAILURE; + goto reopen_kvp_fd; } /* @@ -1618,13 +1620,17 @@ int main(int argc, char *argv[]) break; } - /* Send the value back to the kernel. */ + /* + * Send the value back to the kernel. Note: the write() may + * return an error due to hibernation; we can ignore the error + * by resetting the dev file, i.e. closing and re-opening it. + */ kvp_done: len = write(kvp_fd, hv_msg, sizeof(struct hv_kvp_msg)); if (len != sizeof(struct hv_kvp_msg)) { syslog(LOG_ERR, "write failed; error: %d %s", errno, strerror(errno)); - exit(EXIT_FAILURE); + goto reopen_kvp_fd; } } diff --git a/hyper-v.tools.hv.hv_vss_daemon.c b/hyper-v.tools.hv.hv_vss_daemon.c index 76ea8fa..62b9a9e 100644 --- a/hyper-v.tools.hv.hv_vss_daemon.c +++ b/hyper-v.tools.hv.hv_vss_daemon.c @@ -28,6 +28,8 @@ #include #include +static bool fs_frozen; + /* Don't use syslog() in the function since that can cause write to disk */ static int vss_do_freeze(char *dir, unsigned int cmd) { @@ -155,18 +157,27 @@ static int vss_operate(int operation) continue; } error |= vss_do_freeze(ent->mnt_dir, cmd); - if (error && operation == VSS_OP_FREEZE) - goto err; + if (operation == VSS_OP_FREEZE) { + if (error) + goto err; + fs_frozen = true; + } } endmntent(mounts); if (root_seen) { error |= vss_do_freeze("/", cmd); - if (error && operation == VSS_OP_FREEZE) - goto err; + if (operation == VSS_OP_FREEZE) { + if (error) + goto err; + fs_frozen = true; + } } + if (operation == VSS_OP_THAW && !error) + fs_frozen = false; + goto out; err: save_errno = errno; @@ -175,6 +186,7 @@ err: endmntent(mounts); } vss_operate(VSS_OP_THAW); + fs_frozen = false; /* Call syslog after we thaw all filesystems */ if (ent) syslog(LOG_ERR, "FREEZE of %s failed; error:%d %s", @@ -196,13 +208,13 @@ void print_usage(char *argv[]) int main(int argc, char *argv[]) { - int vss_fd, len; + int vss_fd = -1, len; int error; struct pollfd pfd; int op; struct hv_vss_msg vss_msg[1]; int daemonize = 1, long_index = 0, opt; - int in_handshake = 1; + int in_handshake; __u32 kernel_modver; static struct option long_options[] = { @@ -232,6 +244,18 @@ int main(int argc, char *argv[]) openlog("Hyper-V VSS", 0, LOG_USER); syslog(LOG_INFO, "VSS starting; pid is:%d", getpid()); +reopen_vss_fd: + if (vss_fd != -1) + close(vss_fd); + if (fs_frozen) { + if (vss_operate(VSS_OP_THAW) || fs_frozen) { + syslog(LOG_ERR, "failed to thaw file system: err=%d", + errno); + exit(EXIT_FAILURE); + } + } + + in_handshake = 1; vss_fd = open("/dev/vmbus/hv_vss", O_RDWR); if (vss_fd < 0) { syslog(LOG_ERR, "open /dev/vmbus/hv_vss failed; error: %d %s", @@ -284,8 +308,7 @@ int main(int argc, char *argv[]) if (len != sizeof(struct hv_vss_msg)) { syslog(LOG_ERR, "read failed; error:%d %s", errno, strerror(errno)); - close(vss_fd); - return EXIT_FAILURE; + goto reopen_vss_fd; } op = vss_msg->vss_hdr.operation; @@ -312,14 +335,18 @@ int main(int argc, char *argv[]) default: syslog(LOG_ERR, "Illegal op:%d\n", op); } + + /* + * The write() may return an error due to the faked VSS_OP_THAW + * message upon hibernation. Ignore the error by resetting the + * dev file, i.e. closing and re-opening it. + */ vss_msg->error = error; len = write(vss_fd, vss_msg, sizeof(struct hv_vss_msg)); if (len != sizeof(struct hv_vss_msg)) { syslog(LOG_ERR, "write failed; error: %d %s", errno, strerror(errno)); - - if (op == VSS_OP_FREEZE) - vss_operate(VSS_OP_THAW); + goto reopen_vss_fd; } } From f5d3d1ed862b8f6035564cc256b5692d10ea7774182dbf560f6028581aac817f Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Thu, 23 Jul 2020 17:49:05 +0000 Subject: [PATCH 4/8] add bugnumber for network-online.target change (bsc#1174443, bsc#1174444) OBS-URL: https://build.opensuse.org/package/show/Virtualization/hyper-v?expand=0&rev=147 --- hyper-v.changes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hyper-v.changes b/hyper-v.changes index 232f5ad..b855938 100644 --- a/hyper-v.changes +++ b/hyper-v.changes @@ -2,7 +2,7 @@ Wed Jul 22 12:12:12 UTC 2020 - ohering@suse.de - Remove dependency to network-online.target now that gethostname - is used in kvp_daemon + is used in kvp_daemon (bsc#1174443, bsc#1174444) - Reopen the devices if read() or write() returns errors (9fc3c01a) ------------------------------------------------------------------- From 4f1eeb9e6c785f026dd2a5b68ef21bb428a0837c783640577b8c5f34056e82a1 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Thu, 23 Jul 2020 17:50:09 +0000 Subject: [PATCH 5/8] whitespace OBS-URL: https://build.opensuse.org/package/show/Virtualization/hyper-v?expand=0&rev=148 --- hyper-v.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hyper-v.spec b/hyper-v.spec index 258fb22..93605fa 100644 --- a/hyper-v.spec +++ b/hyper-v.spec @@ -72,7 +72,7 @@ cp -avL %{S:5} kvptest.ps1.txt cp -vL %{S:9} %{hv_kvp_daemon}.h cp -vL %{S:10} . cp -vL %{S:12} %{hv_vss_daemon}.c -cp -vL %{S:14} %{hv_fcopy_daemon}.c +cp -vL %{S:14} %{hv_fcopy_daemon}.c %patch0 -p1 mv `basename %{S:10}` %{hv_kvp_daemon}.c From 7d6e81168508d3ac4acc27e7b158104d84c8e0d442a0f6c988afbcc293a3cc3c Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Thu, 23 Jul 2020 18:06:33 +0000 Subject: [PATCH 6/8] - Use either python2 or python3 for lsvmbus (bsc#1093910) OBS-URL: https://build.opensuse.org/package/show/Virtualization/hyper-v?expand=0&rev=149 --- hyper-v.changes | 1 + hyper-v.spec | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/hyper-v.changes b/hyper-v.changes index b855938..4c25cb2 100644 --- a/hyper-v.changes +++ b/hyper-v.changes @@ -4,6 +4,7 @@ Wed Jul 22 12:12:12 UTC 2020 - ohering@suse.de - Remove dependency to network-online.target now that gethostname is used in kvp_daemon (bsc#1174443, bsc#1174444) - Reopen the devices if read() or write() returns errors (9fc3c01a) +- Use either python2 or python3 for lsvmbus (bsc#1093910) ------------------------------------------------------------------- Wed Jul 22 09:12:44 UTC 2020 - Guillaume GARDET diff --git a/hyper-v.spec b/hyper-v.spec index 93605fa..a9bc016 100644 --- a/hyper-v.spec +++ b/hyper-v.spec @@ -122,11 +122,21 @@ bindir=%{helper_dir}/bin bindir=%{_sbindir} %endif mkdir -p $RPM_BUILD_ROOT${bindir} +mkdir -p $RPM_BUILD_ROOT%{_sbindir} mkdir -p $RPM_BUILD_ROOT%{helper_dir}/bin install -m755 %{hv_kvp_daemon} $RPM_BUILD_ROOT${bindir} install -m755 %{hv_vss_daemon} $RPM_BUILD_ROOT${bindir} install -m755 %{hv_fcopy_daemon} $RPM_BUILD_ROOT${bindir} -install -D -m755 %{S:0} $RPM_BUILD_ROOT%{_sbindir}/lsvmbus +sed ' +1 { +%if 0%{?suse_version} > 1315 +s@^.*@#!%{_bindir}/python3@ +%else +s@^.*@#!%{_bindir}/python2@ +%endif +} +' %{S:0} > $RPM_BUILD_ROOT%{_sbindir}/lsvmbus +chmod 0755 $RPM_BUILD_ROOT%{_sbindir}/lsvmbus cp -avL %{S:20} $RPM_BUILD_ROOT%{helper_dir}/bin/hv_get_dhcp_info cp -avL %{S:21} $RPM_BUILD_ROOT%{helper_dir}/bin/hv_get_dns_info cp -avL %{S:22} $RPM_BUILD_ROOT%{helper_dir}/bin/hv_set_ifconfig From 32366f3518e11d870814d0897f05a7e17c2cdab7bdb0a5a8ab38269191cb9cbe Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Thu, 23 Jul 2020 18:10:31 +0000 Subject: [PATCH 7/8] - Remove sysv init scripts OBS-URL: https://build.opensuse.org/package/show/Virtualization/hyper-v?expand=0&rev=150 --- hyper-v.changes | 1 + hyper-v.init.fcopy.sh | 82 ---------------------------------- hyper-v.init.sh | 101 ------------------------------------------ hyper-v.init.vss.sh | 82 ---------------------------------- hyper-v.spec | 53 ---------------------- 5 files changed, 1 insertion(+), 318 deletions(-) delete mode 100644 hyper-v.init.fcopy.sh delete mode 100644 hyper-v.init.sh delete mode 100644 hyper-v.init.vss.sh diff --git a/hyper-v.changes b/hyper-v.changes index 4c25cb2..05baef0 100644 --- a/hyper-v.changes +++ b/hyper-v.changes @@ -5,6 +5,7 @@ Wed Jul 22 12:12:12 UTC 2020 - ohering@suse.de is used in kvp_daemon (bsc#1174443, bsc#1174444) - Reopen the devices if read() or write() returns errors (9fc3c01a) - Use either python2 or python3 for lsvmbus (bsc#1093910) +- Remove sysv init scripts ------------------------------------------------------------------- Wed Jul 22 09:12:44 UTC 2020 - Guillaume GARDET diff --git a/hyper-v.init.fcopy.sh b/hyper-v.init.fcopy.sh deleted file mode 100644 index 7650ed6..0000000 --- a/hyper-v.init.fcopy.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/sh -# -# LSB compatible service control script; see http://www.linuxbase.org/spec/ -# -### BEGIN INIT INFO -# Provides: hv_fcopy_daemon -# Required-Start: $null -# Should-Start: $syslog $remote_fs $time -# Required-Stop: $null -# Should-Stop: $syslog $remote_fs $time -# Default-Start: 3 5 -# Default-Stop: 0 1 2 6 -# Short-Description: hv_fcopy_daemon receives files from the host -# Description: Start hv_fcopy_daemon to allow the host to copy files into this guest -### END INIT INFO - -# Check for missing binaries (stale symlinks should not happen) -# Note: Special treatment of stop for LSB conformance -HV_FCOPY_BIN=/usr/sbin/hv_fcopy_daemon -test -x $HV_FCOPY_BIN || { echo "$HV_FCOPY_BIN not installed"; - if [ "$1" = "stop" ]; then exit 0; - else exit 5; fi; } - -. /etc/rc.status - -# Reset status of this service -rc_reset - -case "$1" in - start) - echo -n "Starting Hyper-V FCOPY daemon " - env PATH=/usr/lib/hyper-v/bin:$PATH \ - startproc $HV_FCOPY_BIN - rc_status -v - ;; - stop) - echo -n "Shutting down Hyper-V FCOPY daemon " - killproc -TERM $HV_FCOPY_BIN - rc_status -v - ;; - try-restart|condrestart) - if test "$1" = "condrestart"; then - echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" - fi - $0 status - if test $? = 0; then - $0 restart - else - rc_reset # Not running is not a failure. - fi - # Remember status and be quiet - rc_status - ;; - restart) - ## Stop the service and regardless of whether it was - ## running or not, start it again. - $0 stop - $0 start - - # Remember status and be quiet - rc_status - ;; - force-reload) - echo -n "Reload service Hyper-V FCOPY daemon " - $0 try-restart - rc_status - ;; - reload) - rc_failed 3 - rc_status -v - ;; - status) - echo -n "Checking for service Hyper-V FCOPY daemon " - checkproc $HV_FCOPY_BIN - rc_status -v - ;; - *) - echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}" - exit 1 - ;; -esac -rc_exit diff --git a/hyper-v.init.sh b/hyper-v.init.sh deleted file mode 100644 index 7eb31bf..0000000 --- a/hyper-v.init.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/sh -# -# LSB compatible service control script; see http://www.linuxbase.org/spec/ -# -### BEGIN INIT INFO -# Provides: hv_kvp_daemon -# Required-Start: $null -# Should-Start: $syslog $remote_fs $time -# Required-Stop: $null -# Should-Stop: $syslog $remote_fs $time -# Default-Start: 3 5 -# Default-Stop: 0 1 2 6 -# Short-Description: hv_kvp_daemon provides info to the host -# Description: Start hv_kvp_daemon to allow the host to query this guest -### END INIT INFO - -# Check for missing binaries (stale symlinks should not happen) -# Note: Special treatment of stop for LSB conformance -HV_KVP_BIN=/usr/sbin/hv_kvp_daemon -test -x $HV_KVP_BIN || { echo "$HV_KVP_BIN not installed"; - if [ "$1" = "stop" ]; then exit 0; - else exit 5; fi; } - -. /etc/rc.status - -# Reset status of this service -rc_reset - -case "$1" in - start) - echo -n "Starting Hyper-V KVP daemon " - # The service can not be restarted - # IF the currently running kernel is too old, the new daemon is started - # anyway. Due to a flaw in the old kernel-user protocol the kernel - # will flood /var/log/messages with messages like: - # "hv_utils: KVP: user-mode registering done." - # This is also caused by old hyper-v.rpms which have a restart command - # in their post install script. Catch those old kernels and avoid the - # flood, which will easily fill the root partition during an upgrade. - case "`uname -r`" in - 2.*) rc_failed 3 ;; - 3.0.13-*) rc_failed 3 ;; - 3.0.26-*) rc_failed 3 ;; - 3.0.31-*) rc_failed 3 ;; - 3.0.34-*) rc_failed 3 ;; - 3.0.38-*) rc_failed 3 ;; - 3.0.42-*) rc_failed 3 ;; - *) - env PATH=/usr/lib/hyper-v/bin:$PATH \ - startproc $HV_KVP_BIN - ;; - esac - rc_status -v - ;; - stop) - echo -n "Shutting down Hyper-V KVP daemon " - killproc -TERM $HV_KVP_BIN - rc_status -v - ;; - try-restart|condrestart) - if test "$1" = "condrestart"; then - echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" - fi - $0 status - if test $? = 0; then - $0 restart - else - rc_reset # Not running is not a failure. - fi - # Remember status and be quiet - rc_status - ;; - restart) - ## Stop the service and regardless of whether it was - ## running or not, start it again. - $0 stop - $0 start - - # Remember status and be quiet - rc_status - ;; - force-reload) - echo -n "Reload service Hyper-V KVP daemon " - $0 try-restart - rc_status - ;; - reload) - rc_failed 3 - rc_status -v - ;; - status) - echo -n "Checking for service Hyper-V KVP daemon " - checkproc $HV_KVP_BIN - rc_status -v - ;; - *) - echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}" - exit 1 - ;; -esac -rc_exit diff --git a/hyper-v.init.vss.sh b/hyper-v.init.vss.sh deleted file mode 100644 index a714976..0000000 --- a/hyper-v.init.vss.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/sh -# -# LSB compatible service control script; see http://www.linuxbase.org/spec/ -# -### BEGIN INIT INFO -# Provides: hv_vss_daemon -# Required-Start: $null -# Should-Start: $syslog $remote_fs $time -# Required-Stop: $null -# Should-Stop: $syslog $remote_fs $time -# Default-Start: 3 5 -# Default-Stop: 0 1 2 6 -# Short-Description: hv_vss_daemon assists with host initiated backup -# Description: Start hv_vss_daemon to allow the host to snapshot this guest -### END INIT INFO - -# Check for missing binaries (stale symlinks should not happen) -# Note: Special treatment of stop for LSB conformance -HV_VSS_BIN=/usr/sbin/hv_vss_daemon -test -x $HV_VSS_BIN || { echo "$HV_VSS_BIN not installed"; - if [ "$1" = "stop" ]; then exit 0; - else exit 5; fi; } - -. /etc/rc.status - -# Reset status of this service -rc_reset - -case "$1" in - start) - echo -n "Starting Hyper-V VSS daemon " - env PATH=/usr/lib/hyper-v/bin:$PATH \ - startproc $HV_VSS_BIN - rc_status -v - ;; - stop) - echo -n "Shutting down Hyper-V VSS daemon " - killproc -TERM $HV_VSS_BIN - rc_status -v - ;; - try-restart|condrestart) - if test "$1" = "condrestart"; then - echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" - fi - $0 status - if test $? = 0; then - $0 restart - else - rc_reset # Not running is not a failure. - fi - # Remember status and be quiet - rc_status - ;; - restart) - ## Stop the service and regardless of whether it was - ## running or not, start it again. - $0 stop - $0 start - - # Remember status and be quiet - rc_status - ;; - force-reload) - echo -n "Reload service Hyper-V VSS daemon " - $0 try-restart - rc_status - ;; - reload) - rc_failed 3 - rc_status -v - ;; - status) - echo -n "Checking for service Hyper-V VSS daemon " - checkproc $HV_VSS_BIN - rc_status -v - ;; - *) - echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}" - exit 1 - ;; -esac -rc_exit diff --git a/hyper-v.spec b/hyper-v.spec index a9bc016..a4d849d 100644 --- a/hyper-v.spec +++ b/hyper-v.spec @@ -23,19 +23,8 @@ Name: hyper-v ExclusiveArch: %ix86 x86_64 aarch64 -# systemd for post 13.1 releases -%if 0%{?suse_version} > 1310 -%define use_systemd 1 -%else -%define use_systemd 0 -%endif -%if %{use_systemd} %{?systemd_requires} BuildRequires: pkgconfig(systemd) -%else -PreReq: %insserv_prereq -Requires(pre): coreutils -%endif # Due to usage of char device instead of netlink Conflicts: kernel < 4.2 Summary: Microsoft Hyper-V tools @@ -52,11 +41,8 @@ Source5: hyper-v.kvptest.ps1.txt Source7: hyper-v.compare-with-upstream.sh Source9: hyper-v.include.linux.hyperv.h Source10: hyper-v.tools.hv.hv_kvp_daemon.c -Source11: hyper-v.init.sh Source12: hyper-v.tools.hv.hv_vss_daemon.c -Source13: hyper-v.init.vss.sh Source14: hyper-v.tools.hv.hv_fcopy_daemon.c -Source15: hyper-v.init.fcopy.sh Source20: hyper-v.tools.hv.hv_get_dhcp_info.sh Source21: hyper-v.tools.hv.hv_get_dns_info.sh Source22: hyper-v.tools.hv.hv_set_ifconfig.sh @@ -115,12 +101,8 @@ gcc \ -o %{hv_fcopy_daemon} %install -%if %{use_systemd} # It is not a callable app anyway, so move it out of the way bindir=%{helper_dir}/bin -%else -bindir=%{_sbindir} -%endif mkdir -p $RPM_BUILD_ROOT${bindir} mkdir -p $RPM_BUILD_ROOT%{_sbindir} mkdir -p $RPM_BUILD_ROOT%{helper_dir}/bin @@ -141,7 +123,6 @@ cp -avL %{S:20} $RPM_BUILD_ROOT%{helper_dir}/bin/hv_get_dhcp_info cp -avL %{S:21} $RPM_BUILD_ROOT%{helper_dir}/bin/hv_get_dns_info cp -avL %{S:22} $RPM_BUILD_ROOT%{helper_dir}/bin/hv_set_ifconfig chmod 755 $RPM_BUILD_ROOT%{helper_dir}/bin/* -%if %{use_systemd} d=$RPM_BUILD_ROOT%{_unitdir} mkdir -vp ${d} # @@ -236,25 +217,12 @@ fi EOF chmod 755 $RPM_BUILD_ROOT${bindir}/${helper} # -%else -mkdir -p $RPM_BUILD_ROOT/etc/init.d -install -m755 %{S:11} $RPM_BUILD_ROOT/etc/init.d/%{hv_kvp_daemon} -ln -sfvbn ../../etc/init.d/%{hv_kvp_daemon} $RPM_BUILD_ROOT${bindir}/rc%{hv_kvp_daemon} -install -m755 %{S:13} $RPM_BUILD_ROOT/etc/init.d/%{hv_vss_daemon} -ln -sfvbn ../../etc/init.d/%{hv_vss_daemon} $RPM_BUILD_ROOT${bindir}/rc%{hv_vss_daemon} -install -m755 %{S:15} $RPM_BUILD_ROOT/etc/init.d/%{hv_fcopy_daemon} -ln -sfvbn ../../etc/init.d/%{hv_fcopy_daemon} $RPM_BUILD_ROOT${bindir}/rc%{hv_fcopy_daemon} -%endif %files %doc kvptest.ps1.txt -%if %{use_systemd} %{_unitdir} %dir /usr/lib/udev %{_udevrulesdir} -%else -/etc/init.d/* -%endif %{_sbindir}/* %{helper_dir} @@ -277,9 +245,7 @@ then fi rmdir -v /var/opt/hyperv || : fi -%if %{use_systemd} : nothing to do in case of systemd -%endif %post board_vendor= @@ -298,33 +264,14 @@ then fi if test "${board_vendor}" = "Microsoft Corporation" -a "${product_name}" = "Virtual Machine" then -%if %{use_systemd} : nothing to do in case of systemd -%else - echo "Enabling %{hv_kvp_daemon} on '${product_name}' from '${board_vendor}'" - %{insserv_force_if_yast %{hv_kvp_daemon}} - echo "Enabling %{hv_vss_daemon} on '${product_name}' from '${board_vendor}'" - %{insserv_force_if_yast %{hv_vss_daemon}} - echo "Enabling %{hv_fcopy_daemon} on '${product_name}' from '${board_vendor}'" - %{insserv_force_if_yast %{hv_fcopy_daemon}} -%endif fi %preun -%if %{use_systemd} : nothing to do in case of systemd -%else -%stop_on_removal %{hv_kvp_daemon} -%stop_on_removal %{hv_vss_daemon} -%stop_on_removal %{hv_fcopy_daemon} -%endif %postun # no restart on update because the daemon can not be restarted -%if %{use_systemd} : nothing to do in case of systemd -%else -%insserv_cleanup -%endif %changelog From db47c6ea84cb83a42e1adf885fd6bda73f7ee9a5d0a300dc28a37c81494a7553 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Thu, 23 Jul 2020 18:24:26 +0000 Subject: [PATCH 8/8] bumb version OBS-URL: https://build.opensuse.org/package/show/Virtualization/hyper-v?expand=0&rev=151 --- hyper-v.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hyper-v.spec b/hyper-v.spec index a4d849d..fe8040d 100644 --- a/hyper-v.spec +++ b/hyper-v.spec @@ -34,7 +34,7 @@ Supplements: modalias(dmi:*svnMicrosoftCorporation*pnVirtualMachine*rnVirtual Supplements: modalias(pci:v00001414d00005353sv*sd*bc*sc*i*) Url: http://www.kernel.org # Arbitrary version number -Version: 7 +Version: 8 Release: 0 Source0: hyper-v.lsvmbus.py Source5: hyper-v.kvptest.ps1.txt