Compare commits
No commits in common. "c8" and "c9s" have entirely different histories.
9
.gitignore
vendored
9
.gitignore
vendored
@ -0,0 +1,9 @@
|
||||
/hv_get_dhcp_info.sh
|
||||
/hv_get_dns_info.sh
|
||||
/hv_kvp_daemon.c
|
||||
/hv_set_ifconfig.sh
|
||||
/hv_vss_daemon.c
|
||||
/COPYING
|
||||
/hv_fcopy_daemon.c
|
||||
/lsvmbus
|
||||
/bondvf.sh
|
24
0002-Do-not-set-NM_CONTROLLED-no.patch
Normal file
24
0002-Do-not-set-NM_CONTROLLED-no.patch
Normal file
@ -0,0 +1,24 @@
|
||||
From 88be69d62a01b9ac233de7f68118c948623c6f0a Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
Date: Thu, 14 Nov 2019 09:45:44 +0100
|
||||
Subject: Do not set NM_CONTROLLED=no
|
||||
|
||||
---
|
||||
hv_set_ifconfig.sh | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/hv_set_ifconfig.sh b/hv_set_ifconfig.sh
|
||||
index 7ed9f85..18b27cc 100644
|
||||
--- a/hv_set_ifconfig.sh
|
||||
+++ b/hv_set_ifconfig.sh
|
||||
@@ -51,7 +51,6 @@
|
||||
|
||||
|
||||
echo "IPV6INIT=yes" >> $1
|
||||
-echo "NM_CONTROLLED=no" >> $1
|
||||
echo "PEERDNS=yes" >> $1
|
||||
echo "ONBOOT=yes" >> $1
|
||||
|
||||
--
|
||||
2.27.0
|
||||
|
345
0004-Update-C-files-and-scripts-to-kernel-version-5.7-rc1.patch
Normal file
345
0004-Update-C-files-and-scripts-to-kernel-version-5.7-rc1.patch
Normal file
@ -0,0 +1,345 @@
|
||||
From f20c2a3298ceae7536c06bd08a5c571ebfa8cce4 Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
Date: Thu, 6 May 2021 12:50:43 +0200
|
||||
Subject: Update C files and scripts to kernel version 5.7-rc1
|
||||
|
||||
(cherry-picked from RHEL 8.4.0 commit b0a20fac0e74b0b3eecc20ffe74006e7877da352)
|
||||
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
---
|
||||
hv_fcopy_daemon.c | 37 +++++++++++++++++++++++++++++++-----
|
||||
hv_get_dhcp_info.sh | 2 +-
|
||||
hv_kvp_daemon.c | 35 ++++++++++++++++++++--------------
|
||||
hv_set_ifconfig.sh | 2 +-
|
||||
hv_vss_daemon.c | 46 ++++++++++++++++++++++++++++++++++-----------
|
||||
5 files changed, 90 insertions(+), 32 deletions(-)
|
||||
|
||||
diff --git a/hv_fcopy_daemon.c b/hv_fcopy_daemon.c
|
||||
index aea2d91..16d629b 100644
|
||||
--- a/hv_fcopy_daemon.c
|
||||
+++ b/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/hv_get_dhcp_info.sh b/hv_get_dhcp_info.sh
|
||||
index c38686c..2f2a3c7 100644
|
||||
--- a/hv_get_dhcp_info.sh
|
||||
+++ b/hv_get_dhcp_info.sh
|
||||
@@ -13,7 +13,7 @@
|
||||
# the script prints the string "Disabled" to stdout.
|
||||
#
|
||||
# Each Distro is expected to implement this script in a distro specific
|
||||
-# fashion. For instance on Distros that ship with Network Manager enabled,
|
||||
+# fashion. For instance, on Distros that ship with Network Manager enabled,
|
||||
# this script can be based on the Network Manager APIs for retrieving DHCP
|
||||
# information.
|
||||
|
||||
diff --git a/hv_kvp_daemon.c b/hv_kvp_daemon.c
|
||||
index e9ef4ca..0e5f14a 100644
|
||||
--- a/hv_kvp_daemon.c
|
||||
+++ b/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 = "";
|
||||
@@ -1360,7 +1360,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;
|
||||
@@ -1400,14 +1400,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.
|
||||
*/
|
||||
@@ -1423,6 +1415,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,8 +1461,7 @@ int main(int argc, char *argv[])
|
||||
syslog(LOG_ERR, "read failed; error:%d %s",
|
||||
errno, strerror(errno));
|
||||
|
||||
- close(kvp_fd);
|
||||
- return EXIT_FAILURE;
|
||||
+ goto reopen_kvp_fd;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1617,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/hv_set_ifconfig.sh b/hv_set_ifconfig.sh
|
||||
index 18b27cc..3dd064c 100644
|
||||
--- a/hv_set_ifconfig.sh
|
||||
+++ b/hv_set_ifconfig.sh
|
||||
@@ -12,7 +12,7 @@
|
||||
# be used to configure the interface.
|
||||
#
|
||||
# Each Distro is expected to implement this script in a distro specific
|
||||
-# fashion. For instance on Distros that ship with Network Manager enabled,
|
||||
+# fashion. For instance, on Distros that ship with Network Manager enabled,
|
||||
# this script can be based on the Network Manager APIs for configuring the
|
||||
# interface.
|
||||
#
|
||||
diff --git a/hv_vss_daemon.c b/hv_vss_daemon.c
|
||||
index 92902a8..29a1e48 100644
|
||||
--- a/hv_vss_daemon.c
|
||||
+++ b/hv_vss_daemon.c
|
||||
@@ -28,6 +28,8 @@
|
||||
#include <stdbool.h>
|
||||
#include <dirent.h>
|
||||
|
||||
+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,16 +157,22 @@ 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;
|
||||
+ }
|
||||
}
|
||||
|
||||
goto out;
|
||||
@@ -175,6 +183,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 +205,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 +241,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",
|
||||
@@ -247,8 +268,7 @@ int main(int argc, char *argv[])
|
||||
if (len < 0) {
|
||||
syslog(LOG_ERR, "registration to kernel failed; error: %d %s",
|
||||
errno, strerror(errno));
|
||||
- close(vss_fd);
|
||||
- exit(EXIT_FAILURE);
|
||||
+ goto reopen_vss_fd;
|
||||
}
|
||||
|
||||
pfd.fd = vss_fd;
|
||||
@@ -312,14 +332,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;
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.27.0
|
||||
|
@ -1,29 +1,16 @@
|
||||
From d8ca5e0a429b8f7395e136e713980db6a7ac8dc2 Mon Sep 17 00:00:00 2001
|
||||
From: Mohammed Gamal <mgamal@redhat.com>
|
||||
Date: Wed, 15 Apr 2020 12:00:30 +0200
|
||||
Subject: [PATCH 2/2] Add vmbus_testing tool build files
|
||||
|
||||
RH-Author: Mohammed Gamal <mgamal@redhat.com>
|
||||
Message-id: <20200414183955.194006-3-mgamal@redhat.com>
|
||||
Patchwork-id: 94690
|
||||
O-Subject: [RHEL8.3 virt hyperv-daemons PATCH v5 2/2] Add vmbus_testing tool build files
|
||||
Bugzilla: 1816750
|
||||
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
RH-Acked-by: Cathy Avery <cavery@redhat.com>
|
||||
From a13aa83d1b5bb4b6ce4396aef3457b48695b7c41 Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
Date: Thu, 6 May 2021 12:53:31 +0200
|
||||
Subject: Add vmbus_testing tool build files
|
||||
|
||||
Add the vmbus_testing tool to redhat build dirs
|
||||
|
||||
(cherry-pick from rhel 8.4.0 commit d8ca5e0)
|
||||
Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
|
||||
---
|
||||
redhat/hyperv-daemons.spec.template | 2 +
|
||||
vmbus_testing | 376 ++++++++++++++++++++++++++++
|
||||
2 files changed, 378 insertions(+)
|
||||
create mode 100755 vmbus_testing
|
||||
|
||||
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
---
|
||||
redhat/hyperv-daemons.spec.template | 2 +
|
||||
vmbus_testing | 376 ++++++++++++++++++++++++++++++++++++
|
||||
.distro/hyperv-daemons.spec.template | 2 +
|
||||
vmbus_testing | 376 +++++++++++++++++++++++++++
|
||||
2 files changed, 378 insertions(+)
|
||||
create mode 100755 vmbus_testing
|
||||
|
||||
@ -410,5 +397,5 @@ index 0000000..e721290
|
||||
+if __name__ == "__main__":
|
||||
+ main()
|
||||
--
|
||||
1.8.3.1
|
||||
2.27.0
|
||||
|
@ -1,12 +1,7 @@
|
||||
From e956573e4fd5e489fd68a7d46f0aa715ee19084e Mon Sep 17 00:00:00 2001
|
||||
From: Mohammed Gamal <mgamal@redhat.com>
|
||||
Date: Wed, 25 Nov 2020 15:23:29 +0100
|
||||
Subject: [PATCH] tools: hv: change http to https in hv_kvp_daemon.c
|
||||
|
||||
RH-Author: Mohammed Gamal Morsy (mmorsy)
|
||||
RH-MergeRequest: 1: RHEL 8.4.0 updates
|
||||
RH-Commit: [1/1] b7202f11 (mmorsy/hyperv-daemons)
|
||||
RH-Bugzilla: 1886104
|
||||
From 6ed9946f9a4f1a01846add2279e8d0640c1c2f1c Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
Date: Thu, 6 May 2021 12:53:58 +0200
|
||||
Subject: tools: hv: change http to https in hv_kvp_daemon.c
|
||||
|
||||
The patch has no functional change. Only changes the URL pointed to
|
||||
in one of the comments
|
||||
@ -37,12 +32,14 @@ Date: Sun Jul 5 23:44:57 2020 +0200
|
||||
Signed-off-by: Wei Liu <wei.liu@kernel.org>
|
||||
|
||||
Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
|
||||
(cherry-picked from rhel 8.4.0 commit e956573)
|
||||
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
---
|
||||
hv_kvp_daemon.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hv_kvp_daemon.c b/hv_kvp_daemon.c
|
||||
index ee9c1bb..1e6fd6c 100644
|
||||
index 0e5f14a..c06c94d 100644
|
||||
--- a/hv_kvp_daemon.c
|
||||
+++ b/hv_kvp_daemon.c
|
||||
@@ -437,7 +437,7 @@ void kvp_get_os_info(void)
|
||||
@ -55,5 +52,5 @@ index ee9c1bb..1e6fd6c 100644
|
||||
file = fopen("/etc/os-release", "r");
|
||||
if (file != NULL) {
|
||||
--
|
||||
2.18.4
|
||||
2.27.0
|
||||
|
18
README.rst
Normal file
18
README.rst
Normal file
@ -0,0 +1,18 @@
|
||||
===================
|
||||
hyperv-daemons development
|
||||
===================
|
||||
|
||||
hyperv-daemons is maintained in a `source tree`_ rather than directly in dist-git
|
||||
using packit service that provides way to develope using regular source code
|
||||
structure and provides way to generate SRPM and build using koji service.
|
||||
|
||||
Developers deliver all changes to sourc-git using merge request. Only maintainers
|
||||
will be pushing changes sent to source-git to dist-git.
|
||||
|
||||
Each release in dist-git is tagged in the source repository so you can easily
|
||||
check out the source tree for a build. The tags are in the format
|
||||
name-version-release, but note release doesn't contain the dist tag since the
|
||||
source can be built in different build roots (Fedora, CentOS, etc.)
|
||||
|
||||
.. _source tree: https://gitlab.com/redhat/centos-stream/src/hyperv-daemons
|
||||
|
@ -1,48 +0,0 @@
|
||||
From 1e2d32c6ee12b45823ba3cda0054a4bd843896fc Mon Sep 17 00:00:00 2001
|
||||
From: Olaf Hering <olaf@aepfle.de>
|
||||
Date: Tue, 5 Jun 2018 13:37:55 -0700
|
||||
Subject: [PATCH] tools: hv: update lsvmbus to be compatible with python3
|
||||
|
||||
Python3 changed the way how 'print' works.
|
||||
Adjust the code to a syntax that is understood by python2 and python3.
|
||||
|
||||
Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
||||
Acked-by: Dexuan Cui <decui@microsoft.com>
|
||||
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
|
||||
---
|
||||
tools/hv/lsvmbus | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/tools/hv/lsvmbus b/tools/hv/lsvmbus
|
||||
index 353e56768df8..55e7374bade0 100644
|
||||
--- a/tools/hv/lsvmbus
|
||||
+++ b/tools/hv/lsvmbus
|
||||
@@ -17,7 +17,7 @@ if options.verbose is not None:
|
||||
|
||||
vmbus_sys_path = '/sys/bus/vmbus/devices'
|
||||
if not os.path.isdir(vmbus_sys_path):
|
||||
- print "%s doesn't exist: exiting..." % vmbus_sys_path
|
||||
+ print("%s doesn't exist: exiting..." % vmbus_sys_path)
|
||||
exit(-1)
|
||||
|
||||
vmbus_dev_dict = {
|
||||
@@ -93,11 +93,11 @@ format2 = '%2s: Class_ID = %s - %s\n\tDevice_ID = %s\n\tSysfs path: %s\n%s'
|
||||
|
||||
for d in vmbus_dev_list:
|
||||
if verbose == 0:
|
||||
- print ('VMBUS ID ' + format0) % (d.vmbus_id, d.dev_desc)
|
||||
+ print(('VMBUS ID ' + format0) % (d.vmbus_id, d.dev_desc))
|
||||
elif verbose == 1:
|
||||
- print ('VMBUS ID ' + format1) % \
|
||||
- (d.vmbus_id, d.class_id, d.dev_desc, d.chn_vp_mapping)
|
||||
+ print (('VMBUS ID ' + format1) % \
|
||||
+ (d.vmbus_id, d.class_id, d.dev_desc, d.chn_vp_mapping))
|
||||
else:
|
||||
- print ('VMBUS ID ' + format2) % \
|
||||
+ print (('VMBUS ID ' + format2) % \
|
||||
(d.vmbus_id, d.class_id, d.dev_desc, \
|
||||
- d.device_id, d.sysfs_path, d.chn_vp_mapping)
|
||||
+ d.device_id, d.sysfs_path, d.chn_vp_mapping))
|
||||
--
|
||||
2.14.4
|
||||
|
@ -1,10 +0,0 @@
|
||||
--- hv_set_ifconfig.sh.orig 2018-06-11 15:57:50.000000000 +0200
|
||||
+++ hv_set_ifconfig.sh 2018-09-03 09:34:57.470114502 +0200
|
||||
@@ -51,7 +51,6 @@
|
||||
|
||||
|
||||
echo "IPV6INIT=yes" >> $1
|
||||
-echo "NM_CONTROLLED=no" >> $1
|
||||
echo "PEERDNS=yes" >> $1
|
||||
echo "ONBOOT=yes" >> $1
|
||||
|
356
SOURCES/COPYING
356
SOURCES/COPYING
@ -1,356 +0,0 @@
|
||||
|
||||
NOTE! This copyright does *not* cover user programs that use kernel
|
||||
services by normal system calls - this is merely considered normal use
|
||||
of the kernel, and does *not* fall under the heading of "derived work".
|
||||
Also note that the GPL below is copyrighted by the Free Software
|
||||
Foundation, but the instance of code that it refers to (the Linux
|
||||
kernel) is copyrighted by me and others who actually wrote it.
|
||||
|
||||
Also note that the only valid version of the GPL as far as the kernel
|
||||
is concerned is _this_ particular version of the license (ie v2, not
|
||||
v2.2 or v3.x or whatever), unless explicitly otherwise stated.
|
||||
|
||||
Linus Torvalds
|
||||
|
||||
----------------------------------------
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
@ -1,74 +0,0 @@
|
||||
From 2b218c6e29ff031862c0976deb9810dfb2d79ab2 Mon Sep 17 00:00:00 2001
|
||||
From: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
Date: Thu, 14 Nov 2019 12:21:46 +0100
|
||||
Subject: [PATCH] Set IgnoreOnIsolate=1 in systemd units
|
||||
|
||||
RH-Author: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
Message-id: <20191114122146.17009-1-vkuznets@redhat.com>
|
||||
Patchwork-id: 92251
|
||||
O-Subject: [RHEL8.2 hyperv-daemons PATCH] Set IgnoreOnIsolate=1 in systemd units
|
||||
Bugzilla: 1769920
|
||||
RH-Acked-by: Mohammed Gamal <mgamal@redhat.com>
|
||||
RH-Acked-by: Eduardo Otubo <otubo@redhat.com>
|
||||
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1769920
|
||||
Branch: rhel-8.2.0
|
||||
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=24699501
|
||||
Upstream: RHEL-only (upstream doesn't ship systemd units)
|
||||
|
||||
Hyper-V daemons' units are udev activated: when the appropriate device
|
||||
appears systemd unit is started and normal targets (e.g. multi-user.target)
|
||||
don't depend on these units. With systemd it is possible to try to isolate
|
||||
the target (somewhat similar to switching runlevel), this is supposed to
|
||||
shut everything which the target doesn't depend on (like units started
|
||||
manually) off. It seems that the general users' expectation is that
|
||||
hyperv-daemons units survive the procedure.
|
||||
|
||||
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
---
|
||||
hypervfcopyd.service | 1 +
|
||||
hypervkvpd.service | 1 +
|
||||
hypervvssd.service | 1 +
|
||||
3 files changed, 3 insertions(+)
|
||||
|
||||
diff --git a/hypervfcopyd.service b/hypervfcopyd.service
|
||||
index fa4a0a3..dd14a97 100644
|
||||
--- a/hypervfcopyd.service
|
||||
+++ b/hypervfcopyd.service
|
||||
@@ -1,6 +1,7 @@
|
||||
[Unit]
|
||||
Description=Hyper-V FCOPY daemon
|
||||
BindsTo=sys-devices-virtual-misc-vmbus\x21hv_fcopy.device
|
||||
+IgnoreOnIsolate=1
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/sbin/hypervfcopyd -n
|
||||
diff --git a/hypervkvpd.service b/hypervkvpd.service
|
||||
index d8bfdf3..36ee11c 100644
|
||||
--- a/hypervkvpd.service
|
||||
+++ b/hypervkvpd.service
|
||||
@@ -2,6 +2,7 @@
|
||||
Description=Hyper-V KVP daemon
|
||||
BindsTo=sys-devices-virtual-misc-vmbus\x21hv_kvp.device
|
||||
After=network.target
|
||||
+IgnoreOnIsolate=1
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
diff --git a/hypervvssd.service b/hypervvssd.service
|
||||
index 9751cb3..1e5ff43 100644
|
||||
--- a/hypervvssd.service
|
||||
+++ b/hypervvssd.service
|
||||
@@ -1,6 +1,7 @@
|
||||
[Unit]
|
||||
Description=Hyper-V VSS daemon
|
||||
BindsTo=sys-devices-virtual-misc-vmbus\x21hv_vss.device
|
||||
+IgnoreOnIsolate=1
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/sbin/hypervvssd -n
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -1,54 +0,0 @@
|
||||
From 33725de60efa5e867ed73d2404d316785d0e4bb5 Mon Sep 17 00:00:00 2001
|
||||
From: Mohammed Gamal <mgamal@redhat.com>
|
||||
Date: Wed, 20 Jul 2022 11:48:40 +0200
|
||||
Subject: [PATCH 1/2] hypervkvpd.service: ordering fixes
|
||||
|
||||
RH-Author: Mohamed Gamal Morsy <mmorsy@redhat.com>
|
||||
RH-MergeRequest: 3: hypervkvpd.service: ordering fixes
|
||||
RH-Commit: [1/2] f5bec088f7cf4afd641a2d7184a4e29cd1734bf4
|
||||
RH-Bugzilla: 2115761
|
||||
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
RH-Acked-by: Cathy Avery <cavery@redhat.com>
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2115761
|
||||
|
||||
From 8dcff588c8eb1ab3119c6b0acead03189814b955 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Patterson <cpatterson@microsoft.com>
|
||||
Date: Jul 01 2022 14:36:25 +0000
|
||||
Subject: hypervkvpd.service: ordering fixes
|
||||
|
||||
- Only start kvpd under Hyper-V.
|
||||
|
||||
- Minimize dependencies for kvpd by removing the unnecessary
|
||||
network.target requirement, but add kvp device and mount
|
||||
requirements.
|
||||
|
||||
Start before cloud-init-local.service which relies on kvpd
|
||||
for Azure.
|
||||
|
||||
Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
|
||||
|
||||
Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
|
||||
---
|
||||
hypervkvpd.service | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hypervkvpd.service b/hypervkvpd.service
|
||||
index 36ee11c..40dff13 100644
|
||||
--- a/hypervkvpd.service
|
||||
+++ b/hypervkvpd.service
|
||||
@@ -1,7 +1,10 @@
|
||||
[Unit]
|
||||
Description=Hyper-V KVP daemon
|
||||
+ConditionVirtualization=microsoft
|
||||
BindsTo=sys-devices-virtual-misc-vmbus\x21hv_kvp.device
|
||||
-After=network.target
|
||||
+After=sys-devices-virtual-misc-vmbus\x21hv_kvp.device
|
||||
+RequiresMountsFor=/var/lib/hyperv
|
||||
+Before=cloud-init-local.service
|
||||
IgnoreOnIsolate=1
|
||||
|
||||
[Service]
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,49 +0,0 @@
|
||||
From 3eb64f25afdf65d9999d155d8c89327cf9d27036 Mon Sep 17 00:00:00 2001
|
||||
From: Mohammed Gamal <mgamal@redhat.com>
|
||||
Date: Mon, 15 Aug 2022 17:38:37 +0200
|
||||
Subject: [PATCH 2/2] redhat: Add ConditionalVirtualization to the rest of
|
||||
systemd units
|
||||
|
||||
RH-Author: Mohamed Gamal Morsy <mmorsy@redhat.com>
|
||||
RH-MergeRequest: 3: hypervkvpd.service: ordering fixes
|
||||
RH-Commit: [2/2] 6638ac3cfcff63e664d6ba86772a4bdfe45d2084
|
||||
RH-Bugzilla: 2115761
|
||||
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
RH-Acked-by: Cathy Avery <cavery@redhat.com>
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2115761
|
||||
|
||||
Add ConditionalVirtualization to the rest of systemd units to make sure
|
||||
they're started when running in Azure/Hyper-V.
|
||||
|
||||
Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
|
||||
---
|
||||
hypervfcopyd.service | 1 +
|
||||
hypervvssd.service | 1 +
|
||||
2 files changed, 2 insertions(+)
|
||||
|
||||
diff --git a/hypervfcopyd.service b/hypervfcopyd.service
|
||||
index dd14a97..aab4b6b 100644
|
||||
--- a/hypervfcopyd.service
|
||||
+++ b/hypervfcopyd.service
|
||||
@@ -1,5 +1,6 @@
|
||||
[Unit]
|
||||
Description=Hyper-V FCOPY daemon
|
||||
+ConditionVirtualization=microsoft
|
||||
BindsTo=sys-devices-virtual-misc-vmbus\x21hv_fcopy.device
|
||||
IgnoreOnIsolate=1
|
||||
|
||||
diff --git a/hypervvssd.service b/hypervvssd.service
|
||||
index 1e5ff43..6a0fad0 100644
|
||||
--- a/hypervvssd.service
|
||||
+++ b/hypervvssd.service
|
||||
@@ -1,5 +1,6 @@
|
||||
[Unit]
|
||||
Description=Hyper-V VSS daemon
|
||||
+ConditionVirtualization=microsoft
|
||||
BindsTo=sys-devices-virtual-misc-vmbus\x21hv_vss.device
|
||||
IgnoreOnIsolate=1
|
||||
|
||||
--
|
||||
2.31.1
|
||||
|
@ -1,247 +0,0 @@
|
||||
/*
|
||||
* An implementation of host to guest copy functionality for Linux.
|
||||
*
|
||||
* Copyright (C) 2014, Microsoft, Inc.
|
||||
*
|
||||
* Author : K. Y. Srinivasan <kys@microsoft.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 as published
|
||||
* by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
|
||||
* NON INFRINGEMENT. See the GNU General Public License for more
|
||||
* details.
|
||||
*/
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <linux/hyperv.h>
|
||||
#include <linux/limits.h>
|
||||
#include <syslog.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <getopt.h>
|
||||
|
||||
static int target_fd;
|
||||
static char target_fname[PATH_MAX];
|
||||
static unsigned long long filesize;
|
||||
|
||||
static int hv_start_fcopy(struct hv_start_fcopy *smsg)
|
||||
{
|
||||
int error = HV_E_FAIL;
|
||||
char *q, *p;
|
||||
|
||||
filesize = 0;
|
||||
p = (char *)smsg->path_name;
|
||||
snprintf(target_fname, sizeof(target_fname), "%s/%s",
|
||||
(char *)smsg->path_name, (char *)smsg->file_name);
|
||||
|
||||
syslog(LOG_INFO, "Target file name: %s", target_fname);
|
||||
/*
|
||||
* Check to see if the path is already in place; if not,
|
||||
* create if required.
|
||||
*/
|
||||
while ((q = strchr(p, '/')) != NULL) {
|
||||
if (q == p) {
|
||||
p++;
|
||||
continue;
|
||||
}
|
||||
*q = '\0';
|
||||
if (access((char *)smsg->path_name, F_OK)) {
|
||||
if (smsg->copy_flags & CREATE_PATH) {
|
||||
if (mkdir((char *)smsg->path_name, 0755)) {
|
||||
syslog(LOG_ERR, "Failed to create %s",
|
||||
(char *)smsg->path_name);
|
||||
goto done;
|
||||
}
|
||||
} else {
|
||||
syslog(LOG_ERR, "Invalid path: %s",
|
||||
(char *)smsg->path_name);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
p = q + 1;
|
||||
*q = '/';
|
||||
}
|
||||
|
||||
if (!access(target_fname, F_OK)) {
|
||||
syslog(LOG_INFO, "File: %s exists", target_fname);
|
||||
if (!(smsg->copy_flags & OVER_WRITE)) {
|
||||
error = HV_ERROR_ALREADY_EXISTS;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
target_fd = open(target_fname,
|
||||
O_RDWR | O_CREAT | O_TRUNC | O_CLOEXEC, 0744);
|
||||
if (target_fd == -1) {
|
||||
syslog(LOG_INFO, "Open Failed: %s", strerror(errno));
|
||||
goto done;
|
||||
}
|
||||
|
||||
error = 0;
|
||||
done:
|
||||
return error;
|
||||
}
|
||||
|
||||
static int hv_copy_data(struct hv_do_fcopy *cpmsg)
|
||||
{
|
||||
ssize_t bytes_written;
|
||||
int ret = 0;
|
||||
|
||||
bytes_written = pwrite(target_fd, cpmsg->data, cpmsg->size,
|
||||
cpmsg->offset);
|
||||
|
||||
filesize += cpmsg->size;
|
||||
if (bytes_written != cpmsg->size) {
|
||||
switch (errno) {
|
||||
case ENOSPC:
|
||||
ret = HV_ERROR_DISK_FULL;
|
||||
break;
|
||||
default:
|
||||
ret = HV_E_FAIL;
|
||||
break;
|
||||
}
|
||||
syslog(LOG_ERR, "pwrite failed to write %llu bytes: %ld (%s)",
|
||||
filesize, (long)bytes_written, strerror(errno));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int hv_copy_finished(void)
|
||||
{
|
||||
close(target_fd);
|
||||
return 0;
|
||||
}
|
||||
static int hv_copy_cancel(void)
|
||||
{
|
||||
close(target_fd);
|
||||
unlink(target_fname);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
void print_usage(char *argv[])
|
||||
{
|
||||
fprintf(stderr, "Usage: %s [options]\n"
|
||||
"Options are:\n"
|
||||
" -n, --no-daemon stay in foreground, don't daemonize\n"
|
||||
" -h, --help print this help\n", argv[0]);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int fcopy_fd;
|
||||
int error;
|
||||
int daemonize = 1, long_index = 0, opt;
|
||||
int version = FCOPY_CURRENT_VERSION;
|
||||
union {
|
||||
struct hv_fcopy_hdr hdr;
|
||||
struct hv_start_fcopy start;
|
||||
struct hv_do_fcopy copy;
|
||||
__u32 kernel_modver;
|
||||
} buffer = { };
|
||||
int in_handshake = 1;
|
||||
|
||||
static struct option long_options[] = {
|
||||
{"help", no_argument, 0, 'h' },
|
||||
{"no-daemon", no_argument, 0, 'n' },
|
||||
{0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
while ((opt = getopt_long(argc, argv, "hn", long_options,
|
||||
&long_index)) != -1) {
|
||||
switch (opt) {
|
||||
case 'n':
|
||||
daemonize = 0;
|
||||
break;
|
||||
case 'h':
|
||||
default:
|
||||
print_usage(argv);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
if (daemonize && daemon(1, 0)) {
|
||||
syslog(LOG_ERR, "daemon() failed; error: %s", strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
openlog("HV_FCOPY", 0, LOG_USER);
|
||||
syslog(LOG_INFO, "starting; pid is:%d", getpid());
|
||||
|
||||
fcopy_fd = open("/dev/vmbus/hv_fcopy", O_RDWR);
|
||||
|
||||
if (fcopy_fd < 0) {
|
||||
syslog(LOG_ERR, "open /dev/vmbus/hv_fcopy failed; error: %d %s",
|
||||
errno, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Register with the kernel.
|
||||
*/
|
||||
if ((write(fcopy_fd, &version, sizeof(int))) != sizeof(int)) {
|
||||
syslog(LOG_ERR, "Registration failed: %s", strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
while (1) {
|
||||
/*
|
||||
* In this loop we process fcopy messages after the
|
||||
* handshake is complete.
|
||||
*/
|
||||
ssize_t len;
|
||||
|
||||
len = pread(fcopy_fd, &buffer, sizeof(buffer), 0);
|
||||
if (len < 0) {
|
||||
syslog(LOG_ERR, "pread failed: %s", strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (in_handshake) {
|
||||
if (len != sizeof(buffer.kernel_modver)) {
|
||||
syslog(LOG_ERR, "invalid version negotiation");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
in_handshake = 0;
|
||||
syslog(LOG_INFO, "kernel module version: %u",
|
||||
buffer.kernel_modver);
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (buffer.hdr.operation) {
|
||||
case START_FILE_COPY:
|
||||
error = hv_start_fcopy(&buffer.start);
|
||||
break;
|
||||
case WRITE_TO_FILE:
|
||||
error = hv_copy_data(&buffer.copy);
|
||||
break;
|
||||
case COMPLETE_FCOPY:
|
||||
error = hv_copy_finished();
|
||||
break;
|
||||
case CANCEL_FCOPY:
|
||||
error = hv_copy_cancel();
|
||||
break;
|
||||
|
||||
default:
|
||||
syslog(LOG_ERR, "Unknown operation: %d",
|
||||
buffer.hdr.operation);
|
||||
|
||||
}
|
||||
|
||||
if (pwrite(fcopy_fd, &error, sizeof(int), 0) != sizeof(int)) {
|
||||
syslog(LOG_ERR, "pwrite failed: %s", strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
#!/bin/bash
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
# This example script retrieves the DHCP state of a given interface.
|
||||
# In the interest of keeping the KVP daemon code free of distro specific
|
||||
# information; the kvp daemon code invokes this external script to gather
|
||||
# DHCP setting for the specific interface.
|
||||
#
|
||||
# Input: Name of the interface
|
||||
#
|
||||
# Output: The script prints the string "Enabled" to stdout to indicate
|
||||
# that DHCP is enabled on the interface. If DHCP is not enabled,
|
||||
# the script prints the string "Disabled" to stdout.
|
||||
#
|
||||
# Each Distro is expected to implement this script in a distro specific
|
||||
# fashion. For instance on Distros that ship with Network Manager enabled,
|
||||
# this script can be based on the Network Manager APIs for retrieving DHCP
|
||||
# information.
|
||||
|
||||
if_file="/etc/sysconfig/network-scripts/ifcfg-"$1
|
||||
|
||||
dhcp=$(grep "dhcp" $if_file 2>/dev/null)
|
||||
|
||||
if [ "$dhcp" != "" ];
|
||||
then
|
||||
echo "Enabled"
|
||||
else
|
||||
echo "Disabled"
|
||||
fi
|
@ -1,13 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This example script parses /etc/resolv.conf to retrive DNS information.
|
||||
# In the interest of keeping the KVP daemon code free of distro specific
|
||||
# information; the kvp daemon code invokes this external script to gather
|
||||
# DNS information.
|
||||
# This script is expected to print the nameserver values to stdout.
|
||||
# Each Distro is expected to implement this script in a distro specific
|
||||
# fashion. For instance on Distros that ship with Network Manager enabled,
|
||||
# this script can be based on the Network Manager APIs for retrieving DNS
|
||||
# entries.
|
||||
|
||||
cat /etc/resolv.conf 2>/dev/null | awk '/^nameserver/ { print $2 }'
|
File diff suppressed because it is too large
Load Diff
@ -1,65 +0,0 @@
|
||||
#!/bin/bash
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
# This example script activates an interface based on the specified
|
||||
# configuration.
|
||||
#
|
||||
# In the interest of keeping the KVP daemon code free of distro specific
|
||||
# information; the kvp daemon code invokes this external script to configure
|
||||
# the interface.
|
||||
#
|
||||
# The only argument to this script is the configuration file that is to
|
||||
# be used to configure the interface.
|
||||
#
|
||||
# Each Distro is expected to implement this script in a distro specific
|
||||
# fashion. For instance on Distros that ship with Network Manager enabled,
|
||||
# this script can be based on the Network Manager APIs for configuring the
|
||||
# interface.
|
||||
#
|
||||
# This example script is based on a RHEL environment.
|
||||
#
|
||||
# Here is the format of the ip configuration file:
|
||||
#
|
||||
# HWADDR=macaddr
|
||||
# DEVICE=interface name
|
||||
# BOOTPROTO=<protocol> (where <protocol> is "dhcp" if DHCP is configured
|
||||
# or "none" if no boot-time protocol should be used)
|
||||
#
|
||||
# IPADDR0=ipaddr1
|
||||
# IPADDR1=ipaddr2
|
||||
# IPADDRx=ipaddry (where y = x + 1)
|
||||
#
|
||||
# NETMASK0=netmask1
|
||||
# NETMASKx=netmasky (where y = x + 1)
|
||||
#
|
||||
# GATEWAY=ipaddr1
|
||||
# GATEWAYx=ipaddry (where y = x + 1)
|
||||
#
|
||||
# DNSx=ipaddrx (where first DNS address is tagged as DNS1 etc)
|
||||
#
|
||||
# IPV6 addresses will be tagged as IPV6ADDR, IPV6 gateway will be
|
||||
# tagged as IPV6_DEFAULTGW and IPV6 NETMASK will be tagged as
|
||||
# IPV6NETMASK.
|
||||
#
|
||||
# The host can specify multiple ipv4 and ipv6 addresses to be
|
||||
# configured for the interface. Furthermore, the configuration
|
||||
# needs to be persistent. A subsequent GET call on the interface
|
||||
# is expected to return the configuration that is set via the SET
|
||||
# call.
|
||||
#
|
||||
|
||||
|
||||
|
||||
echo "IPV6INIT=yes" >> $1
|
||||
echo "NM_CONTROLLED=no" >> $1
|
||||
echo "PEERDNS=yes" >> $1
|
||||
echo "ONBOOT=yes" >> $1
|
||||
|
||||
|
||||
cp $1 /etc/sysconfig/network-scripts/
|
||||
|
||||
|
||||
interface=$(echo $1 | awk -F - '{ print $2 }')
|
||||
|
||||
/sbin/ifdown $interface 2>/dev/null
|
||||
/sbin/ifup $interface 2>/dev/null
|
@ -1,280 +0,0 @@
|
||||
/*
|
||||
* An implementation of the host initiated guest snapshot for Hyper-V.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2013, Microsoft, Inc.
|
||||
* Author : K. Y. Srinivasan <kys@microsoft.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 as published
|
||||
* by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
|
||||
* NON INFRINGEMENT. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/poll.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sysmacros.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <mntent.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/major.h>
|
||||
#include <linux/hyperv.h>
|
||||
#include <syslog.h>
|
||||
#include <getopt.h>
|
||||
|
||||
/* Don't use syslog() in the function since that can cause write to disk */
|
||||
static int vss_do_freeze(char *dir, unsigned int cmd)
|
||||
{
|
||||
int ret, fd = open(dir, O_RDONLY);
|
||||
|
||||
if (fd < 0)
|
||||
return 1;
|
||||
|
||||
ret = ioctl(fd, cmd, 0);
|
||||
|
||||
/*
|
||||
* If a partition is mounted more than once, only the first
|
||||
* FREEZE/THAW can succeed and the later ones will get
|
||||
* EBUSY/EINVAL respectively: there could be 2 cases:
|
||||
* 1) a user may mount the same partition to differnt directories
|
||||
* by mistake or on purpose;
|
||||
* 2) The subvolume of btrfs appears to have the same partition
|
||||
* mounted more than once.
|
||||
*/
|
||||
if (ret) {
|
||||
if ((cmd == FIFREEZE && errno == EBUSY) ||
|
||||
(cmd == FITHAW && errno == EINVAL)) {
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
close(fd);
|
||||
return !!ret;
|
||||
}
|
||||
|
||||
static int vss_operate(int operation)
|
||||
{
|
||||
char match[] = "/dev/";
|
||||
FILE *mounts;
|
||||
struct mntent *ent;
|
||||
struct stat sb;
|
||||
char errdir[1024] = {0};
|
||||
unsigned int cmd;
|
||||
int error = 0, root_seen = 0, save_errno = 0;
|
||||
|
||||
switch (operation) {
|
||||
case VSS_OP_FREEZE:
|
||||
cmd = FIFREEZE;
|
||||
break;
|
||||
case VSS_OP_THAW:
|
||||
cmd = FITHAW;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
mounts = setmntent("/proc/mounts", "r");
|
||||
if (mounts == NULL)
|
||||
return -1;
|
||||
|
||||
while ((ent = getmntent(mounts))) {
|
||||
if (strncmp(ent->mnt_fsname, match, strlen(match)))
|
||||
continue;
|
||||
if (stat(ent->mnt_fsname, &sb) == -1)
|
||||
continue;
|
||||
if (S_ISBLK(sb.st_mode) && major(sb.st_rdev) == LOOP_MAJOR)
|
||||
continue;
|
||||
if (hasmntopt(ent, MNTOPT_RO) != NULL)
|
||||
continue;
|
||||
if (strcmp(ent->mnt_type, "vfat") == 0)
|
||||
continue;
|
||||
if (strcmp(ent->mnt_dir, "/") == 0) {
|
||||
root_seen = 1;
|
||||
continue;
|
||||
}
|
||||
error |= vss_do_freeze(ent->mnt_dir, cmd);
|
||||
if (error && operation == VSS_OP_FREEZE)
|
||||
goto err;
|
||||
}
|
||||
|
||||
endmntent(mounts);
|
||||
|
||||
if (root_seen) {
|
||||
error |= vss_do_freeze("/", cmd);
|
||||
if (error && operation == VSS_OP_FREEZE)
|
||||
goto err;
|
||||
}
|
||||
|
||||
goto out;
|
||||
err:
|
||||
save_errno = errno;
|
||||
if (ent) {
|
||||
strncpy(errdir, ent->mnt_dir, sizeof(errdir)-1);
|
||||
endmntent(mounts);
|
||||
}
|
||||
vss_operate(VSS_OP_THAW);
|
||||
/* Call syslog after we thaw all filesystems */
|
||||
if (ent)
|
||||
syslog(LOG_ERR, "FREEZE of %s failed; error:%d %s",
|
||||
errdir, save_errno, strerror(save_errno));
|
||||
else
|
||||
syslog(LOG_ERR, "FREEZE of / failed; error:%d %s", save_errno,
|
||||
strerror(save_errno));
|
||||
out:
|
||||
return error;
|
||||
}
|
||||
|
||||
void print_usage(char *argv[])
|
||||
{
|
||||
fprintf(stderr, "Usage: %s [options]\n"
|
||||
"Options are:\n"
|
||||
" -n, --no-daemon stay in foreground, don't daemonize\n"
|
||||
" -h, --help print this help\n", argv[0]);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int vss_fd, 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;
|
||||
__u32 kernel_modver;
|
||||
|
||||
static struct option long_options[] = {
|
||||
{"help", no_argument, 0, 'h' },
|
||||
{"no-daemon", no_argument, 0, 'n' },
|
||||
{0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
while ((opt = getopt_long(argc, argv, "hn", long_options,
|
||||
&long_index)) != -1) {
|
||||
switch (opt) {
|
||||
case 'n':
|
||||
daemonize = 0;
|
||||
break;
|
||||
case 'h':
|
||||
default:
|
||||
print_usage(argv);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
if (daemonize && daemon(1, 0))
|
||||
return 1;
|
||||
|
||||
openlog("Hyper-V VSS", 0, LOG_USER);
|
||||
syslog(LOG_INFO, "VSS starting; pid is:%d", getpid());
|
||||
|
||||
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",
|
||||
errno, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
/*
|
||||
* Register ourselves with the kernel.
|
||||
*/
|
||||
vss_msg->vss_hdr.operation = VSS_OP_REGISTER1;
|
||||
|
||||
len = write(vss_fd, vss_msg, sizeof(struct hv_vss_msg));
|
||||
if (len < 0) {
|
||||
syslog(LOG_ERR, "registration to kernel failed; error: %d %s",
|
||||
errno, strerror(errno));
|
||||
close(vss_fd);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
pfd.fd = vss_fd;
|
||||
|
||||
while (1) {
|
||||
pfd.events = POLLIN;
|
||||
pfd.revents = 0;
|
||||
|
||||
if (poll(&pfd, 1, -1) < 0) {
|
||||
syslog(LOG_ERR, "poll failed; error:%d %s", errno, strerror(errno));
|
||||
if (errno == EINVAL) {
|
||||
close(vss_fd);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
len = read(vss_fd, vss_msg, sizeof(struct hv_vss_msg));
|
||||
|
||||
if (in_handshake) {
|
||||
if (len != sizeof(kernel_modver)) {
|
||||
syslog(LOG_ERR, "invalid version negotiation");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
kernel_modver = *(__u32 *)vss_msg;
|
||||
in_handshake = 0;
|
||||
syslog(LOG_INFO, "VSS: kernel module version: %d",
|
||||
kernel_modver);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (len != sizeof(struct hv_vss_msg)) {
|
||||
syslog(LOG_ERR, "read failed; error:%d %s",
|
||||
errno, strerror(errno));
|
||||
close(vss_fd);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
op = vss_msg->vss_hdr.operation;
|
||||
error = HV_S_OK;
|
||||
|
||||
switch (op) {
|
||||
case VSS_OP_FREEZE:
|
||||
case VSS_OP_THAW:
|
||||
error = vss_operate(op);
|
||||
syslog(LOG_INFO, "VSS: op=%s: %s\n",
|
||||
op == VSS_OP_FREEZE ? "FREEZE" : "THAW",
|
||||
error ? "failed" : "succeeded");
|
||||
|
||||
if (error) {
|
||||
error = HV_E_FAIL;
|
||||
syslog(LOG_ERR, "op=%d failed!", op);
|
||||
syslog(LOG_ERR, "report it with these files:");
|
||||
syslog(LOG_ERR, "/etc/fstab and /proc/mounts");
|
||||
}
|
||||
break;
|
||||
case VSS_OP_HOT_BACKUP:
|
||||
syslog(LOG_INFO, "VSS: op=CHECK HOT BACKUP\n");
|
||||
break;
|
||||
default:
|
||||
syslog(LOG_ERR, "Illegal op:%d\n", op);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
close(vss_fd);
|
||||
exit(0);
|
||||
}
|
@ -1,685 +0,0 @@
|
||||
From b0a20fac0e74b0b3eecc20ffe74006e7877da352 Mon Sep 17 00:00:00 2001
|
||||
From: Mohammed Gamal <mgamal@redhat.com>
|
||||
Date: Wed, 15 Apr 2020 12:00:14 +0200
|
||||
Subject: [PATCH 1/2] Update C files and scripts to kernel version 5.7-rc1
|
||||
|
||||
RH-Author: Mohammed Gamal <mgamal@redhat.com>
|
||||
Message-id: <20200414183955.194006-2-mgamal@redhat.com>
|
||||
Patchwork-id: 94689
|
||||
O-Subject: [RHEL8.3 virt hyperv-daemons PATCH v5 1/2] Update C files and scripts to kernel version 5.7-rc1
|
||||
Bugzilla: 1816750
|
||||
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
RH-Acked-by: Cathy Avery <cavery@redhat.com>
|
||||
|
||||
Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
|
||||
---
|
||||
hv_fcopy_daemon.c | 38 ++++++++++++--
|
||||
hv_get_dhcp_info.sh | 2 +-
|
||||
hv_kvp_daemon.c | 63 ++++++++++++++---------
|
||||
hv_set_ifconfig.sh | 2 +-
|
||||
hv_vss_daemon.c | 118 ++++++++++++++++++++++++++++++++++++++------
|
||||
lsvmbus | 75 +++++++++++++++-------------
|
||||
6 files changed, 220 insertions(+), 78 deletions(-)
|
||||
|
||||
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
---
|
||||
hv_fcopy_daemon.c | 38 ++++++++++++++---
|
||||
hv_get_dhcp_info.sh | 2 +-
|
||||
hv_kvp_daemon.c | 63 ++++++++++++++++++----------
|
||||
hv_set_ifconfig.sh | 2 +-
|
||||
hv_vss_daemon.c | 118 +++++++++++++++++++++++++++++++++++++++++++++-------
|
||||
lsvmbus | 75 ++++++++++++++++++---------------
|
||||
6 files changed, 220 insertions(+), 78 deletions(-)
|
||||
|
||||
diff --git a/hv_fcopy_daemon.c b/hv_fcopy_daemon.c
|
||||
index d78aed8..f40ddaf 100644
|
||||
--- a/hv_fcopy_daemon.c
|
||||
+++ b/hv_fcopy_daemon.c
|
||||
@@ -89,6 +89,8 @@ static int hv_start_fcopy(struct hv_start_fcopy *smsg)
|
||||
|
||||
error = 0;
|
||||
done:
|
||||
+ if (error)
|
||||
+ target_fname[0] = '\0';
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -117,15 +119,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;
|
||||
|
||||
}
|
||||
@@ -140,7 +156,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;
|
||||
@@ -150,7 +166,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' },
|
||||
@@ -179,6 +195,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) {
|
||||
@@ -205,7 +227,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) {
|
||||
@@ -234,14 +256,20 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
|
||||
default:
|
||||
+ error = HV_E_FAIL;
|
||||
syslog(LOG_ERR, "Unknown operation: %d",
|
||||
buffer.hdr.operation);
|
||||
|
||||
}
|
||||
|
||||
+ /*
|
||||
+ * 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/hv_get_dhcp_info.sh b/hv_get_dhcp_info.sh
|
||||
index c38686c..2f2a3c7 100644
|
||||
--- a/hv_get_dhcp_info.sh
|
||||
+++ b/hv_get_dhcp_info.sh
|
||||
@@ -13,7 +13,7 @@
|
||||
# the script prints the string "Disabled" to stdout.
|
||||
#
|
||||
# Each Distro is expected to implement this script in a distro specific
|
||||
-# fashion. For instance on Distros that ship with Network Manager enabled,
|
||||
+# fashion. For instance, on Distros that ship with Network Manager enabled,
|
||||
# this script can be based on the Network Manager APIs for retrieving DHCP
|
||||
# information.
|
||||
|
||||
diff --git a/hv_kvp_daemon.c b/hv_kvp_daemon.c
|
||||
index dbf6e8b..ee9c1bb 100644
|
||||
--- a/hv_kvp_daemon.c
|
||||
+++ b/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 = "";
|
||||
@@ -286,7 +286,7 @@ static int kvp_key_delete(int pool, const __u8 *key, int key_size)
|
||||
* Found a match; just move the remaining
|
||||
* entries up.
|
||||
*/
|
||||
- if (i == num_records) {
|
||||
+ if (i == (num_records - 1)) {
|
||||
kvp_file_info[pool].num_records--;
|
||||
kvp_update_file(pool);
|
||||
return 0;
|
||||
@@ -700,7 +700,7 @@ static void kvp_get_ipconfig_info(char *if_name,
|
||||
|
||||
|
||||
/*
|
||||
- * Gather the DNS state.
|
||||
+ * Gather the DNS state.
|
||||
* Since there is no standard way to get this information
|
||||
* across various distributions of interest; we just invoke
|
||||
* an external script that needs to be ported across distros
|
||||
@@ -809,7 +809,7 @@ kvp_get_ip_info(int family, char *if_name, int op,
|
||||
int sn_offset = 0;
|
||||
int error = 0;
|
||||
char *buffer;
|
||||
- struct hv_kvp_ipaddr_value *ip_buffer;
|
||||
+ struct hv_kvp_ipaddr_value *ip_buffer = NULL;
|
||||
char cidr_mask[5]; /* /xyz */
|
||||
int weight;
|
||||
int i;
|
||||
@@ -1051,7 +1051,7 @@ static int parse_ip_val_buffer(char *in_buf, int *offset,
|
||||
char *start;
|
||||
|
||||
/*
|
||||
- * in_buf has sequence of characters that are seperated by
|
||||
+ * in_buf has sequence of characters that are separated by
|
||||
* the character ';'. The last sequence does not have the
|
||||
* terminating ";" character.
|
||||
*/
|
||||
@@ -1178,6 +1178,7 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
|
||||
FILE *file;
|
||||
char cmd[PATH_MAX];
|
||||
char *mac_addr;
|
||||
+ int str_len;
|
||||
|
||||
/*
|
||||
* Set the configuration for the specified interface with
|
||||
@@ -1301,8 +1302,18 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
|
||||
* invoke the external script to do its magic.
|
||||
*/
|
||||
|
||||
- snprintf(cmd, sizeof(cmd), KVP_SCRIPTS_PATH "%s %s",
|
||||
- "hv_set_ifconfig", if_file);
|
||||
+ str_len = snprintf(cmd, sizeof(cmd), KVP_SCRIPTS_PATH "%s %s",
|
||||
+ "hv_set_ifconfig", if_file);
|
||||
+ /*
|
||||
+ * This is a little overcautious, but it's necessary to suppress some
|
||||
+ * false warnings from gcc 8.0.1.
|
||||
+ */
|
||||
+ if (str_len <= 0 || (unsigned int)str_len >= sizeof(cmd)) {
|
||||
+ syslog(LOG_ERR, "Cmd '%s' (len=%d) may be too long",
|
||||
+ cmd, str_len);
|
||||
+ return HV_E_FAIL;
|
||||
+ }
|
||||
+
|
||||
if (system(cmd)) {
|
||||
syslog(LOG_ERR, "Failed to execute cmd '%s'; error: %d %s",
|
||||
cmd, errno, strerror(errno));
|
||||
@@ -1349,7 +1360,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;
|
||||
@@ -1375,6 +1386,8 @@ int main(int argc, char *argv[])
|
||||
daemonize = 0;
|
||||
break;
|
||||
case 'h':
|
||||
+ print_usage(argv);
|
||||
+ exit(0);
|
||||
default:
|
||||
print_usage(argv);
|
||||
exit(EXIT_FAILURE);
|
||||
@@ -1387,14 +1400,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.
|
||||
*/
|
||||
@@ -1410,6 +1415,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.
|
||||
*/
|
||||
@@ -1443,9 +1460,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;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1479,7 +1494,7 @@ int main(int argc, char *argv[])
|
||||
case KVP_OP_GET_IP_INFO:
|
||||
kvp_ip_val = &hv_msg->body.kvp_ip_val;
|
||||
|
||||
- error = kvp_mac_to_ip(kvp_ip_val);
|
||||
+ error = kvp_mac_to_ip(kvp_ip_val);
|
||||
|
||||
if (error)
|
||||
hv_msg->error = error;
|
||||
@@ -1604,13 +1619,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/hv_set_ifconfig.sh b/hv_set_ifconfig.sh
|
||||
index 18b27cc..3dd064c 100644
|
||||
--- a/hv_set_ifconfig.sh
|
||||
+++ b/hv_set_ifconfig.sh
|
||||
@@ -12,7 +12,7 @@
|
||||
# be used to configure the interface.
|
||||
#
|
||||
# Each Distro is expected to implement this script in a distro specific
|
||||
-# fashion. For instance on Distros that ship with Network Manager enabled,
|
||||
+# fashion. For instance, on Distros that ship with Network Manager enabled,
|
||||
# this script can be based on the Network Manager APIs for configuring the
|
||||
# interface.
|
||||
#
|
||||
diff --git a/hv_vss_daemon.c b/hv_vss_daemon.c
|
||||
index 34031a2..8fe0a5c 100644
|
||||
--- a/hv_vss_daemon.c
|
||||
+++ b/hv_vss_daemon.c
|
||||
@@ -36,6 +36,10 @@
|
||||
#include <linux/hyperv.h>
|
||||
#include <syslog.h>
|
||||
#include <getopt.h>
|
||||
+#include <stdbool.h>
|
||||
+#include <dirent.h>
|
||||
+
|
||||
+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)
|
||||
@@ -51,7 +55,7 @@ static int vss_do_freeze(char *dir, unsigned int cmd)
|
||||
* If a partition is mounted more than once, only the first
|
||||
* FREEZE/THAW can succeed and the later ones will get
|
||||
* EBUSY/EINVAL respectively: there could be 2 cases:
|
||||
- * 1) a user may mount the same partition to differnt directories
|
||||
+ * 1) a user may mount the same partition to different directories
|
||||
* by mistake or on purpose;
|
||||
* 2) The subvolume of btrfs appears to have the same partition
|
||||
* mounted more than once.
|
||||
@@ -68,6 +72,55 @@ static int vss_do_freeze(char *dir, unsigned int cmd)
|
||||
return !!ret;
|
||||
}
|
||||
|
||||
+static bool is_dev_loop(const char *blkname)
|
||||
+{
|
||||
+ char *buffer;
|
||||
+ DIR *dir;
|
||||
+ struct dirent *entry;
|
||||
+ bool ret = false;
|
||||
+
|
||||
+ buffer = malloc(PATH_MAX);
|
||||
+ if (!buffer) {
|
||||
+ syslog(LOG_ERR, "Can't allocate memory!");
|
||||
+ exit(1);
|
||||
+ }
|
||||
+
|
||||
+ snprintf(buffer, PATH_MAX, "%s/loop", blkname);
|
||||
+ if (!access(buffer, R_OK | X_OK)) {
|
||||
+ ret = true;
|
||||
+ goto free_buffer;
|
||||
+ } else if (errno != ENOENT) {
|
||||
+ syslog(LOG_ERR, "Can't access: %s; error:%d %s!",
|
||||
+ buffer, errno, strerror(errno));
|
||||
+ }
|
||||
+
|
||||
+ snprintf(buffer, PATH_MAX, "%s/slaves", blkname);
|
||||
+ dir = opendir(buffer);
|
||||
+ if (!dir) {
|
||||
+ if (errno != ENOENT)
|
||||
+ syslog(LOG_ERR, "Can't opendir: %s; error:%d %s!",
|
||||
+ buffer, errno, strerror(errno));
|
||||
+ goto free_buffer;
|
||||
+ }
|
||||
+
|
||||
+ while ((entry = readdir(dir)) != NULL) {
|
||||
+ if (strcmp(entry->d_name, ".") == 0 ||
|
||||
+ strcmp(entry->d_name, "..") == 0)
|
||||
+ continue;
|
||||
+
|
||||
+ snprintf(buffer, PATH_MAX, "%s/slaves/%s", blkname,
|
||||
+ entry->d_name);
|
||||
+ if (is_dev_loop(buffer)) {
|
||||
+ ret = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ closedir(dir);
|
||||
+free_buffer:
|
||||
+ free(buffer);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
static int vss_operate(int operation)
|
||||
{
|
||||
char match[] = "/dev/";
|
||||
@@ -75,6 +128,7 @@ static int vss_operate(int operation)
|
||||
struct mntent *ent;
|
||||
struct stat sb;
|
||||
char errdir[1024] = {0};
|
||||
+ char blkdir[23]; /* /sys/dev/block/XXX:XXX */
|
||||
unsigned int cmd;
|
||||
int error = 0, root_seen = 0, save_errno = 0;
|
||||
|
||||
@@ -96,10 +150,15 @@ static int vss_operate(int operation)
|
||||
while ((ent = getmntent(mounts))) {
|
||||
if (strncmp(ent->mnt_fsname, match, strlen(match)))
|
||||
continue;
|
||||
- if (stat(ent->mnt_fsname, &sb) == -1)
|
||||
- continue;
|
||||
- if (S_ISBLK(sb.st_mode) && major(sb.st_rdev) == LOOP_MAJOR)
|
||||
- continue;
|
||||
+ if (stat(ent->mnt_fsname, &sb)) {
|
||||
+ syslog(LOG_ERR, "Can't stat: %s; error:%d %s!",
|
||||
+ ent->mnt_fsname, errno, strerror(errno));
|
||||
+ } else {
|
||||
+ sprintf(blkdir, "/sys/dev/block/%d:%d",
|
||||
+ major(sb.st_rdev), minor(sb.st_rdev));
|
||||
+ if (is_dev_loop(blkdir))
|
||||
+ continue;
|
||||
+ }
|
||||
if (hasmntopt(ent, MNTOPT_RO) != NULL)
|
||||
continue;
|
||||
if (strcmp(ent->mnt_type, "vfat") == 0)
|
||||
@@ -109,18 +168,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;
|
||||
@@ -129,6 +197,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",
|
||||
@@ -150,13 +219,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[] = {
|
||||
@@ -172,6 +241,8 @@ int main(int argc, char *argv[])
|
||||
daemonize = 0;
|
||||
break;
|
||||
case 'h':
|
||||
+ print_usage(argv);
|
||||
+ exit(0);
|
||||
default:
|
||||
print_usage(argv);
|
||||
exit(EXIT_FAILURE);
|
||||
@@ -184,6 +255,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",
|
||||
@@ -236,8 +319,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;
|
||||
@@ -264,14 +346,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;
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/lsvmbus b/lsvmbus
|
||||
index 55e7374..099f2c4 100644
|
||||
--- a/lsvmbus
|
||||
+++ b/lsvmbus
|
||||
@@ -4,10 +4,10 @@
|
||||
import os
|
||||
from optparse import OptionParser
|
||||
|
||||
+help_msg = "print verbose messages. Try -vv, -vvv for more verbose messages"
|
||||
parser = OptionParser()
|
||||
-parser.add_option("-v", "--verbose", dest="verbose",
|
||||
- help="print verbose messages. Try -vv, -vvv for \
|
||||
- more verbose messages", action="count")
|
||||
+parser.add_option(
|
||||
+ "-v", "--verbose", dest="verbose", help=help_msg, action="count")
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
@@ -21,27 +21,28 @@ if not os.path.isdir(vmbus_sys_path):
|
||||
exit(-1)
|
||||
|
||||
vmbus_dev_dict = {
|
||||
- '{0e0b6031-5213-4934-818b-38d90ced39db}' : '[Operating system shutdown]',
|
||||
- '{9527e630-d0ae-497b-adce-e80ab0175caf}' : '[Time Synchronization]',
|
||||
- '{57164f39-9115-4e78-ab55-382f3bd5422d}' : '[Heartbeat]',
|
||||
- '{a9a0f4e7-5a45-4d96-b827-8a841e8c03e6}' : '[Data Exchange]',
|
||||
- '{35fa2e29-ea23-4236-96ae-3a6ebacba440}' : '[Backup (volume checkpoint)]',
|
||||
- '{34d14be3-dee4-41c8-9ae7-6b174977c192}' : '[Guest services]',
|
||||
- '{525074dc-8985-46e2-8057-a307dc18a502}' : '[Dynamic Memory]',
|
||||
- '{cfa8b69e-5b4a-4cc0-b98b-8ba1a1f3f95a}' : 'Synthetic mouse',
|
||||
- '{f912ad6d-2b17-48ea-bd65-f927a61c7684}' : 'Synthetic keyboard',
|
||||
- '{da0a7802-e377-4aac-8e77-0558eb1073f8}' : 'Synthetic framebuffer adapter',
|
||||
- '{f8615163-df3e-46c5-913f-f2d2f965ed0e}' : 'Synthetic network adapter',
|
||||
- '{32412632-86cb-44a2-9b5c-50d1417354f5}' : 'Synthetic IDE Controller',
|
||||
- '{ba6163d9-04a1-4d29-b605-72e2ffb1dc7f}' : 'Synthetic SCSI Controller',
|
||||
- '{2f9bcc4a-0069-4af3-b76b-6fd0be528cda}' : 'Synthetic fiber channel adapter',
|
||||
- '{8c2eaf3d-32a7-4b09-ab99-bd1f1c86b501}' : 'Synthetic RDMA adapter',
|
||||
- '{44c4f61d-4444-4400-9d52-802e27ede19f}' : 'PCI Express pass-through',
|
||||
- '{276aacf4-ac15-426c-98dd-7521ad3f01fe}' : '[Reserved system device]',
|
||||
- '{f8e65716-3cb3-4a06-9a60-1889c5cccab5}' : '[Reserved system device]',
|
||||
- '{3375baf4-9e15-4b30-b765-67acb10d607b}' : '[Reserved system device]',
|
||||
+ '{0e0b6031-5213-4934-818b-38d90ced39db}': '[Operating system shutdown]',
|
||||
+ '{9527e630-d0ae-497b-adce-e80ab0175caf}': '[Time Synchronization]',
|
||||
+ '{57164f39-9115-4e78-ab55-382f3bd5422d}': '[Heartbeat]',
|
||||
+ '{a9a0f4e7-5a45-4d96-b827-8a841e8c03e6}': '[Data Exchange]',
|
||||
+ '{35fa2e29-ea23-4236-96ae-3a6ebacba440}': '[Backup (volume checkpoint)]',
|
||||
+ '{34d14be3-dee4-41c8-9ae7-6b174977c192}': '[Guest services]',
|
||||
+ '{525074dc-8985-46e2-8057-a307dc18a502}': '[Dynamic Memory]',
|
||||
+ '{cfa8b69e-5b4a-4cc0-b98b-8ba1a1f3f95a}': 'Synthetic mouse',
|
||||
+ '{f912ad6d-2b17-48ea-bd65-f927a61c7684}': 'Synthetic keyboard',
|
||||
+ '{da0a7802-e377-4aac-8e77-0558eb1073f8}': 'Synthetic framebuffer adapter',
|
||||
+ '{f8615163-df3e-46c5-913f-f2d2f965ed0e}': 'Synthetic network adapter',
|
||||
+ '{32412632-86cb-44a2-9b5c-50d1417354f5}': 'Synthetic IDE Controller',
|
||||
+ '{ba6163d9-04a1-4d29-b605-72e2ffb1dc7f}': 'Synthetic SCSI Controller',
|
||||
+ '{2f9bcc4a-0069-4af3-b76b-6fd0be528cda}': 'Synthetic fiber channel adapter',
|
||||
+ '{8c2eaf3d-32a7-4b09-ab99-bd1f1c86b501}': 'Synthetic RDMA adapter',
|
||||
+ '{44c4f61d-4444-4400-9d52-802e27ede19f}': 'PCI Express pass-through',
|
||||
+ '{276aacf4-ac15-426c-98dd-7521ad3f01fe}': '[Reserved system device]',
|
||||
+ '{f8e65716-3cb3-4a06-9a60-1889c5cccab5}': '[Reserved system device]',
|
||||
+ '{3375baf4-9e15-4b30-b765-67acb10d607b}': '[Reserved system device]',
|
||||
}
|
||||
|
||||
+
|
||||
def get_vmbus_dev_attr(dev_name, attr):
|
||||
try:
|
||||
f = open('%s/%s/%s' % (vmbus_sys_path, dev_name, attr), 'r')
|
||||
@@ -52,6 +53,7 @@ def get_vmbus_dev_attr(dev_name, attr):
|
||||
|
||||
return lines
|
||||
|
||||
+
|
||||
class VMBus_Dev:
|
||||
pass
|
||||
|
||||
@@ -66,12 +68,13 @@ for f in os.listdir(vmbus_sys_path):
|
||||
|
||||
chn_vp_mapping = get_vmbus_dev_attr(f, 'channel_vp_mapping')
|
||||
chn_vp_mapping = [c.strip() for c in chn_vp_mapping]
|
||||
- chn_vp_mapping = sorted(chn_vp_mapping,
|
||||
- key = lambda c : int(c.split(':')[0]))
|
||||
+ chn_vp_mapping = sorted(
|
||||
+ chn_vp_mapping, key=lambda c: int(c.split(':')[0]))
|
||||
|
||||
- chn_vp_mapping = ['\tRel_ID=%s, target_cpu=%s' %
|
||||
- (c.split(':')[0], c.split(':')[1])
|
||||
- for c in chn_vp_mapping]
|
||||
+ chn_vp_mapping = [
|
||||
+ '\tRel_ID=%s, target_cpu=%s' %
|
||||
+ (c.split(':')[0], c.split(':')[1]) for c in chn_vp_mapping
|
||||
+ ]
|
||||
d = VMBus_Dev()
|
||||
d.sysfs_path = '%s/%s' % (vmbus_sys_path, f)
|
||||
d.vmbus_id = vmbus_id
|
||||
@@ -85,7 +88,7 @@ for f in os.listdir(vmbus_sys_path):
|
||||
vmbus_dev_list.append(d)
|
||||
|
||||
|
||||
-vmbus_dev_list = sorted(vmbus_dev_list, key = lambda d : int(d.vmbus_id))
|
||||
+vmbus_dev_list = sorted(vmbus_dev_list, key=lambda d: int(d.vmbus_id))
|
||||
|
||||
format0 = '%2s: %s'
|
||||
format1 = '%2s: Class_ID = %s - %s\n%s'
|
||||
@@ -95,9 +98,15 @@ for d in vmbus_dev_list:
|
||||
if verbose == 0:
|
||||
print(('VMBUS ID ' + format0) % (d.vmbus_id, d.dev_desc))
|
||||
elif verbose == 1:
|
||||
- print (('VMBUS ID ' + format1) % \
|
||||
- (d.vmbus_id, d.class_id, d.dev_desc, d.chn_vp_mapping))
|
||||
+ print(
|
||||
+ ('VMBUS ID ' + format1) %
|
||||
+ (d.vmbus_id, d.class_id, d.dev_desc, d.chn_vp_mapping)
|
||||
+ )
|
||||
else:
|
||||
- print (('VMBUS ID ' + format2) % \
|
||||
- (d.vmbus_id, d.class_id, d.dev_desc, \
|
||||
- d.device_id, d.sysfs_path, d.chn_vp_mapping))
|
||||
+ print(
|
||||
+ ('VMBUS ID ' + format2) %
|
||||
+ (
|
||||
+ d.vmbus_id, d.class_id, d.dev_desc,
|
||||
+ d.device_id, d.sysfs_path, d.chn_vp_mapping
|
||||
+ )
|
||||
+ )
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -1,8 +0,0 @@
|
||||
[Unit]
|
||||
Description=Hyper-V KVP daemon
|
||||
BindsTo=sys-devices-virtual-misc-vmbus\x21hv_kvp.device
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/sbin/hypervkvpd -n
|
103
SOURCES/lsvmbus
103
SOURCES/lsvmbus
@ -1,103 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
import os
|
||||
from optparse import OptionParser
|
||||
|
||||
parser = OptionParser()
|
||||
parser.add_option("-v", "--verbose", dest="verbose",
|
||||
help="print verbose messages. Try -vv, -vvv for \
|
||||
more verbose messages", action="count")
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
verbose = 0
|
||||
if options.verbose is not None:
|
||||
verbose = options.verbose
|
||||
|
||||
vmbus_sys_path = '/sys/bus/vmbus/devices'
|
||||
if not os.path.isdir(vmbus_sys_path):
|
||||
print "%s doesn't exist: exiting..." % vmbus_sys_path
|
||||
exit(-1)
|
||||
|
||||
vmbus_dev_dict = {
|
||||
'{0e0b6031-5213-4934-818b-38d90ced39db}' : '[Operating system shutdown]',
|
||||
'{9527e630-d0ae-497b-adce-e80ab0175caf}' : '[Time Synchronization]',
|
||||
'{57164f39-9115-4e78-ab55-382f3bd5422d}' : '[Heartbeat]',
|
||||
'{a9a0f4e7-5a45-4d96-b827-8a841e8c03e6}' : '[Data Exchange]',
|
||||
'{35fa2e29-ea23-4236-96ae-3a6ebacba440}' : '[Backup (volume checkpoint)]',
|
||||
'{34d14be3-dee4-41c8-9ae7-6b174977c192}' : '[Guest services]',
|
||||
'{525074dc-8985-46e2-8057-a307dc18a502}' : '[Dynamic Memory]',
|
||||
'{cfa8b69e-5b4a-4cc0-b98b-8ba1a1f3f95a}' : 'Synthetic mouse',
|
||||
'{f912ad6d-2b17-48ea-bd65-f927a61c7684}' : 'Synthetic keyboard',
|
||||
'{da0a7802-e377-4aac-8e77-0558eb1073f8}' : 'Synthetic framebuffer adapter',
|
||||
'{f8615163-df3e-46c5-913f-f2d2f965ed0e}' : 'Synthetic network adapter',
|
||||
'{32412632-86cb-44a2-9b5c-50d1417354f5}' : 'Synthetic IDE Controller',
|
||||
'{ba6163d9-04a1-4d29-b605-72e2ffb1dc7f}' : 'Synthetic SCSI Controller',
|
||||
'{2f9bcc4a-0069-4af3-b76b-6fd0be528cda}' : 'Synthetic fiber channel adapter',
|
||||
'{8c2eaf3d-32a7-4b09-ab99-bd1f1c86b501}' : 'Synthetic RDMA adapter',
|
||||
'{44c4f61d-4444-4400-9d52-802e27ede19f}' : 'PCI Express pass-through',
|
||||
'{276aacf4-ac15-426c-98dd-7521ad3f01fe}' : '[Reserved system device]',
|
||||
'{f8e65716-3cb3-4a06-9a60-1889c5cccab5}' : '[Reserved system device]',
|
||||
'{3375baf4-9e15-4b30-b765-67acb10d607b}' : '[Reserved system device]',
|
||||
}
|
||||
|
||||
def get_vmbus_dev_attr(dev_name, attr):
|
||||
try:
|
||||
f = open('%s/%s/%s' % (vmbus_sys_path, dev_name, attr), 'r')
|
||||
lines = f.readlines()
|
||||
f.close()
|
||||
except IOError:
|
||||
lines = []
|
||||
|
||||
return lines
|
||||
|
||||
class VMBus_Dev:
|
||||
pass
|
||||
|
||||
|
||||
vmbus_dev_list = []
|
||||
|
||||
for f in os.listdir(vmbus_sys_path):
|
||||
vmbus_id = get_vmbus_dev_attr(f, 'id')[0].strip()
|
||||
class_id = get_vmbus_dev_attr(f, 'class_id')[0].strip()
|
||||
device_id = get_vmbus_dev_attr(f, 'device_id')[0].strip()
|
||||
dev_desc = vmbus_dev_dict.get(class_id, 'Unknown')
|
||||
|
||||
chn_vp_mapping = get_vmbus_dev_attr(f, 'channel_vp_mapping')
|
||||
chn_vp_mapping = [c.strip() for c in chn_vp_mapping]
|
||||
chn_vp_mapping = sorted(chn_vp_mapping,
|
||||
key = lambda c : int(c.split(':')[0]))
|
||||
|
||||
chn_vp_mapping = ['\tRel_ID=%s, target_cpu=%s' %
|
||||
(c.split(':')[0], c.split(':')[1])
|
||||
for c in chn_vp_mapping]
|
||||
d = VMBus_Dev()
|
||||
d.sysfs_path = '%s/%s' % (vmbus_sys_path, f)
|
||||
d.vmbus_id = vmbus_id
|
||||
d.class_id = class_id
|
||||
d.device_id = device_id
|
||||
d.dev_desc = dev_desc
|
||||
d.chn_vp_mapping = '\n'.join(chn_vp_mapping)
|
||||
if d.chn_vp_mapping:
|
||||
d.chn_vp_mapping += '\n'
|
||||
|
||||
vmbus_dev_list.append(d)
|
||||
|
||||
|
||||
vmbus_dev_list = sorted(vmbus_dev_list, key = lambda d : int(d.vmbus_id))
|
||||
|
||||
format0 = '%2s: %s'
|
||||
format1 = '%2s: Class_ID = %s - %s\n%s'
|
||||
format2 = '%2s: Class_ID = %s - %s\n\tDevice_ID = %s\n\tSysfs path: %s\n%s'
|
||||
|
||||
for d in vmbus_dev_list:
|
||||
if verbose == 0:
|
||||
print ('VMBUS ID ' + format0) % (d.vmbus_id, d.dev_desc)
|
||||
elif verbose == 1:
|
||||
print ('VMBUS ID ' + format1) % \
|
||||
(d.vmbus_id, d.class_id, d.dev_desc, d.chn_vp_mapping)
|
||||
else:
|
||||
print ('VMBUS ID ' + format2) % \
|
||||
(d.vmbus_id, d.class_id, d.dev_desc, \
|
||||
d.device_id, d.sysfs_path, d.chn_vp_mapping)
|
6
gating.yaml
Normal file
6
gating.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
--- !Policy
|
||||
product_versions:
|
||||
- rhel-9
|
||||
decision_context: osci_compose_gate
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: 3rd-hyperv-2019-ci.brew-build.tier1.functional}
|
@ -0,0 +1,67 @@
|
||||
From 1df9596722c093afd097fd7a9689092a5cee7d2a Mon Sep 17 00:00:00 2001
|
||||
From: Ani Sinha <anisinha@redhat.com>
|
||||
Date: Tue, 10 Oct 2023 11:50:30 +0530
|
||||
Subject: [PATCH 4/4] Changes for adding keyfile support in RHEL specific
|
||||
script
|
||||
|
||||
RH-Author: Ani Sinha <anisinha@redhat.com>
|
||||
RH-MergeRequest: 8: hv/hv_kvp_daemon:Support for keyfile based connection profile
|
||||
RH-Jira: RHEL-9902
|
||||
RH-Acked-by: Cathy Avery <cavery@redhat.com>
|
||||
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-Commit: [4/4] b60a8d644b0e777373c92f4778c3d4560f6f2642 (anisinha/centos-hyperv-daemons)
|
||||
|
||||
Some adjustments to the RHEL specific customization script in order to support
|
||||
Network Manager keyfiles. These changes were tested internally by Red Hat QE.
|
||||
These changes are mostly trivial and are not pushed upstream at this momemnt.
|
||||
|
||||
Jira: https://issues.redhat.com/browse/RHEL-9902
|
||||
|
||||
See also https://issues.redhat.com/browse/RHEL-14505
|
||||
|
||||
Signed-off-by: Ani Sinha <anisinha@redhat.com>
|
||||
---
|
||||
hv_set_ifconfig.sh | 25 ++++++++++++++-----------
|
||||
1 file changed, 14 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/hv_set_ifconfig.sh b/hv_set_ifconfig.sh
|
||||
index 9c2ee30..0bdf2bc 100644
|
||||
--- a/hv_set_ifconfig.sh
|
||||
+++ b/hv_set_ifconfig.sh
|
||||
@@ -74,19 +74,22 @@
|
||||
# call.
|
||||
#
|
||||
|
||||
+# This is RHEL specific bash script that configures NM keyfiles.
|
||||
+# ifcfg files passed as the first argument to this script remains untouched.
|
||||
|
||||
+if [ -z "$2" ]; then
|
||||
+ echo "No input NM keyfile. Exiting!"
|
||||
+ exit 1
|
||||
+fi
|
||||
|
||||
-echo "IPV6INIT=yes" >> $1
|
||||
-echo "PEERDNS=yes" >> $1
|
||||
-echo "ONBOOT=yes" >> $1
|
||||
+sed -i '/\[ipv4\]/a ignore-auto-dns=false' $2
|
||||
+sed -i '/\[connection\]/a autoconnect=true' $2
|
||||
|
||||
-#Unlike older sysconfig scripts, NetworkManager expects GATEWAYx=ipaddr for all values of x.
|
||||
-#So the first gateway is GATEWAY0 instead of GATEWAY. Other values should remain unchanged.
|
||||
-#Workaround this by replacing GATEWAY= with GATEWAY0=.
|
||||
-sed -i "s/GATEWAY=/GATEWAY0=/" $1
|
||||
+filename="${2##*/}"
|
||||
+chmod 600 $2
|
||||
+cp $2 /etc/NetworkManager/system-connections/
|
||||
|
||||
-cp $1 /etc/sysconfig/network-scripts/
|
||||
+nmcli connection load "/etc/NetworkManager/system-connections/${filename}"
|
||||
+nmcli connection up filename "/etc/NetworkManager/system-connections/${filename}"
|
||||
|
||||
-filename="${1##*/}"
|
||||
-nmcli connection load "/etc/sysconfig/network-scripts/${filename}"
|
||||
-nmcli connection up filename "/etc/sysconfig/network-scripts/${filename}"
|
||||
+exit 0
|
||||
--
|
||||
2.39.3
|
||||
|
@ -1,19 +1,14 @@
|
||||
From c04d9b584862ee913720632d7fdf83b79525a7d3 Mon Sep 17 00:00:00 2001
|
||||
From 3d234bcdb4d40b42923688514a2fb5d1cb8b3314 Mon Sep 17 00:00:00 2001
|
||||
From: Till Maas <timaas@redhat.com>
|
||||
Date: Tue, 14 Dec 2021 08:07:40 +0000
|
||||
Subject: [PATCH 2/2] Use filename for connection profile
|
||||
|
||||
RH-Author: Mohamed Gamal Morsy <mmorsy@redhat.com>
|
||||
RH-Author: Till Maas <None>
|
||||
RH-MergeRequest: 2: hv_set_ifconfig.sh: Use nmcli commands
|
||||
RH-Commit: [2/2] 1b69f98b9c30ee6904475b78f2b93fabe2131074
|
||||
RH-Bugzilla: 2056566
|
||||
RH-Commit: [2/2] 6b6f37ba159b0614b75fcfc02f0513af116711c2 (timaas/hyperv-daemons)
|
||||
RH-Bugzilla: 2026371
|
||||
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2056566
|
||||
|
||||
Signed-off-by: Till Maas <tmaas@redhat.com>
|
||||
Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
|
||||
---
|
||||
hv_set_ifconfig.sh | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
335
hpvd-hv-hv_kvp_daemon-Handle-IPv4-and-Ipv6-combination-fo.patch
Normal file
335
hpvd-hv-hv_kvp_daemon-Handle-IPv4-and-Ipv6-combination-fo.patch
Normal file
@ -0,0 +1,335 @@
|
||||
From d252f80372544b9b7e060b90bf5c5b0ccf6093d6 Mon Sep 17 00:00:00 2001
|
||||
From: Shradha Gupta <shradhagupta@linux.microsoft.com>
|
||||
Date: Fri, 22 Mar 2024 06:46:02 -0700
|
||||
Subject: [PATCH 3/4] hv/hv_kvp_daemon: Handle IPv4 and Ipv6 combination for
|
||||
keyfile format
|
||||
|
||||
RH-Author: Ani Sinha <anisinha@redhat.com>
|
||||
RH-MergeRequest: 8: hv/hv_kvp_daemon:Support for keyfile based connection profile
|
||||
RH-Jira: RHEL-9902
|
||||
RH-Acked-by: Cathy Avery <cavery@redhat.com>
|
||||
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-Commit: [3/4] e164b6951b873467f8c87e0d01b1fd89326aa64e (anisinha/centos-hyperv-daemons)
|
||||
|
||||
If the network configuration strings are passed as a combination of IPv4
|
||||
and IPv6 addresses, the current KVP daemon does not handle processing for
|
||||
the keyfile configuration format.
|
||||
With these changes, the keyfile config generation logic scans through the
|
||||
list twice to generate IPv4 and IPv6 sections for the configuration files
|
||||
to handle this support.
|
||||
|
||||
Testcases ran:Rhel 9, Hyper-V VMs
|
||||
(IPv4 only, IPv6 only, IPv4 and IPv6 combination)
|
||||
|
||||
Cherry-picked from Linux kernel upstream commit
|
||||
f971f6dd3742d2 ("hv/hv_kvp_daemon: Handle IPv4 and Ipv6 combination for keyfile format")
|
||||
Co-developed-by: Ani Sinha <anisinha@redhat.com>
|
||||
Signed-off-by: Ani Sinha <anisinha@redhat.com>
|
||||
Signed-off-by: Shradha Gupta <shradhagupta@linux.microsoft.com>
|
||||
Reviewed-by: Easwar Hariharan <eahariha@linux.microsoft.com>
|
||||
Tested-by: Ani Sinha <anisinha@redhat.com>
|
||||
Reviewed-by: Ani Sinha <anisinha@redhat.com>
|
||||
Link: https://lore.kernel.org/r/1711115162-11629-1-git-send-email-shradhagupta@linux.microsoft.com
|
||||
Signed-off-by: Wei Liu <wei.liu@kernel.org>
|
||||
Message-ID: <1711115162-11629-1-git-send-email-shradhagupta@linux.microsoft.com>
|
||||
---
|
||||
hv_kvp_daemon.c | 213 ++++++++++++++++++++++++++++++++++++++----------
|
||||
1 file changed, 172 insertions(+), 41 deletions(-)
|
||||
|
||||
diff --git a/hv_kvp_daemon.c b/hv_kvp_daemon.c
|
||||
index 2f1862e..aa350d8 100644
|
||||
--- a/hv_kvp_daemon.c
|
||||
+++ b/hv_kvp_daemon.c
|
||||
@@ -76,6 +76,12 @@ enum {
|
||||
DNS
|
||||
};
|
||||
|
||||
+enum {
|
||||
+ IPV4 = 1,
|
||||
+ IPV6,
|
||||
+ IP_TYPE_MAX
|
||||
+};
|
||||
+
|
||||
static int in_hand_shake;
|
||||
|
||||
static char *os_name = "";
|
||||
@@ -102,6 +108,11 @@ static struct utsname uts_buf;
|
||||
|
||||
#define MAX_FILE_NAME 100
|
||||
#define ENTRIES_PER_BLOCK 50
|
||||
+/*
|
||||
+ * Change this entry if the number of addresses increases in future
|
||||
+ */
|
||||
+#define MAX_IP_ENTRIES 64
|
||||
+#define OUTSTR_BUF_SIZE ((INET6_ADDRSTRLEN + 1) * MAX_IP_ENTRIES)
|
||||
|
||||
struct kvp_record {
|
||||
char key[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
|
||||
@@ -1171,6 +1182,18 @@ static int process_ip_string(FILE *f, char *ip_string, int type)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+int ip_version_check(const char *input_addr)
|
||||
+{
|
||||
+ struct in6_addr addr;
|
||||
+
|
||||
+ if (inet_pton(AF_INET, input_addr, &addr))
|
||||
+ return IPV4;
|
||||
+ else if (inet_pton(AF_INET6, input_addr, &addr))
|
||||
+ return IPV6;
|
||||
+
|
||||
+ return -EINVAL;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Only IPv4 subnet strings needs to be converted to plen
|
||||
* For IPv6 the subnet is already privided in plen format
|
||||
@@ -1197,14 +1220,75 @@ static int kvp_subnet_to_plen(char *subnet_addr_str)
|
||||
return plen;
|
||||
}
|
||||
|
||||
+static int process_dns_gateway_nm(FILE *f, char *ip_string, int type,
|
||||
+ int ip_sec)
|
||||
+{
|
||||
+ char addr[INET6_ADDRSTRLEN], *output_str;
|
||||
+ int ip_offset = 0, error = 0, ip_ver;
|
||||
+ char *param_name;
|
||||
+
|
||||
+ if (type == DNS)
|
||||
+ param_name = "dns";
|
||||
+ else if (type == GATEWAY)
|
||||
+ param_name = "gateway";
|
||||
+ else
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ output_str = (char *)calloc(OUTSTR_BUF_SIZE, sizeof(char));
|
||||
+ if (!output_str)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ while (1) {
|
||||
+ memset(addr, 0, sizeof(addr));
|
||||
+
|
||||
+ if (!parse_ip_val_buffer(ip_string, &ip_offset, addr,
|
||||
+ (MAX_IP_ADDR_SIZE * 2)))
|
||||
+ break;
|
||||
+
|
||||
+ ip_ver = ip_version_check(addr);
|
||||
+ if (ip_ver < 0)
|
||||
+ continue;
|
||||
+
|
||||
+ if ((ip_ver == IPV4 && ip_sec == IPV4) ||
|
||||
+ (ip_ver == IPV6 && ip_sec == IPV6)) {
|
||||
+ /*
|
||||
+ * do a bound check to avoid out-of bound writes
|
||||
+ */
|
||||
+ if ((OUTSTR_BUF_SIZE - strlen(output_str)) >
|
||||
+ (strlen(addr) + 1)) {
|
||||
+ strncat(output_str, addr,
|
||||
+ OUTSTR_BUF_SIZE -
|
||||
+ strlen(output_str) - 1);
|
||||
+ strncat(output_str, ",",
|
||||
+ OUTSTR_BUF_SIZE -
|
||||
+ strlen(output_str) - 1);
|
||||
+ }
|
||||
+ } else {
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (strlen(output_str)) {
|
||||
+ /*
|
||||
+ * This is to get rid of that extra comma character
|
||||
+ * in the end of the string
|
||||
+ */
|
||||
+ output_str[strlen(output_str) - 1] = '\0';
|
||||
+ error = fprintf(f, "%s=%s\n", param_name, output_str);
|
||||
+ }
|
||||
+
|
||||
+ free(output_str);
|
||||
+ return error;
|
||||
+}
|
||||
+
|
||||
static int process_ip_string_nm(FILE *f, char *ip_string, char *subnet,
|
||||
- int is_ipv6)
|
||||
+ int ip_sec)
|
||||
{
|
||||
char addr[INET6_ADDRSTRLEN];
|
||||
char subnet_addr[INET6_ADDRSTRLEN];
|
||||
- int error, i = 0;
|
||||
+ int error = 0, i = 0;
|
||||
int ip_offset = 0, subnet_offset = 0;
|
||||
- int plen;
|
||||
+ int plen, ip_ver;
|
||||
|
||||
memset(addr, 0, sizeof(addr));
|
||||
memset(subnet_addr, 0, sizeof(subnet_addr));
|
||||
@@ -1216,10 +1300,16 @@ static int process_ip_string_nm(FILE *f, char *ip_string, char *subnet,
|
||||
subnet_addr,
|
||||
(MAX_IP_ADDR_SIZE *
|
||||
2))) {
|
||||
- if (!is_ipv6)
|
||||
+ ip_ver = ip_version_check(addr);
|
||||
+ if (ip_ver < 0)
|
||||
+ continue;
|
||||
+
|
||||
+ if (ip_ver == IPV4 && ip_sec == IPV4)
|
||||
plen = kvp_subnet_to_plen((char *)subnet_addr);
|
||||
- else
|
||||
+ else if (ip_ver == IPV6 && ip_sec == IPV6)
|
||||
plen = atoi(subnet_addr);
|
||||
+ else
|
||||
+ continue;
|
||||
|
||||
if (plen < 0)
|
||||
return plen;
|
||||
@@ -1233,17 +1323,16 @@ static int process_ip_string_nm(FILE *f, char *ip_string, char *subnet,
|
||||
memset(subnet_addr, 0, sizeof(subnet_addr));
|
||||
}
|
||||
|
||||
- return 0;
|
||||
+ return error;
|
||||
}
|
||||
|
||||
static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
|
||||
{
|
||||
- int error = 0;
|
||||
+ int error = 0, ip_ver;
|
||||
char if_filename[PATH_MAX];
|
||||
char nm_filename[PATH_MAX];
|
||||
FILE *ifcfg_file, *nmfile;
|
||||
char cmd[PATH_MAX];
|
||||
- int is_ipv6 = 0;
|
||||
char *mac_addr;
|
||||
int str_len;
|
||||
|
||||
@@ -1421,52 +1510,94 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
|
||||
if (error)
|
||||
goto setval_error;
|
||||
|
||||
- if (new_val->addr_family & ADDR_FAMILY_IPV6) {
|
||||
- error = fprintf(nmfile, "\n[ipv6]\n");
|
||||
- if (error < 0)
|
||||
- goto setval_error;
|
||||
- is_ipv6 = 1;
|
||||
- } else {
|
||||
- error = fprintf(nmfile, "\n[ipv4]\n");
|
||||
- if (error < 0)
|
||||
- goto setval_error;
|
||||
- }
|
||||
-
|
||||
/*
|
||||
* Now we populate the keyfile format
|
||||
+ *
|
||||
+ * The keyfile format expects the IPv6 and IPv4 configuration in
|
||||
+ * different sections. Therefore we iterate through the list twice,
|
||||
+ * once to populate the IPv4 section and the next time for IPv6
|
||||
*/
|
||||
+ ip_ver = IPV4;
|
||||
+ do {
|
||||
+ if (ip_ver == IPV4) {
|
||||
+ error = fprintf(nmfile, "\n[ipv4]\n");
|
||||
+ if (error < 0)
|
||||
+ goto setval_error;
|
||||
+ } else {
|
||||
+ error = fprintf(nmfile, "\n[ipv6]\n");
|
||||
+ if (error < 0)
|
||||
+ goto setval_error;
|
||||
+ }
|
||||
|
||||
- if (new_val->dhcp_enabled) {
|
||||
- error = kvp_write_file(nmfile, "method", "", "auto");
|
||||
- if (error < 0)
|
||||
- goto setval_error;
|
||||
- } else {
|
||||
- error = kvp_write_file(nmfile, "method", "", "manual");
|
||||
+ /*
|
||||
+ * Write the configuration for ipaddress, netmask, gateway and
|
||||
+ * name services
|
||||
+ */
|
||||
+ error = process_ip_string_nm(nmfile, (char *)new_val->ip_addr,
|
||||
+ (char *)new_val->sub_net,
|
||||
+ ip_ver);
|
||||
if (error < 0)
|
||||
goto setval_error;
|
||||
- }
|
||||
|
||||
- /*
|
||||
- * Write the configuration for ipaddress, netmask, gateway and
|
||||
- * name services
|
||||
- */
|
||||
- error = process_ip_string_nm(nmfile, (char *)new_val->ip_addr,
|
||||
- (char *)new_val->sub_net, is_ipv6);
|
||||
- if (error < 0)
|
||||
- goto setval_error;
|
||||
+ /*
|
||||
+ * As dhcp_enabled is only valid for ipv4, we do not set dhcp
|
||||
+ * methods for ipv6 based on dhcp_enabled flag.
|
||||
+ *
|
||||
+ * For ipv4, set method to manual only when dhcp_enabled is
|
||||
+ * false and specific ipv4 addresses are configured. If neither
|
||||
+ * dhcp_enabled is true and no ipv4 addresses are configured,
|
||||
+ * set method to 'disabled'.
|
||||
+ *
|
||||
+ * For ipv6, set method to manual when we configure ipv6
|
||||
+ * addresses. Otherwise set method to 'auto' so that SLAAC from
|
||||
+ * RA may be used.
|
||||
+ */
|
||||
+ if (ip_ver == IPV4) {
|
||||
+ if (new_val->dhcp_enabled) {
|
||||
+ error = kvp_write_file(nmfile, "method", "",
|
||||
+ "auto");
|
||||
+ if (error < 0)
|
||||
+ goto setval_error;
|
||||
+ } else if (error) {
|
||||
+ error = kvp_write_file(nmfile, "method", "",
|
||||
+ "manual");
|
||||
+ if (error < 0)
|
||||
+ goto setval_error;
|
||||
+ } else {
|
||||
+ error = kvp_write_file(nmfile, "method", "",
|
||||
+ "disabled");
|
||||
+ if (error < 0)
|
||||
+ goto setval_error;
|
||||
+ }
|
||||
+ } else if (ip_ver == IPV6) {
|
||||
+ if (error) {
|
||||
+ error = kvp_write_file(nmfile, "method", "",
|
||||
+ "manual");
|
||||
+ if (error < 0)
|
||||
+ goto setval_error;
|
||||
+ } else {
|
||||
+ error = kvp_write_file(nmfile, "method", "",
|
||||
+ "auto");
|
||||
+ if (error < 0)
|
||||
+ goto setval_error;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- /* we do not want ipv4 addresses in ipv6 section and vice versa */
|
||||
- if (is_ipv6 != is_ipv4((char *)new_val->gate_way)) {
|
||||
- error = fprintf(nmfile, "gateway=%s\n", (char *)new_val->gate_way);
|
||||
+ error = process_dns_gateway_nm(nmfile,
|
||||
+ (char *)new_val->gate_way,
|
||||
+ GATEWAY, ip_ver);
|
||||
if (error < 0)
|
||||
goto setval_error;
|
||||
- }
|
||||
|
||||
- if (is_ipv6 != is_ipv4((char *)new_val->dns_addr)) {
|
||||
- error = fprintf(nmfile, "dns=%s\n", (char *)new_val->dns_addr);
|
||||
+ error = process_dns_gateway_nm(nmfile,
|
||||
+ (char *)new_val->dns_addr, DNS,
|
||||
+ ip_ver);
|
||||
if (error < 0)
|
||||
goto setval_error;
|
||||
- }
|
||||
+
|
||||
+ ip_ver++;
|
||||
+ } while (ip_ver < IP_TYPE_MAX);
|
||||
+
|
||||
fclose(nmfile);
|
||||
fclose(ifcfg_file);
|
||||
|
||||
--
|
||||
2.39.3
|
||||
|
100
hpvd-hv-hv_kvp_daemon-Some-small-fixes-for-handling-NM-ke.patch
Normal file
100
hpvd-hv-hv_kvp_daemon-Some-small-fixes-for-handling-NM-ke.patch
Normal file
@ -0,0 +1,100 @@
|
||||
From 61d2686d4b36e5a9099d80131044807f69142249 Mon Sep 17 00:00:00 2001
|
||||
From: Ani Sinha <anisinha@redhat.com>
|
||||
Date: Mon, 16 Oct 2023 19:03:33 +0530
|
||||
Subject: [PATCH 2/4] hv/hv_kvp_daemon: Some small fixes for handling NM
|
||||
keyfiles
|
||||
|
||||
RH-Author: Ani Sinha <anisinha@redhat.com>
|
||||
RH-MergeRequest: 8: hv/hv_kvp_daemon:Support for keyfile based connection profile
|
||||
RH-Jira: RHEL-9902
|
||||
RH-Acked-by: Cathy Avery <cavery@redhat.com>
|
||||
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-Commit: [2/4] 1676c48ed1f2d91dd1f8c43f6c8009e3bebf295a (anisinha/centos-hyperv-daemons)
|
||||
|
||||
Some small fixes:
|
||||
- lets make sure we are not adding ipv4 addresses in ipv6 section in
|
||||
keyfile and vice versa.
|
||||
- ADDR_FAMILY_IPV6 is a bit in addr_family. Test that bit instead of
|
||||
checking the whole value of addr_family.
|
||||
- Some trivial fixes in hv_set_ifconfig.sh.
|
||||
|
||||
These fixes are proposed after doing some internal testing at Red Hat.
|
||||
|
||||
Cherry-picked from upstream linux
|
||||
kernel commit c3803203bc5ec910a ("hv/hv_kvp_daemon: Some small fixes for handling NM keyfiles")
|
||||
CC: Shradha Gupta <shradhagupta@linux.microsoft.com>
|
||||
CC: Saurabh Sengar <ssengar@linux.microsoft.com>
|
||||
Fixes: 42999c904612 ("hv/hv_kvp_daemon:Support for keyfile based connection profile")
|
||||
Signed-off-by: Ani Sinha <anisinha@redhat.com>
|
||||
Reviewed-by: Shradha Gupta <Shradhagupta@linux.microsoft.com>
|
||||
Signed-off-by: Wei Liu <wei.liu@kernel.org>
|
||||
Message-ID: <20231016133122.2419537-1-anisinha@redhat.com>
|
||||
---
|
||||
hv_kvp_daemon.c | 20 ++++++++++++--------
|
||||
hv_set_ifconfig.sh | 4 ++--
|
||||
2 files changed, 14 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/hv_kvp_daemon.c b/hv_kvp_daemon.c
|
||||
index d50b4e8..2f1862e 100644
|
||||
--- a/hv_kvp_daemon.c
|
||||
+++ b/hv_kvp_daemon.c
|
||||
@@ -1421,7 +1421,7 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
|
||||
if (error)
|
||||
goto setval_error;
|
||||
|
||||
- if (new_val->addr_family == ADDR_FAMILY_IPV6) {
|
||||
+ if (new_val->addr_family & ADDR_FAMILY_IPV6) {
|
||||
error = fprintf(nmfile, "\n[ipv6]\n");
|
||||
if (error < 0)
|
||||
goto setval_error;
|
||||
@@ -1455,14 +1455,18 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
|
||||
if (error < 0)
|
||||
goto setval_error;
|
||||
|
||||
- error = fprintf(nmfile, "gateway=%s\n", (char *)new_val->gate_way);
|
||||
- if (error < 0)
|
||||
- goto setval_error;
|
||||
-
|
||||
- error = fprintf(nmfile, "dns=%s\n", (char *)new_val->dns_addr);
|
||||
- if (error < 0)
|
||||
- goto setval_error;
|
||||
+ /* we do not want ipv4 addresses in ipv6 section and vice versa */
|
||||
+ if (is_ipv6 != is_ipv4((char *)new_val->gate_way)) {
|
||||
+ error = fprintf(nmfile, "gateway=%s\n", (char *)new_val->gate_way);
|
||||
+ if (error < 0)
|
||||
+ goto setval_error;
|
||||
+ }
|
||||
|
||||
+ if (is_ipv6 != is_ipv4((char *)new_val->dns_addr)) {
|
||||
+ error = fprintf(nmfile, "dns=%s\n", (char *)new_val->dns_addr);
|
||||
+ if (error < 0)
|
||||
+ goto setval_error;
|
||||
+ }
|
||||
fclose(nmfile);
|
||||
fclose(ifcfg_file);
|
||||
|
||||
diff --git a/hv_set_ifconfig.sh b/hv_set_ifconfig.sh
|
||||
index 35aae6f..9c2ee30 100644
|
||||
--- a/hv_set_ifconfig.sh
|
||||
+++ b/hv_set_ifconfig.sh
|
||||
@@ -53,7 +53,7 @@
|
||||
# or "manual" if no boot-time protocol should be used)
|
||||
#
|
||||
# address1=ipaddr1/plen
|
||||
-# address=ipaddr2/plen
|
||||
+# address2=ipaddr2/plen
|
||||
#
|
||||
# gateway=gateway1;gateway2
|
||||
#
|
||||
@@ -61,7 +61,7 @@
|
||||
#
|
||||
# [ipv6]
|
||||
# address1=ipaddr1/plen
|
||||
-# address2=ipaddr1/plen
|
||||
+# address2=ipaddr2/plen
|
||||
#
|
||||
# gateway=gateway1;gateway2
|
||||
#
|
||||
--
|
||||
2.39.3
|
||||
|
426
hpvd-hv-hv_kvp_daemon-Support-for-keyfile-based-connectio.patch
Normal file
426
hpvd-hv-hv_kvp_daemon-Support-for-keyfile-based-connectio.patch
Normal file
@ -0,0 +1,426 @@
|
||||
From 626a1af79f67bd9150dd6ff496d0dbbfb93bc320 Mon Sep 17 00:00:00 2001
|
||||
From: Shradha Gupta <shradhagupta@linux.microsoft.com>
|
||||
Date: Mon, 9 Oct 2023 03:38:40 -0700
|
||||
Subject: [PATCH 1/4] hv/hv_kvp_daemon:Support for keyfile based connection
|
||||
profile
|
||||
|
||||
RH-Author: Ani Sinha <anisinha@redhat.com>
|
||||
RH-MergeRequest: 8: hv/hv_kvp_daemon:Support for keyfile based connection profile
|
||||
RH-Jira: RHEL-9902
|
||||
RH-Acked-by: Cathy Avery <cavery@redhat.com>
|
||||
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-Commit: [1/4] 0cb079b0cc30bef47bddd193e262dfa52b7f2874 (anisinha/centos-hyperv-daemons)
|
||||
|
||||
Ifcfg config file support in NetworkManger is deprecated. This patch
|
||||
provides support for the new keyfile config format for connection
|
||||
profiles in NetworkManager. The patch modifies the hv_kvp_daemon code
|
||||
to generate the new network configuration in keyfile
|
||||
format(.ini-style format) along with a ifcfg format configuration.
|
||||
The ifcfg format configuration is also retained to support easy
|
||||
backward compatibility for distro vendors. These configurations are
|
||||
stored in temp files which are further translated using the
|
||||
hv_set_ifconfig.sh script. This script is implemented by individual
|
||||
distros based on the network management commands supported.
|
||||
For example, RHEL's implementation could be found here:
|
||||
https://gitlab.com/redhat/centos-stream/src/hyperv-daemons/-/blob/c9s/hv_set_ifconfig.sh
|
||||
Debian's implementation could be found here:
|
||||
https://github.com/endlessm/linux/blob/master/debian/cloud-tools/hv_set_ifconfig
|
||||
|
||||
The next part of this support is to let the Distro vendors consume
|
||||
these modified implementations to the new configuration format.
|
||||
|
||||
Cherry-picked from upstream linux
|
||||
kernel commit 42999c904612 ("hv/hv_kvp_daemon:Support for keyfile based connection profile")
|
||||
Tested-on: Rhel9(Hyper-V, Azure)(nm and ifcfg files verified)
|
||||
Signed-off-by: Shradha Gupta <shradhagupta@linux.microsoft.com>
|
||||
Reviewed-by: Saurabh Sengar <ssengar@linux.microsoft.com>
|
||||
Reviewed-by: Ani Sinha <anisinha@redhat.com>
|
||||
Signed-off-by: Wei Liu <wei.liu@kernel.org>
|
||||
Link: https://lore.kernel.org/r/1696847920-31125-1-git-send-email-shradhagupta@linux.microsoft.com
|
||||
---
|
||||
hv_kvp_daemon.c | 233 +++++++++++++++++++++++++++++++++++++++------
|
||||
hv_set_ifconfig.sh | 30 +++++-
|
||||
2 files changed, 230 insertions(+), 33 deletions(-)
|
||||
|
||||
diff --git a/hv_kvp_daemon.c b/hv_kvp_daemon.c
|
||||
index 2ad9af3..d50b4e8 100644
|
||||
--- a/hv_kvp_daemon.c
|
||||
+++ b/hv_kvp_daemon.c
|
||||
@@ -1171,12 +1171,79 @@ static int process_ip_string(FILE *f, char *ip_string, int type)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Only IPv4 subnet strings needs to be converted to plen
|
||||
+ * For IPv6 the subnet is already privided in plen format
|
||||
+ */
|
||||
+static int kvp_subnet_to_plen(char *subnet_addr_str)
|
||||
+{
|
||||
+ int plen = 0;
|
||||
+ struct in_addr subnet_addr4;
|
||||
+
|
||||
+ /*
|
||||
+ * Convert subnet address to binary representation
|
||||
+ */
|
||||
+ if (inet_pton(AF_INET, subnet_addr_str, &subnet_addr4) == 1) {
|
||||
+ uint32_t subnet_mask = ntohl(subnet_addr4.s_addr);
|
||||
+
|
||||
+ while (subnet_mask & 0x80000000) {
|
||||
+ plen++;
|
||||
+ subnet_mask <<= 1;
|
||||
+ }
|
||||
+ } else {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ return plen;
|
||||
+}
|
||||
+
|
||||
+static int process_ip_string_nm(FILE *f, char *ip_string, char *subnet,
|
||||
+ int is_ipv6)
|
||||
+{
|
||||
+ char addr[INET6_ADDRSTRLEN];
|
||||
+ char subnet_addr[INET6_ADDRSTRLEN];
|
||||
+ int error, i = 0;
|
||||
+ int ip_offset = 0, subnet_offset = 0;
|
||||
+ int plen;
|
||||
+
|
||||
+ memset(addr, 0, sizeof(addr));
|
||||
+ memset(subnet_addr, 0, sizeof(subnet_addr));
|
||||
+
|
||||
+ while (parse_ip_val_buffer(ip_string, &ip_offset, addr,
|
||||
+ (MAX_IP_ADDR_SIZE * 2)) &&
|
||||
+ parse_ip_val_buffer(subnet,
|
||||
+ &subnet_offset,
|
||||
+ subnet_addr,
|
||||
+ (MAX_IP_ADDR_SIZE *
|
||||
+ 2))) {
|
||||
+ if (!is_ipv6)
|
||||
+ plen = kvp_subnet_to_plen((char *)subnet_addr);
|
||||
+ else
|
||||
+ plen = atoi(subnet_addr);
|
||||
+
|
||||
+ if (plen < 0)
|
||||
+ return plen;
|
||||
+
|
||||
+ error = fprintf(f, "address%d=%s/%d\n", ++i, (char *)addr,
|
||||
+ plen);
|
||||
+ if (error < 0)
|
||||
+ return error;
|
||||
+
|
||||
+ memset(addr, 0, sizeof(addr));
|
||||
+ memset(subnet_addr, 0, sizeof(subnet_addr));
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
|
||||
{
|
||||
int error = 0;
|
||||
- char if_file[PATH_MAX];
|
||||
- FILE *file;
|
||||
+ char if_filename[PATH_MAX];
|
||||
+ char nm_filename[PATH_MAX];
|
||||
+ FILE *ifcfg_file, *nmfile;
|
||||
char cmd[PATH_MAX];
|
||||
+ int is_ipv6 = 0;
|
||||
char *mac_addr;
|
||||
int str_len;
|
||||
|
||||
@@ -1197,7 +1264,7 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
|
||||
* in a given distro to configure the interface and so are free
|
||||
* ignore information that may not be relevant.
|
||||
*
|
||||
- * Here is the format of the ip configuration file:
|
||||
+ * Here is the ifcfg format of the ip configuration file:
|
||||
*
|
||||
* HWADDR=macaddr
|
||||
* DEVICE=interface name
|
||||
@@ -1220,6 +1287,32 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
|
||||
* tagged as IPV6_DEFAULTGW and IPV6 NETMASK will be tagged as
|
||||
* IPV6NETMASK.
|
||||
*
|
||||
+ * Here is the keyfile format of the ip configuration file:
|
||||
+ *
|
||||
+ * [ethernet]
|
||||
+ * mac-address=macaddr
|
||||
+ * [connection]
|
||||
+ * interface-name=interface name
|
||||
+ *
|
||||
+ * [ipv4]
|
||||
+ * method=<protocol> (where <protocol> is "auto" if DHCP is configured
|
||||
+ * or "manual" if no boot-time protocol should be used)
|
||||
+ *
|
||||
+ * address1=ipaddr1/plen
|
||||
+ * address2=ipaddr2/plen
|
||||
+ *
|
||||
+ * gateway=gateway1;gateway2
|
||||
+ *
|
||||
+ * dns=dns1;dns2
|
||||
+ *
|
||||
+ * [ipv6]
|
||||
+ * address1=ipaddr1/plen
|
||||
+ * address2=ipaddr2/plen
|
||||
+ *
|
||||
+ * gateway=gateway1;gateway2
|
||||
+ *
|
||||
+ * dns=dns1;dns2
|
||||
+ *
|
||||
* The host can specify multiple ipv4 and ipv6 addresses to be
|
||||
* configured for the interface. Furthermore, the configuration
|
||||
* needs to be persistent. A subsequent GET call on the interface
|
||||
@@ -1227,14 +1320,29 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
|
||||
* call.
|
||||
*/
|
||||
|
||||
- snprintf(if_file, sizeof(if_file), "%s%s%s", KVP_CONFIG_LOC,
|
||||
- "/ifcfg-", if_name);
|
||||
+ /*
|
||||
+ * We are populating both ifcfg and nmconnection files
|
||||
+ */
|
||||
+ snprintf(if_filename, sizeof(if_filename), "%s%s%s", KVP_CONFIG_LOC,
|
||||
+ "/ifcfg-", if_name);
|
||||
|
||||
- file = fopen(if_file, "w");
|
||||
+ ifcfg_file = fopen(if_filename, "w");
|
||||
|
||||
- if (file == NULL) {
|
||||
+ if (!ifcfg_file) {
|
||||
syslog(LOG_ERR, "Failed to open config file; error: %d %s",
|
||||
- errno, strerror(errno));
|
||||
+ errno, strerror(errno));
|
||||
+ return HV_E_FAIL;
|
||||
+ }
|
||||
+
|
||||
+ snprintf(nm_filename, sizeof(nm_filename), "%s%s%s%s", KVP_CONFIG_LOC,
|
||||
+ "/", if_name, ".nmconnection");
|
||||
+
|
||||
+ nmfile = fopen(nm_filename, "w");
|
||||
+
|
||||
+ if (!nmfile) {
|
||||
+ syslog(LOG_ERR, "Failed to open config file; error: %d %s",
|
||||
+ errno, strerror(errno));
|
||||
+ fclose(ifcfg_file);
|
||||
return HV_E_FAIL;
|
||||
}
|
||||
|
||||
@@ -1248,14 +1356,31 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
|
||||
goto setval_error;
|
||||
}
|
||||
|
||||
- error = kvp_write_file(file, "HWADDR", "", mac_addr);
|
||||
- free(mac_addr);
|
||||
+ error = kvp_write_file(ifcfg_file, "HWADDR", "", mac_addr);
|
||||
+ if (error < 0)
|
||||
+ goto setmac_error;
|
||||
+
|
||||
+ error = kvp_write_file(ifcfg_file, "DEVICE", "", if_name);
|
||||
+ if (error < 0)
|
||||
+ goto setmac_error;
|
||||
+
|
||||
+ error = fprintf(nmfile, "\n[connection]\n");
|
||||
+ if (error < 0)
|
||||
+ goto setmac_error;
|
||||
+
|
||||
+ error = kvp_write_file(nmfile, "interface-name", "", if_name);
|
||||
if (error)
|
||||
- goto setval_error;
|
||||
+ goto setmac_error;
|
||||
|
||||
- error = kvp_write_file(file, "DEVICE", "", if_name);
|
||||
+ error = fprintf(nmfile, "\n[ethernet]\n");
|
||||
+ if (error < 0)
|
||||
+ goto setmac_error;
|
||||
+
|
||||
+ error = kvp_write_file(nmfile, "mac-address", "", mac_addr);
|
||||
if (error)
|
||||
- goto setval_error;
|
||||
+ goto setmac_error;
|
||||
+
|
||||
+ free(mac_addr);
|
||||
|
||||
/*
|
||||
* The dhcp_enabled flag is only for IPv4. In the case the host only
|
||||
@@ -1263,47 +1388,91 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
|
||||
* proceed to parse and pass the IPv6 information to the
|
||||
* disto-specific script hv_set_ifconfig.
|
||||
*/
|
||||
+
|
||||
+ /*
|
||||
+ * First populate the ifcfg file format
|
||||
+ */
|
||||
if (new_val->dhcp_enabled) {
|
||||
- error = kvp_write_file(file, "BOOTPROTO", "", "dhcp");
|
||||
+ error = kvp_write_file(ifcfg_file, "BOOTPROTO", "", "dhcp");
|
||||
if (error)
|
||||
goto setval_error;
|
||||
-
|
||||
} else {
|
||||
- error = kvp_write_file(file, "BOOTPROTO", "", "none");
|
||||
+ error = kvp_write_file(ifcfg_file, "BOOTPROTO", "", "none");
|
||||
if (error)
|
||||
goto setval_error;
|
||||
}
|
||||
|
||||
- /*
|
||||
- * Write the configuration for ipaddress, netmask, gateway and
|
||||
- * name servers.
|
||||
- */
|
||||
-
|
||||
- error = process_ip_string(file, (char *)new_val->ip_addr, IPADDR);
|
||||
+ error = process_ip_string(ifcfg_file, (char *)new_val->ip_addr,
|
||||
+ IPADDR);
|
||||
if (error)
|
||||
goto setval_error;
|
||||
|
||||
- error = process_ip_string(file, (char *)new_val->sub_net, NETMASK);
|
||||
+ error = process_ip_string(ifcfg_file, (char *)new_val->sub_net,
|
||||
+ NETMASK);
|
||||
if (error)
|
||||
goto setval_error;
|
||||
|
||||
- error = process_ip_string(file, (char *)new_val->gate_way, GATEWAY);
|
||||
+ error = process_ip_string(ifcfg_file, (char *)new_val->gate_way,
|
||||
+ GATEWAY);
|
||||
if (error)
|
||||
goto setval_error;
|
||||
|
||||
- error = process_ip_string(file, (char *)new_val->dns_addr, DNS);
|
||||
+ error = process_ip_string(ifcfg_file, (char *)new_val->dns_addr, DNS);
|
||||
if (error)
|
||||
goto setval_error;
|
||||
|
||||
- fclose(file);
|
||||
+ if (new_val->addr_family == ADDR_FAMILY_IPV6) {
|
||||
+ error = fprintf(nmfile, "\n[ipv6]\n");
|
||||
+ if (error < 0)
|
||||
+ goto setval_error;
|
||||
+ is_ipv6 = 1;
|
||||
+ } else {
|
||||
+ error = fprintf(nmfile, "\n[ipv4]\n");
|
||||
+ if (error < 0)
|
||||
+ goto setval_error;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * Now we populate the keyfile format
|
||||
+ */
|
||||
+
|
||||
+ if (new_val->dhcp_enabled) {
|
||||
+ error = kvp_write_file(nmfile, "method", "", "auto");
|
||||
+ if (error < 0)
|
||||
+ goto setval_error;
|
||||
+ } else {
|
||||
+ error = kvp_write_file(nmfile, "method", "", "manual");
|
||||
+ if (error < 0)
|
||||
+ goto setval_error;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * Write the configuration for ipaddress, netmask, gateway and
|
||||
+ * name services
|
||||
+ */
|
||||
+ error = process_ip_string_nm(nmfile, (char *)new_val->ip_addr,
|
||||
+ (char *)new_val->sub_net, is_ipv6);
|
||||
+ if (error < 0)
|
||||
+ goto setval_error;
|
||||
+
|
||||
+ error = fprintf(nmfile, "gateway=%s\n", (char *)new_val->gate_way);
|
||||
+ if (error < 0)
|
||||
+ goto setval_error;
|
||||
+
|
||||
+ error = fprintf(nmfile, "dns=%s\n", (char *)new_val->dns_addr);
|
||||
+ if (error < 0)
|
||||
+ goto setval_error;
|
||||
+
|
||||
+ fclose(nmfile);
|
||||
+ fclose(ifcfg_file);
|
||||
|
||||
/*
|
||||
* Now that we have populated the configuration file,
|
||||
* invoke the external script to do its magic.
|
||||
*/
|
||||
|
||||
- str_len = snprintf(cmd, sizeof(cmd), KVP_SCRIPTS_PATH "%s %s",
|
||||
- "hv_set_ifconfig", if_file);
|
||||
+ str_len = snprintf(cmd, sizeof(cmd), KVP_SCRIPTS_PATH "%s %s %s",
|
||||
+ "hv_set_ifconfig", if_filename, nm_filename);
|
||||
/*
|
||||
* This is a little overcautious, but it's necessary to suppress some
|
||||
* false warnings from gcc 8.0.1.
|
||||
@@ -1316,14 +1485,16 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
|
||||
|
||||
if (system(cmd)) {
|
||||
syslog(LOG_ERR, "Failed to execute cmd '%s'; error: %d %s",
|
||||
- cmd, errno, strerror(errno));
|
||||
+ cmd, errno, strerror(errno));
|
||||
return HV_E_FAIL;
|
||||
}
|
||||
return 0;
|
||||
-
|
||||
+setmac_error:
|
||||
+ free(mac_addr);
|
||||
setval_error:
|
||||
syslog(LOG_ERR, "Failed to write config file");
|
||||
- fclose(file);
|
||||
+ fclose(ifcfg_file);
|
||||
+ fclose(nmfile);
|
||||
return error;
|
||||
}
|
||||
|
||||
diff --git a/hv_set_ifconfig.sh b/hv_set_ifconfig.sh
|
||||
index fe7fccf..35aae6f 100644
|
||||
--- a/hv_set_ifconfig.sh
|
||||
+++ b/hv_set_ifconfig.sh
|
||||
@@ -18,12 +18,12 @@
|
||||
#
|
||||
# This example script is based on a RHEL environment.
|
||||
#
|
||||
-# Here is the format of the ip configuration file:
|
||||
+# Here is the ifcfg format of the ip configuration file:
|
||||
#
|
||||
# HWADDR=macaddr
|
||||
# DEVICE=interface name
|
||||
# BOOTPROTO=<protocol> (where <protocol> is "dhcp" if DHCP is configured
|
||||
-# or "none" if no boot-time protocol should be used)
|
||||
+# or "none" if no boot-time protocol should be used)
|
||||
#
|
||||
# IPADDR0=ipaddr1
|
||||
# IPADDR1=ipaddr2
|
||||
@@ -41,6 +41,32 @@
|
||||
# tagged as IPV6_DEFAULTGW and IPV6 NETMASK will be tagged as
|
||||
# IPV6NETMASK.
|
||||
#
|
||||
+# Here is the keyfile format of the ip configuration file:
|
||||
+#
|
||||
+# [ethernet]
|
||||
+# mac-address=macaddr
|
||||
+# [connection]
|
||||
+# interface-name=interface name
|
||||
+#
|
||||
+# [ipv4]
|
||||
+# method=<protocol> (where <protocol> is "auto" if DHCP is configured
|
||||
+# or "manual" if no boot-time protocol should be used)
|
||||
+#
|
||||
+# address1=ipaddr1/plen
|
||||
+# address=ipaddr2/plen
|
||||
+#
|
||||
+# gateway=gateway1;gateway2
|
||||
+#
|
||||
+# dns=dns1;
|
||||
+#
|
||||
+# [ipv6]
|
||||
+# address1=ipaddr1/plen
|
||||
+# address2=ipaddr1/plen
|
||||
+#
|
||||
+# gateway=gateway1;gateway2
|
||||
+#
|
||||
+# dns=dns1;dns2
|
||||
+#
|
||||
# The host can specify multiple ipv4 and ipv6 addresses to be
|
||||
# configured for the interface. Furthermore, the configuration
|
||||
# needs to be persistent. A subsequent GET call on the interface
|
||||
--
|
||||
2.39.3
|
||||
|
@ -1,22 +1,19 @@
|
||||
From 2db75ec41c2e346af992f9c00f2e90ed9fec694b Mon Sep 17 00:00:00 2001
|
||||
From ac2132ceaeb611c89eacb468a66f1815ee6fe806 Mon Sep 17 00:00:00 2001
|
||||
From: Till Maas <timaas@redhat.com>
|
||||
Date: Mon, 13 Dec 2021 16:08:42 +0000
|
||||
Subject: [PATCH 1/2] hv_set_ifconfig.sh: Use nmcli commands
|
||||
|
||||
RH-Author: Mohamed Gamal Morsy <mmorsy@redhat.com>
|
||||
RH-Author: Till Maas <None>
|
||||
RH-MergeRequest: 2: hv_set_ifconfig.sh: Use nmcli commands
|
||||
RH-Commit: [1/2] c045f4c849a7d8841c8ad4b6e4ba63abfb946187
|
||||
RH-Bugzilla: 2056566
|
||||
RH-Commit: [1/2] fbb64255b1d96babd362391d53529cef0e449296 (timaas/hyperv-daemons)
|
||||
RH-Bugzilla: 2026371
|
||||
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2056566
|
||||
|
||||
Instead of using deprecated ifup/ifdown commands, use nmcli commands.
|
||||
Taking the connection down is not necessary with NM, so don't do it.
|
||||
|
||||
Signed-off-by: Till Maas <tmaas@redhat.com>
|
||||
Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
|
||||
Resolves: #2026371
|
||||
---
|
||||
hv_set_ifconfig.sh | 7 ++-----
|
||||
1 file changed, 2 insertions(+), 5 deletions(-)
|
@ -1,17 +1,17 @@
|
||||
From 8acc8ecc93352bfb3d78e8d37c5ed03a4948a39d Mon Sep 17 00:00:00 2001
|
||||
From 74730b2187402e29c3c6b4074eae945b7614d1dc Mon Sep 17 00:00:00 2001
|
||||
From: Mohammed Gamal <mgamal@redhat.com>
|
||||
Date: Tue, 8 Nov 2022 16:20:17 +0100
|
||||
Subject: [PATCH] redhat: hv_set_if_config: Workaround for gateway numbering in
|
||||
NetworkManager
|
||||
Subject: [PATCH 1/3] redhat: hv_set_if_config: Workaround for gateway
|
||||
numbering in NetworkManager
|
||||
|
||||
RH-Author: Mohamed Gamal Morsy <mmorsy@redhat.com>
|
||||
RH-MergeRequest: 10: redhat: hv_set_if_config: Workaround for gateway numbering in NetworkManager
|
||||
RH-Bugzilla: 2150255
|
||||
RH-Acked-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
|
||||
RH-Acked-by: Jon Maloy <jmaloy@redhat.com>
|
||||
RH-Commit: [1/1] a52af3c2a8c4365cbe6777fe1afe4ebcf81954d6
|
||||
RH-MergeRequest: 4: redhat: hv_set_if_config: Workaround for gateway numbering in NetworkManager
|
||||
RH-Bugzilla: 2122115
|
||||
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-Acked-by: Cathy Avery <cavery@redhat.com>
|
||||
RH-Commit: [1/1] 5fef25a723094255f3cb25beaa4e18f1ec9d339f
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2150255
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2122115
|
||||
|
||||
Unlike older sysconfig scripts, NetworkManager expects GATEWAYx=ipaddr for all values of x.
|
||||
So the first gateway is GATEWAY0 instead of GATEWAY. Other values should remain unchanged.
|
||||
@ -42,5 +42,5 @@ index 146829b..fe7fccf 100644
|
||||
cp $1 /etc/sysconfig/network-scripts/
|
||||
|
||||
--
|
||||
2.37.3
|
||||
2.31.1
|
||||
|
47
hpvd-tools-hv-Remove-an-extraneous-the.patch
Normal file
47
hpvd-tools-hv-Remove-an-extraneous-the.patch
Normal file
@ -0,0 +1,47 @@
|
||||
From 18888d66ca55ebefbf36dc74ab25c3958d56789b Mon Sep 17 00:00:00 2001
|
||||
From: Mohammed Gamal <mgamal@redhat.com>
|
||||
Date: Thu, 17 Nov 2022 18:56:20 +0100
|
||||
Subject: [PATCH 2/3] tools: hv: Remove an extraneous "the"
|
||||
|
||||
RH-Author: Mohamed Gamal Morsy <mmorsy@redhat.com>
|
||||
RH-MergeRequest: 5: Update hyperv-daemons for RHEL-9.2
|
||||
RH-Bugzilla: 2139457
|
||||
RH-Acked-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
|
||||
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-Commit: [1/2] 53bf20c6a219a20e7a2ae3986a9b2ed43ac4faac
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2139457
|
||||
|
||||
commit f15f39fabed2248311607445ddfa6dba63abebb9
|
||||
Author: Jason Wang <wangborong@cdjrlc.com>
|
||||
Date: Thu Aug 11 21:34:33 2022 +0800
|
||||
|
||||
tools: hv: Remove an extraneous "the"
|
||||
|
||||
There are two "the" in the text. Remove one.
|
||||
|
||||
Signed-off-by: Jason Wang <wangborong@cdjrlc.com>
|
||||
Link: https://lore.kernel.org/r/20220811133433.10175-1-wangborong@cdjrlc.com
|
||||
Signed-off-by: Wei Liu <wei.liu@kernel.org>
|
||||
|
||||
Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
|
||||
---
|
||||
hv_kvp_daemon.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hv_kvp_daemon.c b/hv_kvp_daemon.c
|
||||
index c06c94d..5f98bee 100644
|
||||
--- a/hv_kvp_daemon.c
|
||||
+++ b/hv_kvp_daemon.c
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
/*
|
||||
* KVP protocol: The user mode component first registers with the
|
||||
- * the kernel component. Subsequently, the kernel component requests, data
|
||||
+ * kernel component. Subsequently, the kernel component requests, data
|
||||
* for the specified keys. In response to this message the user mode component
|
||||
* fills in the value corresponding to the specified key. We overload the
|
||||
* sequence field in the cn_msg header to define our KVP message types.
|
||||
--
|
||||
2.31.1
|
||||
|
53
hpvd-tools-hv-kvp-remove-unnecessary-void-conversions.patch
Normal file
53
hpvd-tools-hv-kvp-remove-unnecessary-void-conversions.patch
Normal file
@ -0,0 +1,53 @@
|
||||
From 07081e4a9622c042dec1e3c7ffd47722a6dc0337 Mon Sep 17 00:00:00 2001
|
||||
From: Mohammed Gamal <mgamal@redhat.com>
|
||||
Date: Thu, 17 Nov 2022 18:58:31 +0100
|
||||
Subject: [PATCH 3/3] tools: hv: kvp: remove unnecessary (void*) conversions
|
||||
|
||||
RH-Author: Mohamed Gamal Morsy <mmorsy@redhat.com>
|
||||
RH-MergeRequest: 5: Update hyperv-daemons for RHEL-9.2
|
||||
RH-Bugzilla: 2139457
|
||||
RH-Acked-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
|
||||
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-Commit: [2/2] d3fe2884e899eab164e8b42398db72618b05ec71
|
||||
|
||||
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2139457
|
||||
|
||||
commit 2258954234db7530e9d86bb32cd6ad54485ff926
|
||||
Author: Zhou jie <zhoujie@nfschina.com>
|
||||
Date: Tue Aug 23 11:45:52 2022 +0800
|
||||
|
||||
tools: hv: kvp: remove unnecessary (void*) conversions
|
||||
|
||||
Remove unnecessary void* type casting.
|
||||
|
||||
Signed-off-by: Zhou jie <zhoujie@nfschina.com>
|
||||
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
|
||||
Link: https://lore.kernel.org/r/20220823034552.8596-1-zhoujie@nfschina.com
|
||||
Signed-off-by: Wei Liu <wei.liu@kernel.org>
|
||||
|
||||
Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
|
||||
---
|
||||
hv_kvp_daemon.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/hv_kvp_daemon.c b/hv_kvp_daemon.c
|
||||
index 5f98bee..2ad9af3 100644
|
||||
--- a/hv_kvp_daemon.c
|
||||
+++ b/hv_kvp_daemon.c
|
||||
@@ -772,11 +772,11 @@ static int kvp_process_ip_address(void *addrp,
|
||||
const char *str;
|
||||
|
||||
if (family == AF_INET) {
|
||||
- addr = (struct sockaddr_in *)addrp;
|
||||
+ addr = addrp;
|
||||
str = inet_ntop(family, &addr->sin_addr, tmp, 50);
|
||||
addr_length = INET_ADDRSTRLEN;
|
||||
} else {
|
||||
- addr6 = (struct sockaddr_in6 *)addrp;
|
||||
+ addr6 = addrp;
|
||||
str = inet_ntop(family, &addr6->sin6_addr.s6_addr, tmp, 50);
|
||||
addr_length = INET6_ADDRSTRLEN;
|
||||
}
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,52 @@
|
||||
From 21261cb75d523dd3ac815524e66f53694c1a3c2a Mon Sep 17 00:00:00 2001
|
||||
From: Ani Sinha <anisinha@redhat.com>
|
||||
Date: Wed, 5 Jul 2023 18:44:34 +0530
|
||||
Subject: [PATCH] vmbus_testing: fix wrong python syntax for integer value
|
||||
comparison
|
||||
|
||||
RH-Author: Ani Sinha <None>
|
||||
RH-MergeRequest: 6: vmbus_testing: fix wrong python syntax for interger value comparison
|
||||
RH-Bugzilla: 2218931
|
||||
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
||||
RH-Commit: [1/1] 2887e0ad51a16a499ebdeac29f3086c8be481e0c (anisinha/centos-hyperv-daemons)
|
||||
|
||||
It is incorrect in python to compare integer values using the "is" keyword. The
|
||||
"is" keyword in python is used to compare references to two objects, not their
|
||||
values. Newer version of python3 (version 3.8) throws a warning when such
|
||||
incorrect comparison is made. For value comparison, "==" should be used.
|
||||
|
||||
Fix this in the code and suppress the following warning:
|
||||
|
||||
/usr/sbin/vmbus_testing:167: SyntaxWarning: "is" with a literal. Did you mean "=="?
|
||||
|
||||
RHBZ: 2218931
|
||||
Signed-off-by: Ani Sinha <anisinha@redhat.com>
|
||||
---
|
||||
vmbus_testing | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/vmbus_testing b/vmbus_testing
|
||||
index e721290..4467979 100755
|
||||
--- a/vmbus_testing
|
||||
+++ b/vmbus_testing
|
||||
@@ -164,7 +164,7 @@ def recursive_file_lookup(path, file_map):
|
||||
def get_all_devices_test_status(file_map):
|
||||
|
||||
for device in file_map:
|
||||
- if (get_test_state(locate_state(device, file_map)) is 1):
|
||||
+ if (get_test_state(locate_state(device, file_map)) == 1):
|
||||
print("Testing = ON for: {}"
|
||||
.format(device.split("/")[5]))
|
||||
else:
|
||||
@@ -203,7 +203,7 @@ def write_test_files(path, value):
|
||||
def set_test_state(state_path, state_value, quiet):
|
||||
|
||||
write_test_files(state_path, state_value)
|
||||
- if (get_test_state(state_path) is 1):
|
||||
+ if (get_test_state(state_path) == 1):
|
||||
if (not quiet):
|
||||
print("Testing = ON for device: {}"
|
||||
.format(state_path.split("/")[5]))
|
||||
--
|
||||
2.39.3
|
||||
|
@ -5,7 +5,7 @@
|
||||
# Hyper-V FCOPY daemon binary name
|
||||
%global hv_fcopy_daemon hypervfcopyd
|
||||
# snapshot version
|
||||
%global snapver .20180415git
|
||||
%global snapver .20190303git
|
||||
# use hardened build
|
||||
%global _hardened_build 1
|
||||
# udev rules prefix
|
||||
@ -13,10 +13,9 @@
|
||||
|
||||
Name: hyperv-daemons
|
||||
Version: 0
|
||||
Release: 0.34%{?snapver}%{?dist}
|
||||
Release: 0.43%{?snapver}%{?dist}
|
||||
Summary: Hyper-V daemons suite
|
||||
|
||||
Group: System Environment/Daemons
|
||||
License: GPLv2
|
||||
URL: http://www.kernel.org
|
||||
|
||||
@ -45,31 +44,32 @@ Source202: hypervfcopy.rules
|
||||
# HYPERV TOOLS
|
||||
Source301: lsvmbus
|
||||
|
||||
# Make lsvmbus Python3 compatible
|
||||
Patch0: 0001-tools-hv-update-lsvmbus-to-be-compatible-with-python.patch
|
||||
Patch0002: 0002-Do-not-set-NM_CONTROLLED-no.patch
|
||||
Patch0004: 0004-Update-C-files-and-scripts-to-kernel-version-5.7-rc1.patch
|
||||
Patch0005: 0005-Add-vmbus_testing-tool-build-files.patch
|
||||
Patch0006: 0006-tools-hv-change-http-to-https-in-hv_kvp_daemon.c.patch
|
||||
# For bz#2026371 - [RHEL9][Hyper-V]The /usr/libexec/hypervkvpd/hv_set_ifconfig need update for RHEL9 since the ifdown/ifup was not supported on RHEL9
|
||||
Patch7: hpvd-hv_set_ifconfig.sh-Use-nmcli-commands.patch
|
||||
# For bz#2026371 - [RHEL9][Hyper-V]The /usr/libexec/hypervkvpd/hv_set_ifconfig need update for RHEL9 since the ifdown/ifup was not supported on RHEL9
|
||||
Patch8: hpvd-Use-filename-for-connection-profile.patch
|
||||
# For bz#2122115 - [Hyper-V][RHEL-9] Cannot set gateway properly when set static IPADDR0,NETMASK0,GATEWAY in ifcfg-eth0
|
||||
Patch9: hpvd-redhat-hv_set_if_config-Workaround-for-gateway-numbe.patch
|
||||
# For bz#2139457 - [Hyper-V][RHEL9.2] Update Hyper-V-Daemons
|
||||
Patch10: hpvd-tools-hv-Remove-an-extraneous-the.patch
|
||||
# For bz#2139457 - [Hyper-V][RHEL9.2] Update Hyper-V-Daemons
|
||||
Patch11: hpvd-tools-hv-kvp-remove-unnecessary-void-conversions.patch
|
||||
# For bz#2218931 - [Hyper-V] [RHEL-9] /usr/sbin/vmbus_testing python script prints: "SyntaxWarning: "is" with a literal."
|
||||
Patch12: hpvd-vmbus_testing-fix-wrong-python-syntax-for-integer-va.patch
|
||||
# For RHEL-9902 - [Hyper-V][RHEL-9] hyperv-daemons write incompatible IPv6 prefix (IPV6NETMASK) in ifcfg
|
||||
Patch13: hpvd-hv-hv_kvp_daemon-Support-for-keyfile-based-connectio.patch
|
||||
# For RHEL-9902 - [Hyper-V][RHEL-9] hyperv-daemons write incompatible IPv6 prefix (IPV6NETMASK) in ifcfg
|
||||
Patch14: hpvd-hv-hv_kvp_daemon-Some-small-fixes-for-handling-NM-ke.patch
|
||||
# For RHEL-9902 - [Hyper-V][RHEL-9] hyperv-daemons write incompatible IPv6 prefix (IPV6NETMASK) in ifcfg
|
||||
Patch15: hpvd-hv-hv_kvp_daemon-Handle-IPv4-and-Ipv6-combination-fo.patch
|
||||
# For RHEL-9902 - [Hyper-V][RHEL-9] hyperv-daemons write incompatible IPv6 prefix (IPV6NETMASK) in ifcfg
|
||||
Patch16: hpvd-Changes-for-adding-keyfile-support-in-RHEL-specific-.patch
|
||||
|
||||
# Do not set NM_CONTROLED=no
|
||||
Patch1: 0002-hv_set_ifconfig_nm_enable.patch
|
||||
# For bz#1769920 - [Hyper-V][RHEL8] Running 'systemctl isolate' on any target stops hyperv-daemon services
|
||||
Patch2: hpvd-Set-IgnoreOnIsolate-1-in-systemd-units.patch
|
||||
# For bz#1816750 - [Hyper-V][RHEL8.3] Update Hyper-V tools
|
||||
Patch3: hvd-Update-C-files-and-scripts-to-kernel-version-5.7-rc1.patch
|
||||
# For bz#1816750 - [Hyper-V][RHEL8.3] Update Hyper-V tools
|
||||
Patch4: hvd-Add-vmbus_testing-tool-build-files.patch
|
||||
# For bz#1886104 - [Hyper-V][RHEL8.4] Update Hyper-V-Daemons
|
||||
Patch5: hvd-tools-hv-change-http-to-https-in-hv_kvp_daemon.c.patch
|
||||
# For bz#2056566 - [RHEL8.6][Hyper-V]The /usr/libexec/hypervkvpd/hv_set_ifconfig need update since the ifdown/ifup was not supported on RHEL8
|
||||
Patch6: hpvd-hv_set_ifconfig.sh-Use-nmcli-commands.patch
|
||||
# For bz#2056566 - [RHEL8.6][Hyper-V]The /usr/libexec/hypervkvpd/hv_set_ifconfig need update since the ifdown/ifup was not supported on RHEL8
|
||||
Patch7: hpvd-Use-filename-for-connection-profile.patch
|
||||
# For bz#2115761 - [Hyper-V][RHEL-8] hypervkvpd.service service ordering
|
||||
Patch8: hpvd-hypervkvpd.service-ordering-fixes.patch
|
||||
# For bz#2115761 - [Hyper-V][RHEL-8] hypervkvpd.service service ordering
|
||||
Patch9: hpvd-redhat-Add-ConditionalVirtualization-to-the-rest-of-.patch
|
||||
# For bz#2150255 - [Hyper-V][RHEL-8] Cannot set gateway properly when set static IPADDR0,NETMASK0,GATEWAY in ifcfg-eth0 [rhel-8.7.0.z]
|
||||
Patch10: hpvd-redhat-hv_set_if_config-Workaround-for-gateway-numbe.patch
|
||||
# For bz#2020141 - [Hyper-V][RHEL8.6][ARM64] No hyperv-daemons package built for aarch64 platform
|
||||
# Patch6: hpvd-Enable-build-on-aarch64.patch
|
||||
# Source-git patches
|
||||
|
||||
# Hyper-V is available only on x86 and aarch64 architectures
|
||||
# The base empty (a.k.a. virtual) package can not be noarch
|
||||
@ -81,6 +81,7 @@ Requires: hypervvssd = %{version}-%{release}
|
||||
Requires: hypervfcopyd = %{version}-%{release}
|
||||
BuildRequires: gcc
|
||||
|
||||
|
||||
%description
|
||||
Suite of daemons that are needed when Linux guest
|
||||
is running on Windows Host with Hyper-V.
|
||||
@ -88,7 +89,6 @@ is running on Windows Host with Hyper-V.
|
||||
|
||||
%package -n hypervkvpd
|
||||
Summary: Hyper-V key value pair (KVP) daemon
|
||||
Group: System Environment/Daemons
|
||||
Requires: %{name}-license = %{version}-%{release}
|
||||
BuildRequires: systemd, kernel-headers
|
||||
Requires(post): systemd
|
||||
@ -105,7 +105,6 @@ IP injection functionality on the Guest.
|
||||
|
||||
%package -n hypervvssd
|
||||
Summary: Hyper-V VSS daemon
|
||||
Group: System Environment/Daemons
|
||||
Requires: %{name}-license = %{version}-%{release}
|
||||
BuildRequires: systemd, kernel-headers
|
||||
Requires(post): systemd
|
||||
@ -123,7 +122,6 @@ on the Linux Guest.
|
||||
|
||||
%package -n hypervfcopyd
|
||||
Summary: Hyper-V FCOPY daemon
|
||||
Group: System Environment/Daemons
|
||||
Requires: %{name}-license = %{version}-%{release}
|
||||
BuildRequires: systemd, kernel-headers
|
||||
Requires(post): systemd
|
||||
@ -140,7 +138,6 @@ from Windows Host.
|
||||
|
||||
%package license
|
||||
Summary: License of the Hyper-V daemons suite
|
||||
Group: Applications/System
|
||||
BuildArch: noarch
|
||||
|
||||
%description license
|
||||
@ -148,7 +145,6 @@ Contains license of the Hyper-V daemons suite.
|
||||
|
||||
%package -n hyperv-tools
|
||||
Summary: Tools for Hyper-V guests
|
||||
Group: Applications/System
|
||||
BuildArch: noarch
|
||||
|
||||
%description -n hyperv-tools
|
||||
@ -172,32 +168,34 @@ cp -pvL %{SOURCE201} hypervfcopyd.service
|
||||
cp -pvL %{SOURCE202} hypervfcopy.rules
|
||||
|
||||
cp -pvL %{SOURCE301} lsvmbus
|
||||
%patch0 -p3 -b .lsvmbus_python3
|
||||
|
||||
cp -pvL %{SOURCE4} hv_set_ifconfig.sh
|
||||
%patch1 -p0 -b .hv_set_ifconfig_nm_enable
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch0002 -p1
|
||||
%patch0004 -p1
|
||||
%patch0005 -p1
|
||||
%patch0006 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
%patch14 -p1
|
||||
%patch15 -p1
|
||||
%patch16 -p1
|
||||
|
||||
%build
|
||||
# HYPERV KVP DAEMON
|
||||
gcc $RPM_OPT_FLAGS -c hv_kvp_daemon.c
|
||||
gcc $RPM_LD_FLAGS hv_kvp_daemon.o -o %{hv_kvp_daemon}
|
||||
%{__cc} $RPM_OPT_FLAGS -c hv_kvp_daemon.c
|
||||
%{__cc} $RPM_LD_FLAGS hv_kvp_daemon.o -o %{hv_kvp_daemon}
|
||||
|
||||
# HYPERV VSS DAEMON
|
||||
gcc $RPM_OPT_FLAGS -c hv_vss_daemon.c
|
||||
gcc $RPM_LD_FLAGS hv_vss_daemon.o -o %{hv_vss_daemon}
|
||||
%{__cc} $RPM_OPT_FLAGS -c hv_vss_daemon.c
|
||||
%{__cc} $RPM_LD_FLAGS hv_vss_daemon.o -o %{hv_vss_daemon}
|
||||
|
||||
# HYPERV FCOPY DAEMON
|
||||
gcc $RPM_OPT_FLAGS -c hv_fcopy_daemon.c
|
||||
gcc $RPM_LD_FLAGS hv_fcopy_daemon.o -o %{hv_fcopy_daemon}
|
||||
%{__cc} $RPM_OPT_FLAGS -c hv_fcopy_daemon.c
|
||||
%{__cc} $RPM_LD_FLAGS hv_fcopy_daemon.o -o %{hv_fcopy_daemon}
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
@ -302,49 +300,83 @@ fi
|
||||
%{_sbindir}/vmbus_testing
|
||||
|
||||
%changelog
|
||||
* Mon Dec 05 2022 Jon Maloy <jmaloy@redhat.com> - 0-0.34.20180415git.el8_7
|
||||
- hpvd-redhat-hv_set_if_config-Workaround-for-gateway-numbe.patch [bz#2150255]
|
||||
- Resolves: bz#2150255
|
||||
([Hyper-V][RHEL-8] Cannot set gateway properly when set static IPADDR0,NETMASK0,GATEWAY in ifcfg-eth0 [rhel-8.7.0.z])
|
||||
* Thu Apr 25 2024 Miroslav Rezanina <mrezanin@redhat.com> - 0-0.43.20190303git
|
||||
- hpvd-hv-hv_kvp_daemon-Support-for-keyfile-based-connectio.patch [RHEL-9902]
|
||||
- hpvd-hv-hv_kvp_daemon-Some-small-fixes-for-handling-NM-ke.patch [RHEL-9902]
|
||||
- hpvd-hv-hv_kvp_daemon-Handle-IPv4-and-Ipv6-combination-fo.patch [RHEL-9902]
|
||||
- hpvd-Changes-for-adding-keyfile-support-in-RHEL-specific-.patch [RHEL-9902]
|
||||
- Resolves: RHEL-9902
|
||||
([Hyper-V][RHEL-9] hyperv-daemons write incompatible IPv6 prefix (IPV6NETMASK) in ifcfg)
|
||||
|
||||
* Tue Aug 16 2022 Miroslav Rezanina <mrezanin@redhat.com> - 0-0.33.20180415git
|
||||
- hpvd-hypervkvpd.service-ordering-fixes.patch [bz#2115761]
|
||||
- hpvd-redhat-Add-ConditionalVirtualization-to-the-rest-of-.patch [bz#2115761]
|
||||
- Resolves: bz#2115761
|
||||
([Hyper-V][RHEL-8] hypervkvpd.service service ordering)
|
||||
* Mon Jul 10 2023 Miroslav Rezanina <mrezanin@redhat.com> - 0-0.42.20190303git
|
||||
- hpvd-vmbus_testing-fix-wrong-python-syntax-for-integer-va.patch [bz#2218931]
|
||||
- Resolves: bz#2218931
|
||||
([Hyper-V] [RHEL-9] /usr/sbin/vmbus_testing python script prints: "SyntaxWarning: "is" with a literal.")
|
||||
|
||||
* Tue Mar 22 2022 Jon Maloy <jmaloy@redhat.com> - 0-0.32.20180415git.el8
|
||||
- hpvd-hv_set_ifconfig.sh-Use-nmcli-commands.patch [bz#2065202]
|
||||
- hpvd-Use-filename-for-connection-profile.patch [bz#2065202]
|
||||
- Resolves: bz#2065202
|
||||
([RHEL8.6][Hyper-V]The /usr/libexec/hypervkvpd/hv_set_ifconfig need update since the ifdown/ifup was not supported on RHEL8 [rhel-8.7.0])
|
||||
* Mon Nov 21 2022 Miroslav Rezanina <mrezanin@redhat.com> - 0-0.41.20190303git
|
||||
- hpvd-redhat-hv_set_if_config-Workaround-for-gateway-numbe.patch [bz#2122115]
|
||||
- hpvd-tools-hv-Remove-an-extraneous-the.patch [bz#2139457]
|
||||
- hpvd-tools-hv-kvp-remove-unnecessary-void-conversions.patch [bz#2139457]
|
||||
- Resolves: bz#2122115
|
||||
([Hyper-V][RHEL-9] Cannot set gateway properly when set static IPADDR0,NETMASK0,GATEWAY in ifcfg-eth0)
|
||||
- Resolves: bz#2139457
|
||||
([Hyper-V][RHEL9.2] Update Hyper-V-Daemons)
|
||||
|
||||
* Wed Nov 10 2021 Jon Maloy <jmaloy@redhat.com> - 0-0.31.20180415git.el8
|
||||
- hpvd-Enable-build-on-aarch64.patch [bz#2020141]
|
||||
- Resolves: bz#2020141
|
||||
([Hyper-V][RHEL8.6][ARM64] No hyperv-daemons package built for aarch64 platform)
|
||||
* Fri Jul 29 2022 Miroslav Rezanina <mrezanin@redhat.com> - 0-0.40.20190303git
|
||||
- hpvd-hypervkvpd.service-ordering-fixes.patch [bz#2103188]
|
||||
- Resolves: bz#2103188
|
||||
([Hyper-V][RHEL-9] hypervkvpd.service service ordering)
|
||||
|
||||
* Thu Dec 03 2020 Miroslav Rezanina <mrezanin@redhat.com> - 0-0.30.20180415git.el8
|
||||
- hvd-tools-hv-change-http-to-https-in-hv_kvp_daemon.c.patch [bz#1886104]
|
||||
- Resolves: bz#1886104
|
||||
([Hyper-V][RHEL8.4] Update Hyper-V-Daemons)
|
||||
* Wed Dec 15 2021 Miroslav Rezanina <mrezanin@redhat.com> - 0-0.39.20190303git
|
||||
- hpvd-hv_set_ifconfig.sh-Use-nmcli-commands.patch [bz#2026371]
|
||||
- hpvd-Use-filename-for-connection-profile.patch [bz#2026371]
|
||||
- Resolves: bz#2026371
|
||||
([RHEL9][Hyper-V]The /usr/libexec/hypervkvpd/hv_set_ifconfig need update for RHEL9 since the ifdown/ifup was not supported on RHEL9)
|
||||
|
||||
* Wed Apr 15 2020 Miroslav Rezanina <mrezanin@redhat.com> - 0-0.29.20180415git.el8
|
||||
- hvd-Update-C-files-and-scripts-to-kernel-version-5.7-rc1.patch [bz#1816750]
|
||||
- hvd-Add-vmbus_testing-tool-build-files.patch [bz#1816750]
|
||||
- Resolves: bz#1816750
|
||||
([Hyper-V][RHEL8.3] Update Hyper-V tools)
|
||||
* Mon Nov 08 2021 Miroslav Rezanina <mrezanin@redhat.com> - 0-0.38.20190303git
|
||||
- hpvd-Enable-build-on-aarch64.patch [bz#2020148]
|
||||
- Resolves: bz#2020148
|
||||
([Hyper-V][RHEL9.0][ARM] No hyperv-daemons package built for aarch64 platform)
|
||||
|
||||
* Tue Nov 19 2019 Miroslav Rezanina <mrezanin@redhat.com> - 0-0.28.20180415git.el8
|
||||
- hpvd-Set-IgnoreOnIsolate-1-in-systemd-units.patch [bz#1769920]
|
||||
- Resolves: bz#1769920
|
||||
([Hyper-V][RHEL8] Running 'systemctl isolate' on any target stops hyperv-daemon services)
|
||||
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 0-0.37.20190303git
|
||||
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
|
||||
Related: rhbz#1991688
|
||||
|
||||
* Mon Sep 03 2018 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.27.20180415git
|
||||
- Do not set NM_CONTROLLED=no (#1624355)
|
||||
* Mon May 10 2021 Miroslav Rezanina <mrezanin@redhat.com> - 0-0.36.20190303git
|
||||
- Synchronize RHEL 8 changes [rhbz#1957651]
|
||||
- Resolves: rhbz#1957651
|
||||
([Hyper-V][RHEL-9] Update build to rhel format and syncup RHEL 8 content for hyperv-daemons.)
|
||||
|
||||
* Wed Aug 01 2018 Charalampos Stratakis <cstratak@redhat.com> - 0-0.26.20180415git
|
||||
- Fix python shebangs
|
||||
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 0-0.35.20190303git
|
||||
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
|
||||
|
||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.34.20190303git
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.33.20190303git
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.32.20190303git
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Wed Jan 15 2020 Tom Stellard <tstellar@redhat.com> - 0-0.31.20190303git
|
||||
- Use __cc macro instead of hard-coding gcc
|
||||
|
||||
* Fri Nov 08 2019 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.30.20190303git
|
||||
- Rebase to 5.4-rc6
|
||||
- Add IgnoreOnIsolate to systemd units
|
||||
|
||||
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.29.20190303git
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Fri Mar 15 2019 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.28.20190303git
|
||||
- Rebase to 5.0
|
||||
|
||||
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.27.20180415git
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.26.20180415git
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||
|
||||
* Mon Jun 11 2018 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.25.20180415git
|
||||
- Switch lsvmbus to Python3
|
@ -1,6 +1,7 @@
|
||||
[Unit]
|
||||
Description=Hyper-V FCOPY daemon
|
||||
BindsTo=sys-devices-virtual-misc-vmbus\x21hv_fcopy.device
|
||||
IgnoreOnIsolate=1
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/sbin/hypervfcopyd -n
|
12
hypervkvpd.service
Normal file
12
hypervkvpd.service
Normal file
@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=Hyper-V KVP daemon
|
||||
ConditionVirtualization=microsoft
|
||||
BindsTo=sys-devices-virtual-misc-vmbus\x21hv_kvp.device
|
||||
After=sys-devices-virtual-misc-vmbus\x21hv_kvp.device
|
||||
RequiresMountsFor=/var/lib/hyperv
|
||||
Before=cloud-init-local.service
|
||||
IgnoreOnIsolate=1
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/sbin/hypervkvpd -n
|
@ -1,6 +1,7 @@
|
||||
[Unit]
|
||||
Description=Hyper-V VSS daemon
|
||||
BindsTo=sys-devices-virtual-misc-vmbus\x21hv_vss.device
|
||||
IgnoreOnIsolate=1
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/sbin/hypervvssd -n
|
8
sources
Normal file
8
sources
Normal file
@ -0,0 +1,8 @@
|
||||
SHA512 (hv_get_dhcp_info.sh) = 4a9503f2a368cc078e00cdc7d3313d3e6f9c8e18c68e6b9ba0a1b6e4c8c0dbf8183d33158588097b275b7afba08d548187e27cdde05e3321065251389b1bdc63
|
||||
SHA512 (hv_get_dns_info.sh) = 876effabea3ffe1daaa9c68dfa9b254d740003716f081aa524a1bdbd81724f744bd9dd900f2fdd94764d67584d3e853b26576aa8b53d6f6df94b12702a167428
|
||||
SHA512 (hv_kvp_daemon.c) = a9c1d1f2d4829d7796fb16b3fe36d2707df0fb6beb430b8b778ee6c65734a04fc9fd5bd22cb63627cb9574a1d7afa18fe3e1d26b56e0ec49130e2b40d1845133
|
||||
SHA512 (hv_set_ifconfig.sh) = da6bbd90a265ebab7f63985c57ba8a19c1a9e3ca1e15f361663ec166c85647ecfb89e805a9b51134ebcd896b98a9dc4e2104665d3a0d2f3b5494e61cffbd8d86
|
||||
SHA512 (hv_vss_daemon.c) = bf18b77a2bde83a41837744b578f225f97caae47f2c82e83567a11e87a449d1814586d0a9aa149b4b0512710dfa0db6ebe14c7079740d99cd208f9b670f62164
|
||||
SHA512 (hv_fcopy_daemon.c) = d69d8fb82f84d2044e6e02a104c7aa3da8c09e8f7d7b42e7d79ba6ff52a01ff4602f0dea6bf2189709c568c280393e160aaa750c539a3ac7a1282bd401be2c42
|
||||
SHA512 (COPYING) = fbb1e0f29741e900a81ccbe76102103365423d310e9987dfc5858174999911037a9ad48270a3d0b86f245e91868ed73813ca273584be43816f53517858f3aabd
|
||||
SHA512 (lsvmbus) = 43be38dd1ef8b2864a3f37a29a440478a69879ea4882a7ded8e42c2464b7325c1b0da3c7e001154da5f892641b6f60d75e7dbab287a9e9cfcf9567ea9eeec8e0
|
Loading…
Reference in New Issue
Block a user