- update hv_kvp_daemon
Use CLOEXEC when opening kvp_pool files Fix permissions of created directory and files Fix /var subdirectory (move state files from /var/opt to /var/lib) Fix string types OBS-URL: https://build.opensuse.org/package/show/Virtualization/hyper-v?expand=0&rev=53
This commit is contained in:
parent
7d052ac13f
commit
04cc92c36e
@ -1,3 +1,12 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Mar 22 16:19:38 CET 2013 - ohering@suse.de
|
||||||
|
|
||||||
|
- update hv_kvp_daemon
|
||||||
|
Use CLOEXEC when opening kvp_pool files
|
||||||
|
Fix permissions of created directory and files
|
||||||
|
Fix /var subdirectory (move state files from /var/opt to /var/lib)
|
||||||
|
Fix string types
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Nov 27 11:19:32 CET 2012 - ohering@suse.de
|
Tue Nov 27 11:19:32 CET 2012 - ohering@suse.de
|
||||||
|
|
||||||
|
22
hyper-v.spec
22
hyper-v.spec
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package hyper-v
|
# spec file for package hyper-v
|
||||||
#
|
#
|
||||||
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -21,6 +21,7 @@
|
|||||||
Name: hyper-v
|
Name: hyper-v
|
||||||
ExclusiveArch: %ix86 x86_64
|
ExclusiveArch: %ix86 x86_64
|
||||||
PreReq: %insserv_prereq
|
PreReq: %insserv_prereq
|
||||||
|
Requires(pre): coreutils
|
||||||
Summary: Microsoft Hyper-V tools
|
Summary: Microsoft Hyper-V tools
|
||||||
License: GPL-2.0
|
License: GPL-2.0
|
||||||
Group: System/Kernel
|
Group: System/Kernel
|
||||||
@ -81,6 +82,25 @@ ln -sfvbn ../../etc/init.d/%{hv_kvp_daemon} $RPM_BUILD_ROOT/usr/sbin/rc%{hv_kvp_
|
|||||||
/usr/sbin/%{hv_kvp_daemon}
|
/usr/sbin/%{hv_kvp_daemon}
|
||||||
/usr/lib/%{name}
|
/usr/lib/%{name}
|
||||||
|
|
||||||
|
%pre
|
||||||
|
# hv_kvp_daemon in SLES11 SP2 stored temporary state files in /var/opt
|
||||||
|
# move them to /var/lib and remove old directory, if possible.
|
||||||
|
if test -d /var/opt/hyperv
|
||||||
|
then
|
||||||
|
if mkdir -p -v -m 0755 /var/lib/hyperv && pushd /var/lib/hyperv > /dev/null
|
||||||
|
then
|
||||||
|
for oldfile in /var/opt/hyperv/ifcfg-* /var/opt/hyperv/.kvp_pool_*
|
||||||
|
do
|
||||||
|
if test -e "${oldfile}"
|
||||||
|
then
|
||||||
|
mv -vfb "${oldfile}" . || :
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
|
rmdir -v /var/opt/hyperv || :
|
||||||
|
fi
|
||||||
|
|
||||||
%post
|
%post
|
||||||
board_vendor=
|
board_vendor=
|
||||||
product_name=
|
product_name=
|
||||||
|
@ -97,7 +97,7 @@ static struct utsname uts_buf;
|
|||||||
* The location of the interface configuration file.
|
* The location of the interface configuration file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define KVP_CONFIG_LOC "/var/opt/"
|
#define KVP_CONFIG_LOC "/var/lib/hyperv"
|
||||||
|
|
||||||
#define MAX_FILE_NAME 100
|
#define MAX_FILE_NAME 100
|
||||||
#define ENTRIES_PER_BLOCK 50
|
#define ENTRIES_PER_BLOCK 50
|
||||||
@ -151,7 +151,7 @@ static void kvp_update_file(int pool)
|
|||||||
*/
|
*/
|
||||||
kvp_acquire_lock(pool);
|
kvp_acquire_lock(pool);
|
||||||
|
|
||||||
filep = fopen(kvp_file_info[pool].fname, "w");
|
filep = fopen(kvp_file_info[pool].fname, "we");
|
||||||
if (!filep) {
|
if (!filep) {
|
||||||
kvp_release_lock(pool);
|
kvp_release_lock(pool);
|
||||||
syslog(LOG_ERR, "Failed to open file, pool: %d", pool);
|
syslog(LOG_ERR, "Failed to open file, pool: %d", pool);
|
||||||
@ -182,7 +182,7 @@ static void kvp_update_mem_state(int pool)
|
|||||||
|
|
||||||
kvp_acquire_lock(pool);
|
kvp_acquire_lock(pool);
|
||||||
|
|
||||||
filep = fopen(kvp_file_info[pool].fname, "r");
|
filep = fopen(kvp_file_info[pool].fname, "re");
|
||||||
if (!filep) {
|
if (!filep) {
|
||||||
kvp_release_lock(pool);
|
kvp_release_lock(pool);
|
||||||
syslog(LOG_ERR, "Failed to open file, pool: %d", pool);
|
syslog(LOG_ERR, "Failed to open file, pool: %d", pool);
|
||||||
@ -234,9 +234,9 @@ static int kvp_file_init(void)
|
|||||||
int i;
|
int i;
|
||||||
int alloc_unit = sizeof(struct kvp_record) * ENTRIES_PER_BLOCK;
|
int alloc_unit = sizeof(struct kvp_record) * ENTRIES_PER_BLOCK;
|
||||||
|
|
||||||
if (access("/var/opt/hyperv", F_OK)) {
|
if (access(KVP_CONFIG_LOC, F_OK)) {
|
||||||
if (mkdir("/var/opt/hyperv", S_IRUSR | S_IWUSR | S_IROTH)) {
|
if (mkdir(KVP_CONFIG_LOC, 0755 /* rwxr-xr-x */)) {
|
||||||
syslog(LOG_ERR, " Failed to create /var/opt/hyperv");
|
syslog(LOG_ERR, " Failed to create %s", KVP_CONFIG_LOC);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -245,14 +245,14 @@ static int kvp_file_init(void)
|
|||||||
fname = kvp_file_info[i].fname;
|
fname = kvp_file_info[i].fname;
|
||||||
records_read = 0;
|
records_read = 0;
|
||||||
num_blocks = 1;
|
num_blocks = 1;
|
||||||
sprintf(fname, "/var/opt/hyperv/.kvp_pool_%d", i);
|
sprintf(fname, "%s/.kvp_pool_%d", KVP_CONFIG_LOC, i);
|
||||||
fd = open(fname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IROTH);
|
fd = open(fname, O_RDWR | O_CREAT | O_CLOEXEC, 0644 /* rw-r--r-- */);
|
||||||
|
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|
||||||
filep = fopen(fname, "r");
|
filep = fopen(fname, "re");
|
||||||
if (!filep)
|
if (!filep)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -299,7 +299,7 @@ static int kvp_file_init(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int kvp_key_delete(int pool, __u8 *key, int key_size)
|
static int kvp_key_delete(int pool, const char *key, int key_size)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int j, k;
|
int j, k;
|
||||||
@ -342,7 +342,7 @@ static int kvp_key_delete(int pool, __u8 *key, int key_size)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int kvp_key_add_or_modify(int pool, __u8 *key, int key_size, __u8 *value,
|
static int kvp_key_add_or_modify(int pool, const char *key, int key_size, const char *value,
|
||||||
int value_size)
|
int value_size)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -396,7 +396,7 @@ static int kvp_key_add_or_modify(int pool, __u8 *key, int key_size, __u8 *value,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int kvp_get_value(int pool, __u8 *key, int key_size, __u8 *value,
|
static int kvp_get_value(int pool, const char *key, int key_size, char *value,
|
||||||
int value_size)
|
int value_size)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -428,8 +428,8 @@ static int kvp_get_value(int pool, __u8 *key, int key_size, __u8 *value,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int kvp_pool_enumerate(int pool, int index, __u8 *key, int key_size,
|
static int kvp_pool_enumerate(int pool, int index, char *key, int key_size,
|
||||||
__u8 *value, int value_size)
|
char *value, int value_size)
|
||||||
{
|
{
|
||||||
struct kvp_record *record;
|
struct kvp_record *record;
|
||||||
|
|
||||||
@ -1271,7 +1271,7 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
snprintf(if_file, sizeof(if_file), "%s%s%s", KVP_CONFIG_LOC,
|
snprintf(if_file, sizeof(if_file), "%s%s%s", KVP_CONFIG_LOC,
|
||||||
"hyperv/ifcfg-", if_name);
|
"/ifcfg-", if_name);
|
||||||
|
|
||||||
file = fopen(if_file, "w");
|
file = fopen(if_file, "w");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user