Accepting request 265533 from Virtualization

- Start hv_kvp_daemon after network-online.target (bnc#910353)
- ignore ENOBUFS and ENOMEM in the KVP daemon
- vssdaemon: skip all filesystems mounted readonly (bnc#909864)
- vssdaemon: report freeze errors

OBS-URL: https://build.opensuse.org/request/show/265533
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/hyper-v?expand=0&rev=28
This commit is contained in:
Dominique Leuenberger 2014-12-19 08:38:05 +00:00 committed by Git OBS Bridge
commit 5ea24ccc95
4 changed files with 41 additions and 11 deletions

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Wed Dec 17 09:06:33 UTC 2014 - ohering@suse.de
- Start hv_kvp_daemon after network-online.target (bnc#910353)
- ignore ENOBUFS and ENOMEM in the KVP daemon
- vssdaemon: skip all filesystems mounted readonly (bnc#909864)
- vssdaemon: report freeze errors
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Nov 25 17:46:30 UTC 2014 - ohering@suse.de Tue Nov 25 17:46:30 UTC 2014 - ohering@suse.de

View File

@ -129,15 +129,17 @@ cat > ${d}/%{hv_kvp_daemon}.service <<EOF
# started via %{_udevrulesdir}/%{hv_kvp_daemon}.rules # started via %{_udevrulesdir}/%{hv_kvp_daemon}.rules
[Unit] [Unit]
Description=Hyper-V KVP Daemon Description=Hyper-V KVP Daemon
# During startup the current hostname is cached, so start very late
Requires=network-online.target
After=network-online.target
ConditionVirtualization=microsoft ConditionVirtualization=microsoft
[Service] [Service]
Environment="PATH=%{helper_dir}/bin:/usr/sbin:/usr/bin:/sbin:/bin" Environment="PATH=%{helper_dir}/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Type=forking
# Restart appears to work, but its unsupported # Restart appears to work, but its unsupported
# Reboot required until kernel-user protocol is fixed # Reboot required until kernel-user protocol is fixed
ExecStartPre=/usr/bin/mkdir /run/%{hv_kvp_daemon} ExecStartPre=/usr/bin/mkdir /run/%{hv_kvp_daemon}
ExecStart=${bindir}/%{hv_kvp_daemon} ExecStart=${bindir}/%{hv_kvp_daemon} --no-daemon
ExecReload=/usr/bin/false ExecReload=/usr/bin/false
Restart=no Restart=no
@ -152,11 +154,10 @@ Description=Hyper-V VSS Daemon
ConditionVirtualization=microsoft ConditionVirtualization=microsoft
[Service] [Service]
Type=forking
# Restart appears to work, but its unsupported # Restart appears to work, but its unsupported
# Reboot required until kernel-user protocol is fixed # Reboot required until kernel-user protocol is fixed
ExecStartPre=/usr/bin/mkdir /run/%{hv_vss_daemon} ExecStartPre=/usr/bin/mkdir /run/%{hv_vss_daemon}
ExecStart=${bindir}/%{hv_vss_daemon} ExecStart=${bindir}/%{hv_vss_daemon} --no-daemon
ExecReload=/usr/bin/false ExecReload=/usr/bin/false
Restart=no Restart=no
@ -171,8 +172,7 @@ Description=Hyper-V host to guest file copy daemon
ConditionVirtualization=microsoft ConditionVirtualization=microsoft
[Service] [Service]
Type=forking ExecStart=${bindir}/%{hv_fcopy_daemon} --no-daemon
ExecStart=${bindir}/%{hv_fcopy_daemon}
[Install] [Install]
WantedBy=default.target WantedBy=default.target

View File

@ -1561,8 +1561,15 @@ int main(int argc, char *argv[])
addr_p, &addr_l); addr_p, &addr_l);
if (len < 0) { if (len < 0) {
int saved_errno = errno;
syslog(LOG_ERR, "recvfrom failed; pid:%u error:%d %s", syslog(LOG_ERR, "recvfrom failed; pid:%u error:%d %s",
addr.nl_pid, errno, strerror(errno)); addr.nl_pid, errno, strerror(errno));
if (saved_errno == ENOBUFS) {
syslog(LOG_ERR, "receive error: ignored");
continue;
}
close(fd); close(fd);
return -1; return -1;
} }
@ -1765,8 +1772,15 @@ kvp_done:
len = netlink_send(fd, incoming_cn_msg); len = netlink_send(fd, incoming_cn_msg);
if (len < 0) { if (len < 0) {
int saved_errno = errno;
syslog(LOG_ERR, "net_link send failed; error: %d %s", errno, syslog(LOG_ERR, "net_link send failed; error: %d %s", errno,
strerror(errno)); strerror(errno));
if (saved_errno == ENOMEM || saved_errno == ENOBUFS) {
syslog(LOG_ERR, "send error: ignored");
continue;
}
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }

View File

@ -83,7 +83,7 @@ static int vss_operate(int operation)
FILE *mounts; FILE *mounts;
struct mntent *ent; struct mntent *ent;
unsigned int cmd; unsigned int cmd;
int error = 0, root_seen = 0; int error = 0, root_seen = 0, save_errno = 0;
switch (operation) { switch (operation) {
case VSS_OP_FREEZE: case VSS_OP_FREEZE:
@ -103,7 +103,7 @@ static int vss_operate(int operation)
while ((ent = getmntent(mounts))) { while ((ent = getmntent(mounts))) {
if (strncmp(ent->mnt_fsname, match, strlen(match))) if (strncmp(ent->mnt_fsname, match, strlen(match)))
continue; continue;
if (strcmp(ent->mnt_type, "iso9660") == 0) if (hasmntopt(ent, MNTOPT_RO) != NULL)
continue; continue;
if (strcmp(ent->mnt_type, "vfat") == 0) if (strcmp(ent->mnt_type, "vfat") == 0)
continue; continue;
@ -115,7 +115,6 @@ static int vss_operate(int operation)
if (error && operation == VSS_OP_FREEZE) if (error && operation == VSS_OP_FREEZE)
goto err; goto err;
} }
endmntent(mounts);
if (root_seen) { if (root_seen) {
error |= vss_do_freeze("/", cmd); error |= vss_do_freeze("/", cmd);
@ -123,10 +122,19 @@ static int vss_operate(int operation)
goto err; goto err;
} }
return error; goto out;
err: err:
endmntent(mounts); save_errno = errno;
vss_operate(VSS_OP_THAW); vss_operate(VSS_OP_THAW);
/* Call syslog after we thaw all filesystems */
if (ent)
syslog(LOG_ERR, "FREEZE of %s failed; error:%d %s",
ent->mnt_dir, save_errno, strerror(save_errno));
else
syslog(LOG_ERR, "FREEZE of / failed; error:%d %s", save_errno,
strerror(save_errno));
out:
endmntent(mounts);
return error; return error;
} }