Accepting request 305763 from Virtualization
Automatic submission by obs-autosubmit OBS-URL: https://build.opensuse.org/request/show/305763 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/hyper-v?expand=0&rev=31
This commit is contained in:
commit
e7ed435837
@ -1,3 +1,13 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Apr 30 11:25:47 UTC 2015 - ohering@suse.de
|
||||||
|
|
||||||
|
- hv: hypervvssd: call endmntent before call setmntent again
|
||||||
|
- remove unused bytes_written from kvp_update_file()
|
||||||
|
- address compiler warnings for hv_kvp_daemon.c
|
||||||
|
- kvp_daemon: make IPv6-only-injection work
|
||||||
|
- address compiler warnings for hv_fcopy_daemon.c
|
||||||
|
- do not add redundant '/' in hv_start_fcopy()
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Apr 16 15:23:18 UTC 2015 - ohering@suse.de
|
Thu Apr 16 15:23:18 UTC 2015 - ohering@suse.de
|
||||||
|
|
||||||
|
@ -43,15 +43,9 @@ static int hv_start_fcopy(struct hv_start_fcopy *smsg)
|
|||||||
int error = HV_E_FAIL;
|
int error = HV_E_FAIL;
|
||||||
char *q, *p;
|
char *q, *p;
|
||||||
|
|
||||||
/*
|
|
||||||
* If possile append a path seperator to the path.
|
|
||||||
*/
|
|
||||||
if (strlen((char *)smsg->path_name) < (W_MAX_PATH - 2))
|
|
||||||
strcat((char *)smsg->path_name, "/");
|
|
||||||
|
|
||||||
p = (char *)smsg->path_name;
|
p = (char *)smsg->path_name;
|
||||||
snprintf(target_fname, sizeof(target_fname), "%s/%s",
|
snprintf(target_fname, sizeof(target_fname), "%s/%s",
|
||||||
(char *)smsg->path_name, smsg->file_name);
|
(char *)smsg->path_name, (char *)smsg->file_name);
|
||||||
|
|
||||||
syslog(LOG_INFO, "Target file name: %s", target_fname);
|
syslog(LOG_INFO, "Target file name: %s", target_fname);
|
||||||
/*
|
/*
|
||||||
@ -137,7 +131,7 @@ void print_usage(char *argv[])
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int fd, fcopy_fd, len;
|
int fcopy_fd, len;
|
||||||
int error;
|
int error;
|
||||||
int daemonize = 1, long_index = 0, opt;
|
int daemonize = 1, long_index = 0, opt;
|
||||||
int version = FCOPY_CURRENT_VERSION;
|
int version = FCOPY_CURRENT_VERSION;
|
||||||
|
@ -148,7 +148,6 @@ static void kvp_release_lock(int pool)
|
|||||||
static void kvp_update_file(int pool)
|
static void kvp_update_file(int pool)
|
||||||
{
|
{
|
||||||
FILE *filep;
|
FILE *filep;
|
||||||
size_t bytes_written;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We are going to write our in-memory registry out to
|
* We are going to write our in-memory registry out to
|
||||||
@ -164,8 +163,7 @@ static void kvp_update_file(int pool)
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes_written = fwrite(kvp_file_info[pool].records,
|
fwrite(kvp_file_info[pool].records, sizeof(struct kvp_record),
|
||||||
sizeof(struct kvp_record),
|
|
||||||
kvp_file_info[pool].num_records, filep);
|
kvp_file_info[pool].num_records, filep);
|
||||||
|
|
||||||
if (ferror(filep) || fclose(filep)) {
|
if (ferror(filep) || fclose(filep)) {
|
||||||
@ -311,7 +309,7 @@ static int kvp_file_init(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int kvp_key_delete(int pool, const char *key, int key_size)
|
static int kvp_key_delete(int pool, const __u8 *key, int key_size)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int j, k;
|
int j, k;
|
||||||
@ -354,8 +352,8 @@ static int kvp_key_delete(int pool, const char *key, int key_size)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int kvp_key_add_or_modify(int pool, const char *key, int key_size, const char *value,
|
static int kvp_key_add_or_modify(int pool, const __u8 *key, int key_size,
|
||||||
int value_size)
|
const __u8 *value, int value_size)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int num_records;
|
int num_records;
|
||||||
@ -408,7 +406,7 @@ static int kvp_key_add_or_modify(int pool, const char *key, int key_size, const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int kvp_get_value(int pool, const char *key, int key_size, char *value,
|
static int kvp_get_value(int pool, const __u8 *key, int key_size, __u8 *value,
|
||||||
int value_size)
|
int value_size)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -440,8 +438,8 @@ static int kvp_get_value(int pool, const char *key, int key_size, char *value,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int kvp_pool_enumerate(int pool, int index, char *key, int key_size,
|
static int kvp_pool_enumerate(int pool, int index, __u8 *key, int key_size,
|
||||||
char *value, int value_size)
|
__u8 *value, int value_size)
|
||||||
{
|
{
|
||||||
struct kvp_record *record;
|
struct kvp_record *record;
|
||||||
|
|
||||||
@ -662,7 +660,7 @@ static char *kvp_if_name_to_mac(char *if_name)
|
|||||||
char *p, *x;
|
char *p, *x;
|
||||||
char buf[256];
|
char buf[256];
|
||||||
char addr_file[256];
|
char addr_file[256];
|
||||||
int i;
|
unsigned int i;
|
||||||
char *mac_addr = NULL;
|
char *mac_addr = NULL;
|
||||||
|
|
||||||
snprintf(addr_file, sizeof(addr_file), "%s%s%s", "/sys/class/net/",
|
snprintf(addr_file, sizeof(addr_file), "%s%s%s", "/sys/class/net/",
|
||||||
@ -701,7 +699,7 @@ static char *kvp_mac_to_if_name(char *mac)
|
|||||||
char buf[256];
|
char buf[256];
|
||||||
char *kvp_net_dir = "/sys/class/net/";
|
char *kvp_net_dir = "/sys/class/net/";
|
||||||
char dev_id[256];
|
char dev_id[256];
|
||||||
int i;
|
unsigned int i;
|
||||||
|
|
||||||
dir = opendir(kvp_net_dir);
|
dir = opendir(kvp_net_dir);
|
||||||
if (dir == NULL)
|
if (dir == NULL)
|
||||||
@ -751,7 +749,7 @@ static char *kvp_mac_to_if_name(char *mac)
|
|||||||
|
|
||||||
|
|
||||||
static void kvp_process_ipconfig_file(char *cmd,
|
static void kvp_process_ipconfig_file(char *cmd,
|
||||||
char *config_buf, int len,
|
char *config_buf, unsigned int len,
|
||||||
int element_size, int offset)
|
int element_size, int offset)
|
||||||
{
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
@ -769,7 +767,7 @@ static void kvp_process_ipconfig_file(char *cmd,
|
|||||||
if (offset == 0)
|
if (offset == 0)
|
||||||
memset(config_buf, 0, len);
|
memset(config_buf, 0, len);
|
||||||
while ((p = fgets(buf, sizeof(buf), file)) != NULL) {
|
while ((p = fgets(buf, sizeof(buf), file)) != NULL) {
|
||||||
if ((len - strlen(config_buf)) < (element_size + 1))
|
if (len < strlen(config_buf) + element_size + 1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
x = strchr(p, '\n');
|
x = strchr(p, '\n');
|
||||||
@ -917,7 +915,7 @@ static int kvp_process_ip_address(void *addrp,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
kvp_get_ip_info(int family, char *if_name, int op,
|
kvp_get_ip_info(int family, char *if_name, int op,
|
||||||
void *out_buffer, int length)
|
void *out_buffer, unsigned int length)
|
||||||
{
|
{
|
||||||
struct ifaddrs *ifap;
|
struct ifaddrs *ifap;
|
||||||
struct ifaddrs *curp;
|
struct ifaddrs *curp;
|
||||||
@ -1020,8 +1018,7 @@ kvp_get_ip_info(int family, char *if_name, int op,
|
|||||||
weight += hweight32(&w[i]);
|
weight += hweight32(&w[i]);
|
||||||
|
|
||||||
sprintf(cidr_mask, "/%d", weight);
|
sprintf(cidr_mask, "/%d", weight);
|
||||||
if ((length - sn_offset) <
|
if (length < sn_offset + strlen(cidr_mask) + 1)
|
||||||
(strlen(cidr_mask) + 1))
|
|
||||||
goto gather_ipaddr;
|
goto gather_ipaddr;
|
||||||
|
|
||||||
if (sn_offset == 0)
|
if (sn_offset == 0)
|
||||||
@ -1309,16 +1306,17 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
|
|||||||
if (error)
|
if (error)
|
||||||
goto setval_error;
|
goto setval_error;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The dhcp_enabled flag is only for IPv4. In the case the host only
|
||||||
|
* injects an IPv6 address, the flag is true, but we still need to
|
||||||
|
* proceed to parse and pass the IPv6 information to the
|
||||||
|
* disto-specific script hv_set_ifconfig.
|
||||||
|
*/
|
||||||
if (new_val->dhcp_enabled) {
|
if (new_val->dhcp_enabled) {
|
||||||
error = kvp_write_file(file, "BOOTPROTO", "", "dhcp");
|
error = kvp_write_file(file, "BOOTPROTO", "", "dhcp");
|
||||||
if (error)
|
if (error)
|
||||||
goto setval_error;
|
goto setval_error;
|
||||||
|
|
||||||
/*
|
|
||||||
* We are done!.
|
|
||||||
*/
|
|
||||||
goto setval_done;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
error = kvp_write_file(file, "BOOTPROTO", "", "none");
|
error = kvp_write_file(file, "BOOTPROTO", "", "none");
|
||||||
if (error)
|
if (error)
|
||||||
@ -1346,7 +1344,6 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
|
|||||||
if (error)
|
if (error)
|
||||||
goto setval_error;
|
goto setval_error;
|
||||||
|
|
||||||
setval_done:
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -82,6 +82,7 @@ static int vss_operate(int operation)
|
|||||||
char match[] = "/dev/";
|
char match[] = "/dev/";
|
||||||
FILE *mounts;
|
FILE *mounts;
|
||||||
struct mntent *ent;
|
struct mntent *ent;
|
||||||
|
char errdir[1024] = {0};
|
||||||
unsigned int cmd;
|
unsigned int cmd;
|
||||||
int error = 0, root_seen = 0, save_errno = 0;
|
int error = 0, root_seen = 0, save_errno = 0;
|
||||||
|
|
||||||
@ -116,6 +117,8 @@ static int vss_operate(int operation)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
endmntent(mounts);
|
||||||
|
|
||||||
if (root_seen) {
|
if (root_seen) {
|
||||||
error |= vss_do_freeze("/", cmd);
|
error |= vss_do_freeze("/", cmd);
|
||||||
if (error && operation == VSS_OP_FREEZE)
|
if (error && operation == VSS_OP_FREEZE)
|
||||||
@ -125,16 +128,19 @@ static int vss_operate(int operation)
|
|||||||
goto out;
|
goto out;
|
||||||
err:
|
err:
|
||||||
save_errno = errno;
|
save_errno = errno;
|
||||||
|
if (ent) {
|
||||||
|
strncpy(errdir, ent->mnt_dir, sizeof(errdir)-1);
|
||||||
|
endmntent(mounts);
|
||||||
|
}
|
||||||
vss_operate(VSS_OP_THAW);
|
vss_operate(VSS_OP_THAW);
|
||||||
/* Call syslog after we thaw all filesystems */
|
/* Call syslog after we thaw all filesystems */
|
||||||
if (ent)
|
if (ent)
|
||||||
syslog(LOG_ERR, "FREEZE of %s failed; error:%d %s",
|
syslog(LOG_ERR, "FREEZE of %s failed; error:%d %s",
|
||||||
ent->mnt_dir, save_errno, strerror(save_errno));
|
errdir, save_errno, strerror(save_errno));
|
||||||
else
|
else
|
||||||
syslog(LOG_ERR, "FREEZE of / failed; error:%d %s", save_errno,
|
syslog(LOG_ERR, "FREEZE of / failed; error:%d %s", save_errno,
|
||||||
strerror(save_errno));
|
strerror(save_errno));
|
||||||
out:
|
out:
|
||||||
endmntent(mounts);
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user