import hyperv-daemons-0-0.27.20180415git.el8
This commit is contained in:
commit
2d08d7e935
0
.gitignore
vendored
Normal file
0
.gitignore
vendored
Normal file
0
.hyperv-daemons.metadata
Normal file
0
.hyperv-daemons.metadata
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
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
|
||||||
|
|
10
SOURCES/0002-hv_set_ifconfig_nm_enable.patch
Normal file
10
SOURCES/0002-hv_set_ifconfig_nm_enable.patch
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
--- 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
Normal file
356
SOURCES/COPYING
Normal file
@ -0,0 +1,356 @@
|
|||||||
|
|
||||||
|
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.
|
247
SOURCES/hv_fcopy_daemon.c
Normal file
247
SOURCES/hv_fcopy_daemon.c
Normal file
@ -0,0 +1,247 @@
|
|||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
29
SOURCES/hv_get_dhcp_info.sh
Normal file
29
SOURCES/hv_get_dhcp_info.sh
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#!/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
|
13
SOURCES/hv_get_dns_info.sh
Normal file
13
SOURCES/hv_get_dns_info.sh
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#!/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 }'
|
1619
SOURCES/hv_kvp_daemon.c
Normal file
1619
SOURCES/hv_kvp_daemon.c
Normal file
File diff suppressed because it is too large
Load Diff
65
SOURCES/hv_set_ifconfig.sh
Normal file
65
SOURCES/hv_set_ifconfig.sh
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
#!/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
|
280
SOURCES/hv_vss_daemon.c
Normal file
280
SOURCES/hv_vss_daemon.c
Normal file
@ -0,0 +1,280 @@
|
|||||||
|
/*
|
||||||
|
* 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
SOURCES/hypervfcopy.rules
Normal file
1
SOURCES/hypervfcopy.rules
Normal file
@ -0,0 +1 @@
|
|||||||
|
SUBSYSTEM=="misc", KERNEL=="vmbus/hv_fcopy", TAG+="systemd", ENV{SYSTEMD_WANTS}+="hypervfcopyd.service"
|
6
SOURCES/hypervfcopyd.service
Normal file
6
SOURCES/hypervfcopyd.service
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Hyper-V FCOPY daemon
|
||||||
|
BindsTo=sys-devices-virtual-misc-vmbus\x21hv_fcopy.device
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usr/sbin/hypervfcopyd -n
|
1
SOURCES/hypervkvp.rules
Normal file
1
SOURCES/hypervkvp.rules
Normal file
@ -0,0 +1 @@
|
|||||||
|
SUBSYSTEM=="misc", KERNEL=="vmbus/hv_kvp", TAG+="systemd", ENV{SYSTEMD_WANTS}+="hypervkvpd.service"
|
8
SOURCES/hypervkvpd.service
Normal file
8
SOURCES/hypervkvpd.service
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[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
|
1
SOURCES/hypervvss.rules
Normal file
1
SOURCES/hypervvss.rules
Normal file
@ -0,0 +1 @@
|
|||||||
|
SUBSYSTEM=="misc", KERNEL=="vmbus/hv_vss", TAG+="systemd", ENV{SYSTEMD_WANTS}+="hypervvssd.service"
|
6
SOURCES/hypervvssd.service
Normal file
6
SOURCES/hypervvssd.service
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Hyper-V VSS daemon
|
||||||
|
BindsTo=sys-devices-virtual-misc-vmbus\x21hv_vss.device
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usr/sbin/hypervvssd -n
|
103
SOURCES/lsvmbus
Normal file
103
SOURCES/lsvmbus
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
#!/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)
|
359
SPECS/hyperv-daemons.spec
Normal file
359
SPECS/hyperv-daemons.spec
Normal file
@ -0,0 +1,359 @@
|
|||||||
|
# Hyper-V KVP daemon binary name
|
||||||
|
%global hv_kvp_daemon hypervkvpd
|
||||||
|
# Hyper-V VSS daemon binary name
|
||||||
|
%global hv_vss_daemon hypervvssd
|
||||||
|
# Hyper-V FCOPY daemon binary name
|
||||||
|
%global hv_fcopy_daemon hypervfcopyd
|
||||||
|
# snapshot version
|
||||||
|
%global snapver .20180415git
|
||||||
|
# use hardened build
|
||||||
|
%global _hardened_build 1
|
||||||
|
# udev rules prefix
|
||||||
|
%global udev_prefix 70
|
||||||
|
|
||||||
|
Name: hyperv-daemons
|
||||||
|
Version: 0
|
||||||
|
Release: 0.27%{?snapver}%{?dist}
|
||||||
|
Summary: Hyper-V daemons suite
|
||||||
|
|
||||||
|
Group: System Environment/Daemons
|
||||||
|
License: GPLv2
|
||||||
|
URL: http://www.kernel.org
|
||||||
|
|
||||||
|
# Source files obtained from kernel upstream 4.17-rc1 (60cc43fc888428bb2f18f08997432d426a243338)
|
||||||
|
# git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
|
||||||
|
Source0: COPYING
|
||||||
|
|
||||||
|
# HYPERV KVP DAEMON
|
||||||
|
Source1: hv_kvp_daemon.c
|
||||||
|
Source2: hv_get_dhcp_info.sh
|
||||||
|
Source3: hv_get_dns_info.sh
|
||||||
|
Source4: hv_set_ifconfig.sh
|
||||||
|
Source5: hypervkvpd.service
|
||||||
|
Source6: hypervkvp.rules
|
||||||
|
|
||||||
|
# HYPERV VSS DAEMON
|
||||||
|
Source100: hv_vss_daemon.c
|
||||||
|
Source101: hypervvssd.service
|
||||||
|
Source102: hypervvss.rules
|
||||||
|
|
||||||
|
# HYPERV FCOPY DAEMON
|
||||||
|
Source200: hv_fcopy_daemon.c
|
||||||
|
Source201: hypervfcopyd.service
|
||||||
|
Source202: hypervfcopy.rules
|
||||||
|
|
||||||
|
# HYPERV TOOLS
|
||||||
|
Source301: lsvmbus
|
||||||
|
|
||||||
|
# Make lsvmbus Python3 compatible
|
||||||
|
Patch0: 0001-tools-hv-update-lsvmbus-to-be-compatible-with-python.patch
|
||||||
|
|
||||||
|
# Do not set NM_CONTROLED=no
|
||||||
|
Patch1: 0002-hv_set_ifconfig_nm_enable.patch
|
||||||
|
|
||||||
|
# Hyper-V is available only on x86 architectures
|
||||||
|
# The base empty (a.k.a. virtual) package can not be noarch
|
||||||
|
# due to http://www.rpm.org/ticket/78
|
||||||
|
ExclusiveArch: i686 x86_64
|
||||||
|
|
||||||
|
Requires: hypervkvpd = %{version}-%{release}
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
||||||
|
%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
|
||||||
|
Requires(preun): systemd
|
||||||
|
Requires(postun): systemd
|
||||||
|
|
||||||
|
%description -n hypervkvpd
|
||||||
|
Hypervkvpd is an implementation of Hyper-V key value pair (KVP)
|
||||||
|
functionality for Linux. The daemon first registers with the
|
||||||
|
kernel driver. After this is done it collects information
|
||||||
|
requested by Windows Host about the Linux Guest. It also supports
|
||||||
|
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
|
||||||
|
Requires(preun): systemd
|
||||||
|
Requires(postun): systemd
|
||||||
|
|
||||||
|
%description -n hypervvssd
|
||||||
|
Hypervvssd is an implementation of Hyper-V VSS functionality
|
||||||
|
for Linux. The daemon is used for host initiated guest snapshot
|
||||||
|
on Hyper-V hypervisor. The daemon first registers with the
|
||||||
|
kernel driver. After this is done it waits for instructions
|
||||||
|
from Windows Host if to "freeze" or "thaw" the filesystem
|
||||||
|
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
|
||||||
|
Requires(preun): systemd
|
||||||
|
Requires(postun): systemd
|
||||||
|
|
||||||
|
%description -n hypervfcopyd
|
||||||
|
Hypervfcopyd is an implementation of file copy service functionality
|
||||||
|
for Linux Guest running on Hyper-V. The daemon enables host to copy
|
||||||
|
a file (over VMBUS) into the Linux Guest. The daemon first registers
|
||||||
|
with the kernel driver. After this is done it waits for instructions
|
||||||
|
from Windows Host.
|
||||||
|
|
||||||
|
|
||||||
|
%package license
|
||||||
|
Summary: License of the Hyper-V daemons suite
|
||||||
|
Group: Applications/System
|
||||||
|
BuildArch: noarch
|
||||||
|
|
||||||
|
%description license
|
||||||
|
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
|
||||||
|
Contains tools and scripts useful for Hyper-V guests.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -Tc
|
||||||
|
cp -pvL %{SOURCE0} COPYING
|
||||||
|
|
||||||
|
cp -pvL %{SOURCE1} hv_kvp_daemon.c
|
||||||
|
cp -pvL %{SOURCE100} hv_vss_daemon.c
|
||||||
|
cp -pvL %{SOURCE200} hv_fcopy_daemon.c
|
||||||
|
|
||||||
|
cp -pvL %{SOURCE301} lsvmbus
|
||||||
|
%patch0 -p3 -b .lsvmbus_python3
|
||||||
|
|
||||||
|
cp -pvL %{SOURCE4} hv_set_ifconfig.sh
|
||||||
|
%patch1 -p0 -b .hv_set_ifconfig_nm_enable
|
||||||
|
|
||||||
|
%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}
|
||||||
|
|
||||||
|
# HYPERV VSS DAEMON
|
||||||
|
gcc $RPM_OPT_FLAGS -c hv_vss_daemon.c
|
||||||
|
gcc $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}
|
||||||
|
|
||||||
|
%install
|
||||||
|
rm -rf %{buildroot}
|
||||||
|
|
||||||
|
mkdir -p %{buildroot}%{_sbindir}
|
||||||
|
install -p -m 0755 %{hv_kvp_daemon} %{buildroot}%{_sbindir}
|
||||||
|
install -p -m 0755 %{hv_vss_daemon} %{buildroot}%{_sbindir}
|
||||||
|
install -p -m 0755 %{hv_fcopy_daemon} %{buildroot}%{_sbindir}
|
||||||
|
# Systemd unit file
|
||||||
|
mkdir -p %{buildroot}%{_unitdir}
|
||||||
|
install -p -m 0644 %{SOURCE5} %{buildroot}%{_unitdir}
|
||||||
|
install -p -m 0644 %{SOURCE101} %{buildroot}%{_unitdir}
|
||||||
|
install -p -m 0644 %{SOURCE201} %{buildroot}%{_unitdir}
|
||||||
|
# Udev rules
|
||||||
|
mkdir -p %{buildroot}%{_udevrulesdir}
|
||||||
|
install -p -m 0644 %{SOURCE6} %{buildroot}%{_udevrulesdir}/%{udev_prefix}-hypervkvp.rules
|
||||||
|
install -p -m 0644 %{SOURCE102} %{buildroot}%{_udevrulesdir}/%{udev_prefix}-hypervvss.rules
|
||||||
|
install -p -m 0644 %{SOURCE202} %{buildroot}%{_udevrulesdir}/%{udev_prefix}-hypervfcopy.rules
|
||||||
|
# Shell scripts for the KVP daemon
|
||||||
|
mkdir -p %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}
|
||||||
|
install -p -m 0755 %{SOURCE2} %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_get_dhcp_info
|
||||||
|
install -p -m 0755 %{SOURCE3} %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_get_dns_info
|
||||||
|
install -p -m 0755 hv_set_ifconfig.sh %{buildroot}%{_libexecdir}/%{hv_kvp_daemon}/hv_set_ifconfig
|
||||||
|
# Directory for pool files
|
||||||
|
mkdir -p %{buildroot}%{_sharedstatedir}/hyperv
|
||||||
|
|
||||||
|
# Tools
|
||||||
|
install -p -m 0755 lsvmbus %{buildroot}%{_sbindir}/
|
||||||
|
sed -i 's,#!/usr/bin/env python,#!%{__python3},' %{buildroot}%{_sbindir}/lsvmbus
|
||||||
|
|
||||||
|
%post -n hypervkvpd
|
||||||
|
if [ $1 -gt 1 ] ; then
|
||||||
|
# Upgrade
|
||||||
|
systemctl --no-reload disable hypervkvpd.service >/dev/null 2>&1 || :
|
||||||
|
fi
|
||||||
|
|
||||||
|
%preun -n hypervkvpd
|
||||||
|
%systemd_preun hypervkvpd.service
|
||||||
|
|
||||||
|
%postun -n hypervkvpd
|
||||||
|
# hypervkvpd daemon does NOT support restarting (driver, neither)
|
||||||
|
%systemd_postun hypervkvpd.service
|
||||||
|
# If removing the package, delete %%{_sharedstatedir}/hyperv directory
|
||||||
|
if [ "$1" -eq "0" ] ; then
|
||||||
|
rm -rf %{_sharedstatedir}/hyperv || :
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
%post -n hypervvssd
|
||||||
|
if [ $1 -gt 1 ] ; then
|
||||||
|
# Upgrade
|
||||||
|
systemctl --no-reload disable hypervvssd.service >/dev/null 2>&1 || :
|
||||||
|
fi
|
||||||
|
|
||||||
|
%postun -n hypervvssd
|
||||||
|
%systemd_postun hypervvssd.service
|
||||||
|
|
||||||
|
%preun -n hypervvssd
|
||||||
|
%systemd_preun hypervvssd.service
|
||||||
|
|
||||||
|
|
||||||
|
%post -n hypervfcopyd
|
||||||
|
if [ $1 -gt 1 ] ; then
|
||||||
|
# Upgrade
|
||||||
|
systemctl --no-reload disable hypervfcopyd.service >/dev/null 2>&1 || :
|
||||||
|
fi
|
||||||
|
|
||||||
|
%postun -n hypervfcopyd
|
||||||
|
%systemd_postun hypervfcopyd.service
|
||||||
|
|
||||||
|
%preun -n hypervfcopyd
|
||||||
|
%systemd_preun hypervfcopyd.service
|
||||||
|
|
||||||
|
|
||||||
|
%files
|
||||||
|
# the base package does not contain any files.
|
||||||
|
|
||||||
|
%files -n hypervkvpd
|
||||||
|
%{_sbindir}/%{hv_kvp_daemon}
|
||||||
|
%{_unitdir}/hypervkvpd.service
|
||||||
|
%{_udevrulesdir}/%{udev_prefix}-hypervkvp.rules
|
||||||
|
%dir %{_libexecdir}/%{hv_kvp_daemon}
|
||||||
|
%{_libexecdir}/%{hv_kvp_daemon}/*
|
||||||
|
%dir %{_sharedstatedir}/hyperv
|
||||||
|
|
||||||
|
%files -n hypervvssd
|
||||||
|
%{_sbindir}/%{hv_vss_daemon}
|
||||||
|
%{_unitdir}/hypervvssd.service
|
||||||
|
%{_udevrulesdir}/%{udev_prefix}-hypervvss.rules
|
||||||
|
|
||||||
|
%files -n hypervfcopyd
|
||||||
|
%{_sbindir}/%{hv_fcopy_daemon}
|
||||||
|
%{_unitdir}/hypervfcopyd.service
|
||||||
|
%{_udevrulesdir}/%{udev_prefix}-hypervfcopy.rules
|
||||||
|
|
||||||
|
%files license
|
||||||
|
%doc COPYING
|
||||||
|
|
||||||
|
%files -n hyperv-tools
|
||||||
|
%{_sbindir}/lsvmbus
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Mon Sep 03 2018 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.27.20180415git
|
||||||
|
- Do not set NM_CONTROLLED=no (#1624355)
|
||||||
|
|
||||||
|
* Wed Aug 01 2018 Charalampos Stratakis <cstratak@redhat.com> - 0-0.26.20180415git
|
||||||
|
- Fix python shebangs
|
||||||
|
|
||||||
|
* Mon Jun 11 2018 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.25.20180415git
|
||||||
|
- Switch lsvmbus to Python3
|
||||||
|
|
||||||
|
* Thu Apr 26 2018 Tomas Hozza <thozza@redhat.com> - 0-0.24.20180415git
|
||||||
|
- Added gcc as an explicit BuildRequires
|
||||||
|
|
||||||
|
* Thu Apr 19 2018 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.23.20180415git
|
||||||
|
- Rebase to 4.17-rc1
|
||||||
|
|
||||||
|
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.22.20170105git
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Dec 11 2017 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.21.20170105git
|
||||||
|
- Rebase to 4.15-rc2, drop fedora patches as changes are upstream
|
||||||
|
- Start kvpd after network.target
|
||||||
|
|
||||||
|
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.20.20170105git
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
|
||||||
|
|
||||||
|
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.19.20170105git
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
|
||||||
|
|
||||||
|
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.18.20170105git
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
|
||||||
|
|
||||||
|
* Wed Jan 11 2017 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.17.20160728git
|
||||||
|
- Use '-gt' instead of '>' to do the right comparison (#1412033)
|
||||||
|
|
||||||
|
* Thu Jan 05 2017 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.16.20160728git
|
||||||
|
- Rebase to 4.9
|
||||||
|
- hyperv-tools subpackage added
|
||||||
|
|
||||||
|
* Thu Jul 28 2016 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.15.20160728git
|
||||||
|
- Rebase to 4.8-rc0 (20160728 git snapshot)
|
||||||
|
- Disable services and remove ConditionVirtualization, multi-user.target
|
||||||
|
dependencies switching to udev-only activation (#1331577)
|
||||||
|
|
||||||
|
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.14.20150702git
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
|
||||||
|
|
||||||
|
* Wed Nov 18 2015 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.13.20150702git
|
||||||
|
- Add udev rules to properly restart services (#1195029)
|
||||||
|
- Spec cleanup
|
||||||
|
|
||||||
|
* Thu Jul 02 2015 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.12.20150702git
|
||||||
|
- Rebase to 4.2-rc0 (20150702 git snapshot)
|
||||||
|
- Switch to new chardev-based communication layer (#1195029)
|
||||||
|
|
||||||
|
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.11.20150108git
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
|
||||||
|
|
||||||
|
* Thu Jan 08 2015 Vitaly Kuznetsov <vkuznets@redhat.com> - 0-0.10.20150108git
|
||||||
|
- Rebase to 3.19-rc3 (20150108 git snapshot)
|
||||||
|
- Drop 'nodaemon' patches, use newly introduced '-n' option
|
||||||
|
|
||||||
|
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.9.20140714git
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Jul 14 2014 Tomas Hozza <thozza@redhat.com> - 0-0.8.20140714git
|
||||||
|
- Update the File copy daemon to the latest git snapshot
|
||||||
|
- Fix hyperfcopyd.service to check for /dev/vmbus/hv_fcopy
|
||||||
|
|
||||||
|
* Wed Jun 11 2014 Tomas Hozza <thozza@redhat.com> - 0-0.7.20140611git
|
||||||
|
- Fix FTBFS (#1106781)
|
||||||
|
- Use kernel-headers instead of kernel-devel for building
|
||||||
|
- package new Hyper-V fcopy daemon as hypervfcopyd sub-package
|
||||||
|
|
||||||
|
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.6.20140219git
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
|
||||||
|
|
||||||
|
* Wed Feb 19 2014 Tomas Hozza <thozza@redhat.com> - 0-0.5.20140219git
|
||||||
|
- rebase to the latest git snapshot next-20140219
|
||||||
|
- KVP, VSS: removed inclusion of linux/types.h
|
||||||
|
- VSS: Ignore VFAT mounts during freeze operation
|
||||||
|
|
||||||
|
* Fri Jan 10 2014 Tomas Hozza <thozza@redhat.com> - 0-0.4.20131022git
|
||||||
|
- provide 'hyperv-daemons' package for convenient installation of all daemons
|
||||||
|
|
||||||
|
* Tue Oct 22 2013 Tomas Hozza <thozza@redhat.com> - 0-0.3.20131022git
|
||||||
|
- rebase to the latest git snapshot next-20130927 (obtained 2013-10-22)
|
||||||
|
- KVP, VSS: daemon use single buffer for send/recv
|
||||||
|
- KVP: FQDN is obtained on start and cached
|
||||||
|
|
||||||
|
* Fri Sep 20 2013 Tomas Hozza <thozza@redhat.com> - 0-0.2.20130826git
|
||||||
|
- Use 'hypervkvpd' directory in libexec for KVP daemon scripts (#1010268)
|
||||||
|
- daemons are now WantedBy multi-user.target instead of basic.target (#1010260)
|
||||||
|
|
||||||
|
* Mon Aug 26 2013 Tomas Hozza <thozza@redhat.com> - 0-0.1.20130826git
|
||||||
|
- Initial package
|
Loading…
Reference in New Issue
Block a user