1 diff -urN xen-4.16.2.orig/tools/misc/Makefile xen-4.16.2/tools/misc/Makefile
2 --- xen-4.16.2.orig/tools/misc/Makefile 2022-08-18 13:47:46.000000000 +0200
3 +++ xen-4.16.2/tools/misc/Makefile 2023-07-23 20:27:26.104773461 +0200
5 # Everything to be installed in regular bin/
6 INSTALL_BIN-$(CONFIG_X86) += xen-cpuid
7 INSTALL_BIN-$(CONFIG_X86) += xen-detect
8 -INSTALL_BIN += xencons
9 INSTALL_BIN += xencov_split
10 INSTALL_BIN += $(INSTALL_BIN-y)
13 TARGETS_ALL := $(INSTALL_BIN) $(INSTALL_SBIN) $(INSTALL_PRIVBIN)
15 # Everything which only needs copying to install
16 -TARGETS_COPY += xencons
17 TARGETS_COPY += xencov_split
18 TARGETS_COPY += xenpvnetboot
20 diff -urN xen-4.16.2.orig/tools/misc/xencons xen-4.16.2/tools/misc/xencons
21 --- xen-4.16.2.orig/tools/misc/xencons 2023-07-23 20:27:00.747415202 +0200
22 +++ xen-4.16.2/tools/misc/xencons 1970-01-01 01:00:00.000000000 +0100
26 -##############################################
27 -# Console client for Xen guest OSes
28 -# Copyright (c) 2004, K A Fraser
29 -##############################################
31 -import errno, os, signal, socket, struct, sys
33 -from termios import *
34 -# Indexes into termios.tcgetattr() list.
43 -def __child_death(signum, frame):
47 -def __recv_from_sock(sock):
52 - data = sock.recv(1024)
53 - except socket.error, error:
54 - if error[0] != errno.EINTR:
59 - except os.error, error:
60 - if error[0] != errno.EINTR:
64 -def __send_to_sock(sock):
67 - data = os.read(0,1024)
68 - except os.error, error:
69 - if error[0] != errno.EINTR:
72 - if ord(data[0]) == ord(']')-64:
76 - except socket.error, error:
77 - if error[0] == errno.EPIPE:
79 - if error[0] != errno.EINTR:
83 -def connect(host,port):
84 - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
85 - sock.connect((host,port))
87 - oattrs = tcgetattr(0)
88 - nattrs = tcgetattr(0)
89 - nattrs[IFLAG] = nattrs[IFLAG] & ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON)
90 - nattrs[OFLAG] = nattrs[OFLAG] & ~(OPOST)
91 - nattrs[CFLAG] = nattrs[CFLAG] & ~(CSIZE | PARENB)
92 - nattrs[CFLAG] = nattrs[CFLAG] | CS8
93 - nattrs[LFLAG] = nattrs[LFLAG] & ~(ECHO | ICANON | IEXTEN | ISIG)
94 - nattrs[CC][VMIN] = 1
95 - nattrs[CC][VTIME] = 0
98 - signal.signal(signal.SIGCHLD, __child_death)
99 - print "************ REMOTE CONSOLE: CTRL-] TO QUIT ********"
100 - tcsetattr(0, TCSAFLUSH, nattrs)
102 - __recv_from_sock(sock)
104 - tcsetattr(0, TCSAFLUSH, oattrs)
106 - print "************ REMOTE CONSOLE EXITED *****************"
108 - signal.signal(signal.SIGPIPE, signal.SIG_IGN)
109 - __send_to_sock(sock)
111 -if __name__ == '__main__':
112 - if len(sys.argv) != 3:
113 - print sys.argv[0] + " <host> <port>"
115 - connect(str(sys.argv[1]),int(sys.argv[2]))
116 diff -urN xen-4.16.2.orig/tools/misc/xencov_split xen-4.16.2/tools/misc/xencov_split
117 --- xen-4.16.2.orig/tools/misc/xencov_split 2023-07-23 20:27:00.747415202 +0200
118 +++ xen-4.16.2/tools/misc/xencov_split 2023-07-23 20:27:33.481877687 +0200
121 except KeyboardInterrupt:
124 diff -urN xen-4.16.2.orig/tools/pygrub/Makefile xen-4.16.2/tools/pygrub/Makefile
125 --- xen-4.16.2.orig/tools/pygrub/Makefile 2022-08-18 13:47:46.000000000 +0200
126 +++ xen-4.16.2/tools/pygrub/Makefile 2023-07-23 20:27:33.481877687 +0200
128 PY_LDFLAGS = $(SHLIB_LDFLAGS) $(APPEND_LDFLAGS)
129 INSTALL_LOG = build/installed_files.txt
131 +setup.py = CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDSHARED="$(CC)" LDFLAGS="$(PY_LDFLAGS)" \
138 - CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDSHARED="$(CC)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) setup.py build
143 $(INSTALL_DIR) $(DESTDIR)/$(bindir)
144 - CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDSHARED="$(CC)" \
145 - LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) setup.py install \
146 - --record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \
147 - --root="$(DESTDIR)" --install-scripts=$(LIBEXEC_BIN) --force
148 + $(INSTALL_DIR) $(DESTDIR)/$(LIBEXEC_BIN)
149 + $(setup.py) install --record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \
150 + --root="$(DESTDIR)" --force
151 + $(INSTALL_PYTHON_PROG) src/pygrub $(DESTDIR)/$(LIBEXEC_BIN)/pygrub
152 set -e; if [ $(bindir) != $(LIBEXEC_BIN) -a \
153 "`readlink -f $(DESTDIR)/$(bindir)`" != \
154 "`readlink -f $(LIBEXEC_BIN)`" ]; then \
155 diff -urN xen-4.16.2.orig/tools/pygrub/setup.py xen-4.16.2/tools/pygrub/setup.py
156 --- xen-4.16.2.orig/tools/pygrub/setup.py 2022-08-18 13:47:46.000000000 +0200
157 +++ xen-4.16.2/tools/pygrub/setup.py 2023-07-23 20:27:33.481877687 +0200
159 author_email='katzj@redhat.com',
161 package_dir={'grub': 'src', 'fsimage': 'src'},
162 - scripts = ["src/pygrub"],
164 ext_modules = [ xenfsimage ]
166 diff -urN xen-4.16.2.orig/tools/pygrub/src/ExtLinuxConf.py xen-4.16.2/tools/pygrub/src/ExtLinuxConf.py
167 --- xen-4.16.2.orig/tools/pygrub/src/ExtLinuxConf.py 2022-08-18 13:47:46.000000000 +0200
168 +++ xen-4.16.2/tools/pygrub/src/ExtLinuxConf.py 2023-07-23 20:27:33.482877701 +0200
175 if __name__ == "__main__":
176 if len(sys.argv) < 2:
177 raise RuntimeError("Need a configuration file to read")
178 diff -urN xen-4.16.2.orig/tools/pygrub/src/fsimage/fsimage.c xen-4.16.2/tools/pygrub/src/fsimage/fsimage.c
179 --- xen-4.16.2.orig/tools/pygrub/src/fsimage/fsimage.c 2022-08-18 13:47:46.000000000 +0200
180 +++ xen-4.16.2/tools/pygrub/src/fsimage/fsimage.c 2023-07-23 20:27:33.482877701 +0200
185 -typedef struct fsimage_file {
186 +typedef struct fsimage_file {
191 ssize_t bytesread = 0;
194 - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|iL", kwlist,
195 + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|iL", kwlist,
212 - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|Ls", kwlist,
213 + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|Ls", kwlist,
214 &name, &offset, &options))
217 diff -urN xen-4.16.2.orig/tools/pygrub/src/GrubConf.py xen-4.16.2/tools/pygrub/src/GrubConf.py
218 --- xen-4.16.2.orig/tools/pygrub/src/GrubConf.py 2022-08-18 13:47:46.000000000 +0200
219 +++ xen-4.16.2/tools/pygrub/src/GrubConf.py 2023-07-23 20:27:33.482877701 +0200
221 self.title = title.strip()
224 - return ("title: %s\n"
225 + return ("title: %s\n"
230 class GrubImage(_GrubImage):
231 def __init__(self, title, lines):
232 _GrubImage.__init__(self, title, lines)
235 def set_from_line(self, line, replace = None):
236 (com, arg) = grub_exact_split(line, 2)
239 class GrubConfigFile(_GrubConfigFile):
240 def __init__(self, fn = None):
241 _GrubConfigFile.__init__(self,fn)
244 def new_image(self, title, lines):
245 return GrubImage(title, lines)
257 logging.info("Ignored directive %s" %(com,))
259 logging.warning("Unknown directive %s" %(com,))
263 self.add_image(GrubImage(title, img))
267 m = re.match("([\"\'])(.*)\\1", arg)
273 class Grub2Image(_GrubImage):
277 (com,arg) = grub2_handle_set(arg)
280 if com in self.commands:
281 if self.commands[com] is not None:
282 setattr(self, self.commands[com], arg.strip())
285 self.lines.pop(replace)
286 self.lines.insert(replace, line)
289 commands = {'set:root': 'root',
292 @@ -360,14 +360,14 @@
298 class Grub2ConfigFile(_GrubConfigFile):
299 def __init__(self, fn = None):
300 _GrubConfigFile.__init__(self, fn)
303 def new_image(self, title, lines):
304 return Grub2Image(title, lines)
307 def parse(self, buf = None):
309 if self.filename is None:
310 @@ -431,10 +431,10 @@
313 (com, arg) = grub_exact_split(l, 2)
317 (com,arg) = grub2_handle_set(arg)
320 if com in self.commands:
321 if self.commands[com] is not None:
322 arg_strip = arg.strip()
326 logging.warning("Unknown directive %s" %(com,))
330 raise RuntimeError("syntax error: end of file with open menuentry(%d %s)" % (len(img),img))
338 if __name__ == "__main__":
339 if len(sys.argv) < 3:
340 raise RuntimeError('Need a grub version ("grub" or "grub2") and a grub.conf or grub.cfg to read')
341 diff -urN xen-4.16.2.orig/tools/pygrub/src/pygrub xen-4.16.2/tools/pygrub/src/pygrub
342 --- xen-4.16.2.orig/tools/pygrub/src/pygrub 2023-07-23 20:27:00.751415259 +0200
343 +++ xen-4.16.2/tools/pygrub/src/pygrub 2023-07-23 20:27:33.483877715 +0200
352 except _curses.error:
354 def get_partition_offsets(file):
355 image_type = identify_disk_image(file)
356 if image_type == DISK_TYPE_RAW:
357 - # No MBR: assume whole disk filesystem, which is like a
358 + # No MBR: assume whole disk filesystem, which is like a
359 # single partition starting at 0
361 elif image_type == DISK_TYPE_HYBRIDISO:
363 partbuf = buf[poff:poff+16]
364 offset = struct.unpack("<L", partbuf[8:12])[0] * SECTOR_SIZE
365 type = struct.unpack("<B", partbuf[4:5])[0]
368 # offset == 0 implies this partition is not enabled
373 win = curses.newwin(1, 74, startx, starty + 2)
374 curses.textpad.Textbox.__init__(self, win)
377 self.line = list(line)
379 self.cancelled = False
383 return string.join(self.line, "")
390 self.entry_win = curses.newwin(Grub.ENTRY_WIN_LINES + 2, 74, 2, 1)
391 self.text_win = curses.newwin(10, 70, 12, 5)
392 curses.def_prog_mode()
395 curses.reset_prog_mode()
399 self.start_image = self.selected_image
400 if self.selected_image < self.start_image:
401 self.start_image = self.selected_image
404 for y in range(self.start_image, len(self.cf.images)):
405 i = self.cf.images[y]
406 if y > self.start_image + maxy:
408 l = img.lines[idx].expandtabs().ljust(70)
413 self.entry_win.addstr(idp, 2, l)
415 self.entry_win.attroff(curses.A_REVERSE)
417 self.command_line_mode()
422 # bound at the top and bottom
428 t = GrubLineEditor(self.screen, y, 2)
429 - enable_cursor(True)
430 + enable_cursor(True)
433 if ret in ("quit", "return"):
438 - # if we got boot, then we want to boot the entered image
439 + # if we got boot, then we want to boot the entered image
440 img = self.cf.new_image("entered", lines)
441 self.cf.add_image(img)
442 self.selected_image = len(self.cf.images) - 1
444 def read_config(self, fn, fs = None):
445 """Read the given file to parse the config. If fs = None, then
446 we're being given a raw config file rather than a disk image."""
449 if not os.access(fn, os.R_OK):
450 raise RuntimeError("Unable to access %s" %(fn,))
453 while not self.isdone:
454 self.run_main(timeout)
458 return self.selected_image
460 def run_main(self, timeout = -1):
463 while (timeout == -1 or mytime < int(timeout)):
465 - if timeout != -1 and mytime != -1:
466 + if timeout != -1 and mytime != -1:
467 self.screen.addstr(20, 5, "Will boot selected entry in %2d seconds"
468 %(int(timeout) - mytime))
471 self.selected_image = 0
472 elif self.selected_image >= len(self.cf.images):
473 self.selected_image = len(self.cf.images) - 1
476 def get_entry_idx(cf, entry):
477 # first, see if the given entry is numeric
479 @@ -702,10 +702,10 @@
480 # Unpleasant. Typically we'll have 'root=foo -k' or 'root=foo /kernel -k',
481 # and we need to maintain Xen properties (root= and ip=) and the kernel
482 # before any user args.
490 cfg["args"] = cfg["kernel"]
493 cfg["args"] = xenargs + " " + cfg["kernel"] + " " + userargs
498 def sniff_netware(fs, cfg):
499 if not fs.file_exists("/nwserver/xnloader.sys"):
503 s += "(args %s)" % repr(args)
507 def format_simple(kernel, ramdisk, args, sep):
508 for check in (kernel, ramdisk, args):
509 if check is not None and sep in check:
512 if __name__ == "__main__":
517 print("Usage: %s [-q|--quiet] [-i|--interactive] [-l|--list-entries] [-n|--not-really] [--output=] [--kernel=] [--ramdisk=] [--args=] [--entry=] [--output-directory=] [--output-format=sxp|simple|simple0] [--offset=] <image>" %(sys.argv[0],), file=sys.stderr)
520 opts, args = getopt.gnu_getopt(sys.argv[1:], 'qilnh::',
521 ["quiet", "interactive", "list-entries", "not-really", "help",
522 "output=", "output-format=", "output-directory=", "offset=",
523 - "entry=", "kernel=",
524 + "entry=", "kernel=",
525 "ramdisk=", "args=", "isconfig", "debug"])
526 except getopt.GetoptError:
529 os.write(fd, ostring)
531 os.write(fd, ostring.encode())
534 diff -urN xen-4.16.2.orig/tools/python/Makefile xen-4.16.2/tools/python/Makefile
535 --- xen-4.16.2.orig/tools/python/Makefile 2022-08-18 13:47:46.000000000 +0200
536 +++ xen-4.16.2/tools/python/Makefile 2023-07-23 20:27:33.483877715 +0200
541 - LD_LIBRARY_PATH=$$(readlink -f ../libs/ctrl):$$(readlink -f ../xenstore) $(PYTHON) -m unittest discover
542 + LD_LIBRARY_PATH=$$(readlink -f ../libs/ctrl):$$(readlink -f ../xenstore) $(PYTHON) -m unittest discover -v
546 diff -urN xen-4.16.2.orig/tools/python/pylintrc xen-4.16.2/tools/python/pylintrc
547 --- xen-4.16.2.orig/tools/python/pylintrc 2022-08-18 13:47:46.000000000 +0200
548 +++ xen-4.16.2/tools/python/pylintrc 1970-01-01 01:00:00.000000000 +0100
550 -# lint Python modules using external checkers.
552 -# This is the main checker controling the other ones and the reports
553 -# generation. It is itself both a raw checker and an astng checker in order
555 -# * handle message activation / deactivation at the module level
556 -# * handle some basic but necessary stats'data (number of classes, methods...)
558 -# This checker also defines the following reports:
559 -# * R0001: Total errors / warnings
560 -# * R0002: % errors / warnings by module
562 -# * R0004: Global evaluation
565 -# Add <file or directory> to the black list. It should be a base name, not a
566 -# path. You may set this option multiple times.
569 -# Pickle collected data for later comparisons.
572 -# Set the cache size for astng objects.
578 -# Tells wether to display a full report or only the messages
581 -# Use HTML as output format instead of text
584 -# Use a parseable text output format, so your favorite text editor will be able
585 -# to jump to the line corresponding to a message.
588 -# Colorizes text output using ansi escape codes
591 -# Put messages in a separate file for each module / package specified on the
592 -# command line instead of printing them on stdout. Reports (if any) will be
593 -# written in a file name "pylint_global.[txt|html]".
596 -# Python expression which should return a note less than 10 (10 is the highest
597 -# note).You have access to the variables errors warning, statement which
598 -# respectivly contain the number of errors / warnings messages and the total
599 -# number of statements analyzed. This is used by the global evaluation report
601 -evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
603 -# Add a comment according to your evaluation note. This is used by the global
604 -# evaluation report (R0004).
607 -# Include message's id in output
613 -# * unused variables / imports
614 -# * undefined variables
615 -# * redefinition of variable from builtins or from an outer scope
616 -# * use of variable before assigment
619 -# Enable / disable this checker
620 -enable-variables=yes
622 -# Tells wether we should check for unused import in __init__ files.
625 -# List of variable names used for dummy variables (i.e. not used).
626 -dummy-variables=_,_1,_2,_3,_4,_5,dummy
632 -# * modules / classes / functions / methods / arguments / variables name
633 -# * number of arguments, local variables, branchs, returns and statements in
634 -# functions, methods
635 -# * required module attributes
636 -# * dangerous default values as arguments
637 -# * redefinition of function / method / class
638 -# * uses of the global statement
640 -# This checker also defines the following reports:
641 -# * R0101: Statistics by type
644 -# Enable / disable this checker
647 -# Required attributes for module, separated by a comma
648 -required-attributes=
650 -# Regular expression which should only match functions or classes name which do
651 -# not require a docstring
654 -# Minimal length for module / class / function / method / argument / variable
658 -# Regular expression which should only match correct module names
659 -module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
661 -# Regular expression which should only match correct class names
662 -class-rgx=[A-Z_][a-zA-Z0-9]+$
664 -# Regular expression which should only match correct function names
665 -function-rgx=[a-z_][A-Za-z0-9_]*$
667 -# Regular expression which should only match correct method names
668 -method-rgx=[a-z_][A-Za-z0-9_]*$
670 -# Regular expression which should only match correct argument names
671 -argument-rgx=[a-z_][A-Za-z0-9_]*$
673 -# Regular expression which should only match correct variable names
674 -variable-rgx=[a-z_][A-Za-z0-9_]*$
676 -# Good variable names which should always be accepted, separated by a comma
677 -good-names=i,j,k,ex,Run,_
679 -# Bad variable names which should always be refused, separated by a comma
680 -bad-names=foo,bar,baz,toto,tutu,tata
682 -# List of builtins function names that should not be used, separated by a comma
683 -bad-functions=apply,input
687 -# checks for sign of poor/misdesign:
688 -# * number of methods, attributes, local variables...
689 -# * size, complexity of functions, methods
692 -# Enable / disable this checker
695 -# Maximum number of arguments for function / method
698 -# Maximum number of locals for function / method body
701 -# Maximum number of return / yield for function / method body
704 -# Maximum number of branch for function / method body
707 -# Maximum number of statements in function / method body
710 -# Maximum number of parents for a class (see R0901).
713 -# Maximum number of attributes for a class (see R0902).
716 -# Minimum number of public methods for a class (see R0903).
717 -min-public-methods=2
719 -# Maximum number of public methods for a class (see R0904).
720 -max-public-methods=20
725 -# * methods without self as first argument
726 -# * overriden methods signature
727 -# * access only to existant members via self
728 -# * attributes not defined in the __init__ method
729 -# * supported interfaces implementation
730 -# * unreachable code
733 -# Enable / disable this checker
736 -# List of interface methods to ignore, separated by a comma. This is used for
737 -# instance to not check methods defines in Zope's Interface base class.
738 -ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
740 -# Tells wether missing members accessed in mixin class should be ignored. A
741 -# mixin class is detected if its name ends with "mixin" (case insensitive).
742 -ignore-mixin-members=yes
747 -# * external modules dependencies
748 -# * relative / wildcard imports
750 -# * uses of deprecated modules
752 -# This checker also defines the following reports:
753 -# * R0401: External dependencies
754 -# * R0402: Modules dependencies graph
757 -# Enable / disable this checker
760 -# Deprecated modules which should not be used, separated by a comma
761 -deprecated-modules=regsub,string,TERMIOS,Bastion,rexec
763 -# Create a graph of every (i.e. internal and external) dependencies in the given
764 -# file (report R0402 must not be disabled)
767 -# Create a graph of external dependencies in the given file (report R0402 must
771 -# Create a graph of internal dependencies in the given file (report R0402 must
778 -# * excepts without exception filter
779 -# * string exceptions
782 -# Enable / disable this checker
783 -enable-exceptions=yes
788 -# * unauthorized constructions
789 -# * strict indentation
791 -# * use of <> instead of !=
794 -# Enable / disable this checker
797 -# Maximum number of characters on a single line.
800 -# Maximum number of lines in a module
801 -max-module-lines=1000
803 -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 tab).
808 -# does not check anything but gives some raw metrics :
809 -# * total number of lines
810 -# * total number of code lines
811 -# * total number of docstring lines
812 -# * total number of comments lines
813 -# * total number of empty lines
815 -# This checker also defines the following reports:
816 -# * R0701: Raw metrics
819 -# Enable / disable this checker
825 -# * warning notes in the code like FIXME, XXX
826 -# * PEP 263: source code with non ascii character but no encoding declaration
829 -# Enable / disable this checker
830 -enable-miscellaneous=yes
832 -# List of note tags to take in consideration, separated by a comma. Default to
834 -notes=FIXME,XXX,TODO
838 -# checks for similarities and duplicated code. This computation may be
839 -# memory / CPU intensive, so you should disable it if you experiments some
842 -# This checker also defines the following reports:
843 -# * R0801: Duplication
846 -# Enable / disable this checker
847 -enable-similarities=yes
849 -# Minimum lines number of a similarity.
850 -min-similarity-lines=4
852 -# Ignore comments when computing similarities.
857 diff -urN xen-4.16.2.orig/tools/python/xen/lowlevel/xc/xc.c xen-4.16.2/tools/python/xen/lowlevel/xc/xc.c
858 --- xen-4.16.2.orig/tools/python/xen/lowlevel/xc/xc.c 2022-08-18 13:47:46.000000000 +0200
859 +++ xen-4.16.2/tools/python/xen/lowlevel/xc/xc.c 2023-07-23 20:27:33.484877729 +0200
861 /******************************************************************************
865 * Copyright (c) 2003-2004, K A Fraser (University of Cambridge)
870 if ( xc_domain_dumpcore(self->xc_handle, dom, corefile) != 0 )
871 return pyxc_error_to_exception(self->xc_handle);
879 if ( pyhandle != NULL )
881 - if ( !PyList_Check(pyhandle) ||
882 + if ( !PyList_Check(pyhandle) ||
883 (PyList_Size(pyhandle) != sizeof(xen_domain_handle_t)) )
888 if (xc_domain_max_vcpus(self->xc_handle, dom, max) != 0)
889 return pyxc_error_to_exception(self->xc_handle);
897 if ( xc_domain_shutdown(self->xc_handle, dom, reason) != 0 )
898 return pyxc_error_to_exception(self->xc_handle);
906 static char *kwd_list[] = { "domid", "vcpu", "cpumap", NULL };
908 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|iO", kwd_list,
909 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|iO", kwd_list,
910 &dom, &vcpu, &cpulist) )
915 if ( (cpulist != NULL) && PyList_Check(cpulist) )
917 - for ( i = 0; i < PyList_Size(cpulist); i++ )
918 + for ( i = 0; i < PyList_Size(cpulist); i++ )
920 long cpu = PyLongOrInt_AsLong(PyList_GetItem(cpulist, i));
921 if ( cpu < 0 || cpu >= nr_cpus )
923 cpumap[cpu / 8] |= 1 << (cpu % 8);
928 if ( xc_vcpu_setaffinity(self->xc_handle, dom, vcpu, cpumap,
929 NULL, XEN_VCPUAFFINITY_HARD) != 0 )
932 return pyxc_error_to_exception(self->xc_handle);
941 if (!PyArg_ParseTuple(args, "iO", &dom, &pyhandle))
944 - if ( !PyList_Check(pyhandle) ||
945 + if ( !PyList_Check(pyhandle) ||
946 (PyList_Size(pyhandle) != sizeof(xen_domain_handle_t)) )
951 if (xc_domain_sethandle(self->xc_handle, dom, handle) < 0)
952 return pyxc_error_to_exception(self->xc_handle);
961 static char *kwd_list[] = { "first_dom", "max_doms", NULL };
964 if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|ii", kwd_list,
965 &first_dom, &max_doms) )
970 static char *kwd_list[] = { "domid", "vcpu", NULL };
973 if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list,
980 - static char *kwd_list[] = { "domid", "param", NULL };
981 + static char *kwd_list[] = { "domid", "param", NULL };
982 if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list,
989 - static char *kwd_list[] = { "domid", "param", "value", NULL };
990 + static char *kwd_list[] = { "domid", "param", "value", NULL };
991 if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiL", kwd_list,
992 &dom, ¶m, &value) )
1000 return pyxc_error_to_exception(self->xc_handle);
1005 static char *kwd_list[] = { "domid", "bus", "dev", "func", "enable", NULL };
1007 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiii", kwd_list,
1008 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiii", kwd_list,
1009 &dom, &bus, &dev, &func, &enable) )
1013 "nr_nodes", pinfo.nr_nodes,
1014 "threads_per_core", pinfo.threads_per_core,
1015 "cores_per_socket", pinfo.cores_per_socket,
1016 - "nr_cpus", pinfo.nr_cpus,
1017 + "nr_cpus", pinfo.nr_cpus,
1018 "total_memory", pages_to_kib(pinfo.total_pages),
1019 "free_memory", pages_to_kib(pinfo.free_pages),
1020 "scrub_memory", pages_to_kib(pinfo.scrub_pages),
1021 @@ -1190,13 +1190,13 @@
1023 static char *kwd_list[] = { "dom", "op", NULL };
1025 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list,
1026 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list,
1031 if ( xc_shadow_control(xc->xc_handle, dom, op, NULL, 0) < 0 )
1032 return pyxc_error_to_exception(xc->xc_handle);
1038 @@ -1213,26 +1213,26 @@
1040 static char *kwd_list[] = { "dom", "mb", NULL };
1042 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list,
1043 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list,
1050 op = XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION;
1055 op = XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION;
1057 if ( xc_shadow_control(xc->xc_handle, dom, op, &mb, 0) < 0 )
1058 return pyxc_error_to_exception(xc->xc_handle);
1062 return Py_BuildValue("i", mbarg);
1065 static PyObject *pyxc_sched_id_get(XcObject *self) {
1069 if (xc_sched_id(self->xc_handle, &sched_id) != 0)
1070 return PyErr_SetFromErrno(xc_error_obj);
1071 @@ -1250,10 +1250,10 @@
1072 static char *kwd_list[] = { "domid", "weight", "cap", NULL };
1073 static char kwd_type[] = "I|HH";
1074 struct xen_domctl_sched_credit sdom;
1078 cap = (uint16_t)~0U;
1079 - if( !PyArg_ParseTupleAndKeywords(args, kwds, kwd_type, kwd_list,
1080 + if( !PyArg_ParseTupleAndKeywords(args, kwds, kwd_type, kwd_list,
1081 &domid, &weight, &cap) )
1084 @@ -1271,10 +1271,10 @@
1087 struct xen_domctl_sched_credit sdom;
1090 if( !PyArg_ParseTuple(args, "I", &domid) )
1094 if ( xc_sched_credit_domain_get(self->xc_handle, domid, &sdom) != 0 )
1095 return pyxc_error_to_exception(self->xc_handle);
1097 @@ -1335,7 +1335,7 @@
1099 if (xc_domain_setmaxmem(self->xc_handle, dom, maxmem_kb) != 0)
1100 return pyxc_error_to_exception(self->xc_handle);
1106 @@ -1348,12 +1348,12 @@
1107 if (!PyArg_ParseTuple(args, "ii", &dom, &mem_kb))
1110 - mem_pages = mem_kb / 4;
1111 + mem_pages = mem_kb / 4;
1113 if (xc_domain_set_pod_target(self->xc_handle, dom, mem_pages,
1114 NULL, NULL, NULL) != 0)
1115 return pyxc_error_to_exception(self->xc_handle);
1121 @@ -1368,7 +1368,7 @@
1123 if ( xc_domain_set_memmap_limit(self->xc_handle, dom, maplimit_kb) != 0 )
1124 return pyxc_error_to_exception(self->xc_handle);
1130 @@ -1382,7 +1382,7 @@
1132 static char *kwd_list[] = { "domid", "first_port", "nr_ports", "allow_access", NULL };
1134 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiii", kwd_list,
1135 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiii", kwd_list,
1136 &dom, &first_port, &nr_ports, &allow_access) )
1139 @@ -1405,7 +1405,7 @@
1141 static char *kwd_list[] = { "domid", "pirq", "allow_access", NULL };
1143 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iii", kwd_list,
1144 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iii", kwd_list,
1145 &dom, &pirq, &allow_access) )
1148 @@ -1428,7 +1428,7 @@
1150 static char *kwd_list[] = { "domid", "first_pfn", "nr_pfns", "allow_access", NULL };
1152 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "illi", kwd_list,
1153 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "illi", kwd_list,
1154 &dom, &first_pfn, &nr_pfns, &allow_access) )
1157 @@ -1479,7 +1479,7 @@
1159 static char *kwd_list[] = { "domid", "trigger", "vcpu", NULL };
1161 - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii|i", kwd_list,
1162 + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii|i", kwd_list,
1163 &dom, &trigger, &vcpu) )
1166 @@ -1533,7 +1533,7 @@
1168 if (xc_memshr_control(self->xc_handle, dom, enable) != 0)
1169 return pyxc_error_to_exception(self->xc_handle);
1175 @@ -1757,11 +1757,11 @@
1177 return PyErr_SetFromErrno(xc_error_obj);
1181 ret = xc_flask_sid_to_context(xc_handle, sid, ctx, ctx_len);
1184 xc_interface_close(xc_handle);
1189 return PyErr_SetFromErrno(xc_error_obj);
1190 @@ -1778,7 +1778,7 @@
1193 static char *kwd_list[] = { "policy", NULL };
1196 if( !PyArg_ParseTupleAndKeywords(args, kwds, "s#", kwd_list, &policy, &len) )
1199 @@ -1808,11 +1808,11 @@
1201 return PyErr_SetFromErrno(xc_error_obj);
1205 ret = xc_flask_getenforce(xc_handle);
1208 xc_interface_close(xc_handle);
1213 return PyErr_SetFromErrno(xc_error_obj);
1214 @@ -1838,11 +1838,11 @@
1216 return PyErr_SetFromErrno(xc_error_obj);
1220 ret = xc_flask_setenforce(xc_handle, mode);
1223 xc_interface_close(xc_handle);
1228 return PyErr_SetFromErrno(xc_error_obj);
1229 @@ -1860,7 +1860,7 @@
1230 uint32_t req, allowed, decided, auditallow, auditdeny, seqno;
1233 - static char *kwd_list[] = { "src_context", "tar_context",
1234 + static char *kwd_list[] = { "src_context", "tar_context",
1235 "tar_class", "req_permissions",
1236 "decided", "auditallow","auditdeny",
1238 @@ -1874,10 +1874,10 @@
1240 return PyErr_SetFromErrno(xc_error_obj);
1244 ret = xc_flask_access(xc_handle, scon, tcon, tclass, req, &allowed, &decided,
1245 &auditallow, &auditdeny, &seqno);
1248 xc_interface_close(xc_handle);
1251 @@ -1889,14 +1889,14 @@
1254 static PyMethodDef pyxc_methods[] = {
1255 - { "domain_create",
1256 - (PyCFunction)pyxc_domain_create,
1257 + { "domain_create",
1258 + (PyCFunction)pyxc_domain_create,
1259 METH_VARARGS | METH_KEYWORDS, "\n"
1260 "Create a new domain.\n"
1261 " dom [int, 0]: Domain identifier to use (allocated if zero).\n"
1262 "Returns: [int] new domain identifier; -1 on error.\n" },
1264 - { "domain_max_vcpus",
1265 + { "domain_max_vcpus",
1266 (PyCFunction)pyxc_domain_max_vcpus,
1268 "Set the maximum number of VCPUs a domain may create.\n"
1269 @@ -1904,43 +1904,43 @@
1270 " max [int, 0]: New maximum number of VCPUs in domain.\n"
1271 "Returns: [int] 0 on success; -1 on error.\n" },
1273 - { "domain_dumpcore",
1274 - (PyCFunction)pyxc_domain_dumpcore,
1275 + { "domain_dumpcore",
1276 + (PyCFunction)pyxc_domain_dumpcore,
1278 "Dump core of a domain.\n"
1279 " dom [int]: Identifier of domain to dump core of.\n"
1280 " corefile [string]: Name of corefile to be created.\n\n"
1281 "Returns: [int] 0 on success; -1 on error.\n" },
1284 - (PyCFunction)pyxc_domain_pause,
1286 + (PyCFunction)pyxc_domain_pause,
1288 "Temporarily pause execution of a domain.\n"
1289 " dom [int]: Identifier of domain to be paused.\n\n"
1290 "Returns: [int] 0 on success; -1 on error.\n" },
1292 - { "domain_unpause",
1293 - (PyCFunction)pyxc_domain_unpause,
1294 + { "domain_unpause",
1295 + (PyCFunction)pyxc_domain_unpause,
1297 "(Re)start execution of a domain.\n"
1298 " dom [int]: Identifier of domain to be unpaused.\n\n"
1299 "Returns: [int] 0 on success; -1 on error.\n" },
1301 - { "domain_destroy",
1302 - (PyCFunction)pyxc_domain_destroy,
1303 + { "domain_destroy",
1304 + (PyCFunction)pyxc_domain_destroy,
1306 "Destroy a domain.\n"
1307 " dom [int]: Identifier of domain to be destroyed.\n\n"
1308 "Returns: [int] 0 on success; -1 on error.\n" },
1310 - { "domain_destroy_hook",
1311 - (PyCFunction)pyxc_domain_destroy_hook,
1312 + { "domain_destroy_hook",
1313 + (PyCFunction)pyxc_domain_destroy_hook,
1315 "Add a hook for arch stuff before destroy a domain.\n"
1316 " dom [int]: Identifier of domain to be destroyed.\n\n"
1317 "Returns: [int] 0 on success; -1 on error.\n" },
1319 - { "domain_resume",
1320 + { "domain_resume",
1321 (PyCFunction)pyxc_domain_resume,
1323 "Resume execution of a suspended domain.\n"
1324 @@ -1948,7 +1948,7 @@
1325 " fast [int]: Use cooperative resume.\n\n"
1326 "Returns: [int] 0 on success; -1 on error.\n" },
1328 - { "domain_shutdown",
1329 + { "domain_shutdown",
1330 (PyCFunction)pyxc_domain_shutdown,
1332 "Shutdown a domain.\n"
1333 @@ -1956,8 +1956,8 @@
1334 " reason [int, 0]: Reason for shutdown.\n"
1335 "Returns: [int] 0 on success; -1 on error.\n" },
1337 - { "vcpu_setaffinity",
1338 - (PyCFunction)pyxc_vcpu_setaffinity,
1339 + { "vcpu_setaffinity",
1340 + (PyCFunction)pyxc_vcpu_setaffinity,
1341 METH_VARARGS | METH_KEYWORDS, "\n"
1342 "Pin a VCPU to a specified set CPUs.\n"
1343 " dom [int]: Identifier of domain to which VCPU belongs.\n"
1344 @@ -1965,7 +1965,7 @@
1345 " cpumap [list, []]: list of usable CPUs.\n\n"
1346 "Returns: [int] 0 on success; -1 on error.\n" },
1348 - { "domain_sethandle",
1349 + { "domain_sethandle",
1350 (PyCFunction)pyxc_domain_sethandle,
1352 "Set domain's opaque handle.\n"
1353 @@ -1973,8 +1973,8 @@
1354 " handle [list of 16 ints]: New opaque handle.\n"
1355 "Returns: [int] 0 on success; -1 on error.\n" },
1357 - { "domain_getinfo",
1358 - (PyCFunction)pyxc_domain_getinfo,
1359 + { "domain_getinfo",
1360 + (PyCFunction)pyxc_domain_getinfo,
1361 METH_VARARGS | METH_KEYWORDS, "\n"
1362 "Get information regarding a set of domains, in increasing id order.\n"
1363 " first_dom [int, 0]: First domain to retrieve info about.\n"
1364 @@ -1999,8 +1999,8 @@
1365 "reason why it shut itself down.\n"
1366 " cpupool [int] Id of cpupool domain is bound to.\n" },
1369 - (PyCFunction)pyxc_vcpu_getinfo,
1371 + (PyCFunction)pyxc_vcpu_getinfo,
1372 METH_VARARGS | METH_KEYWORDS, "\n"
1373 "Get information regarding a VCPU.\n"
1374 " dom [int]: Domain to retrieve info about.\n"
1375 @@ -2024,7 +2024,7 @@
1376 " xenstore_domid [int]: \n"
1377 "Returns: None on success. Raises exception on error.\n" },
1379 - { "hvm_get_param",
1380 + { "hvm_get_param",
1381 (PyCFunction)pyxc_hvm_param_get,
1382 METH_VARARGS | METH_KEYWORDS, "\n"
1383 "get a parameter of HVM guest OS.\n"
1384 @@ -2032,7 +2032,7 @@
1385 " param [int]: No. of HVM param.\n"
1386 "Returns: [long] value of the param.\n" },
1388 - { "hvm_set_param",
1389 + { "hvm_set_param",
1390 (PyCFunction)pyxc_hvm_param_set,
1391 METH_VARARGS | METH_KEYWORDS, "\n"
1392 "set a parameter of HVM guest OS.\n"
1393 @@ -2075,12 +2075,12 @@
1394 " dom [int]: Domain to deassign device from.\n"
1395 " pci_str [str]: PCI devices.\n"
1396 "Returns: [int] 0 on success, or device bdf that can't be deassigned.\n" },
1400 (PyCFunction)pyxc_sched_id_get,
1402 "Get the current scheduler type in use.\n"
1403 - "Returns: [int] sched_id.\n" },
1404 + "Returns: [int] sched_id.\n" },
1406 { "sched_credit_domain_set",
1407 (PyCFunction)pyxc_sched_credit_domain_set,
1408 @@ -2118,7 +2118,7 @@
1410 " weight [short]: domain's scheduling weight\n"},
1412 - { "evtchn_alloc_unbound",
1413 + { "evtchn_alloc_unbound",
1414 (PyCFunction)pyxc_evtchn_alloc_unbound,
1415 METH_VARARGS | METH_KEYWORDS, "\n"
1416 "Allocate an unbound port that will await a remote connection.\n"
1417 @@ -2126,7 +2126,7 @@
1418 " remote_dom [int]: Remote domain to accept connections from.\n\n"
1419 "Returns: [int] Unbound event-channel port.\n" },
1423 (PyCFunction)pyxc_evtchn_reset,
1424 METH_VARARGS | METH_KEYWORDS, "\n"
1425 "Reset all connections.\n"
1426 @@ -2151,9 +2151,9 @@
1427 " func [int]: PCI function\n"
1428 " enable [int]: Non-zero means enable access; else disable access\n\n"
1429 "Returns: [int] 0 on success; -1 on error.\n" },
1431 - { "readconsolering",
1432 - (PyCFunction)pyxc_readconsolering,
1434 + { "readconsolering",
1435 + (PyCFunction)pyxc_readconsolering,
1436 METH_VARARGS | METH_KEYWORDS, "\n"
1437 "Read Xen's console ring.\n"
1438 " clear [int, 0]: Bool - clear the ring after reading from it?\n\n"
1439 @@ -2201,40 +2201,40 @@
1440 "Returns [str]: Xen buildid"
1441 " [None]: on failure.\n" },
1443 - { "shadow_control",
1444 - (PyCFunction)pyxc_shadow_control,
1445 + { "shadow_control",
1446 + (PyCFunction)pyxc_shadow_control,
1447 METH_VARARGS | METH_KEYWORDS, "\n"
1448 "Set parameter for shadow pagetable interface\n"
1449 " dom [int]: Identifier of domain.\n"
1450 " op [int, 0]: operation\n\n"
1451 "Returns: [int] 0 on success; -1 on error.\n" },
1453 - { "shadow_mem_control",
1454 - (PyCFunction)pyxc_shadow_mem_control,
1455 + { "shadow_mem_control",
1456 + (PyCFunction)pyxc_shadow_mem_control,
1457 METH_VARARGS | METH_KEYWORDS, "\n"
1458 "Set or read shadow pagetable memory use\n"
1459 " dom [int]: Identifier of domain.\n"
1460 " mb [int, -1]: MB of shadow memory this domain should have.\n\n"
1461 "Returns: [int] MB of shadow memory in use by this domain.\n" },
1463 - { "domain_setmaxmem",
1464 - (PyCFunction)pyxc_domain_setmaxmem,
1465 + { "domain_setmaxmem",
1466 + (PyCFunction)pyxc_domain_setmaxmem,
1468 "Set a domain's memory limit\n"
1469 " dom [int]: Identifier of domain.\n"
1470 " maxmem_kb [int]: .\n"
1471 "Returns: [int] 0 on success; -1 on error.\n" },
1473 - { "domain_set_target_mem",
1474 - (PyCFunction)pyxc_domain_set_target_mem,
1475 + { "domain_set_target_mem",
1476 + (PyCFunction)pyxc_domain_set_target_mem,
1478 "Set a domain's memory target\n"
1479 " dom [int]: Identifier of domain.\n"
1480 " mem_kb [int]: .\n"
1481 "Returns: [int] 0 on success; -1 on error.\n" },
1483 - { "domain_set_memmap_limit",
1484 - (PyCFunction)pyxc_domain_set_memmap_limit,
1485 + { "domain_set_memmap_limit",
1486 + (PyCFunction)pyxc_domain_set_memmap_limit,
1488 "Set a domain's physical memory mapping limit\n"
1489 " dom [int]: Identifier of domain.\n"
1490 @@ -2308,7 +2308,7 @@
1491 "Inject debug keys into Xen.\n"
1492 " keys [str]: String of keys to inject.\n" },
1494 - { "dom_set_memshr",
1495 + { "dom_set_memshr",
1496 (PyCFunction)pyxc_dom_set_memshr,
1498 "Enable/disable memory sharing for the domain.\n"
1499 @@ -2390,20 +2390,20 @@
1500 METH_VARARGS | METH_KEYWORDS, "\n"
1501 "Loads a policy into the hypervisor.\n"
1502 " policy [str]: policy to be load\n"
1503 - "Returns: [int]: 0 on success; -1 on failure.\n" },
1505 + "Returns: [int]: 0 on success; -1 on failure.\n" },
1507 { "flask_getenforce",
1508 (PyCFunction)pyflask_getenforce,
1510 "Returns the current mode of the Flask XSM module.\n"
1511 - "Returns: [int]: 0 for permissive; 1 for enforcing; -1 on failure.\n" },
1512 + "Returns: [int]: 0 for permissive; 1 for enforcing; -1 on failure.\n" },
1514 { "flask_setenforce",
1515 (PyCFunction)pyflask_setenforce,
1516 METH_VARARGS | METH_KEYWORDS, "\n"
1517 "Modifies the current mode for the Flask XSM module.\n"
1518 " mode [int]: mode to change to\n"
1519 - "Returns: [int]: 0 on success; -1 on failure.\n" },
1520 + "Returns: [int]: 0 on success; -1 on failure.\n" },
1523 (PyCFunction)pyflask_access,
1524 @@ -2422,7 +2422,7 @@
1525 " auditdeny [int] permissions set to audit on deny\n"
1526 " seqno [int] not used\n"
1527 "Returns: [int]: 0 on all permission granted; -1 if any permissions are \
1531 { NULL, NULL, 0, NULL }
1533 diff -urN xen-4.16.2.orig/tools/python/xen/lowlevel/xs/xs.c xen-4.16.2/tools/python/xen/lowlevel/xs/xs.c
1534 --- xen-4.16.2.orig/tools/python/xen/lowlevel/xs/xs.c 2022-08-18 13:47:46.000000000 +0200
1535 +++ xen-4.16.2/tools/python/xen/lowlevel/xs/xs.c 2023-07-23 20:27:33.484877729 +0200
1539 * Python interface to the Xen Store Daemon.
1541 * This library is free software; you can redistribute it and/or
1543 * Parse transaction and path arguments from the given args and kwds,
1544 * convert the given self value to an xs_handle, and return all three by
1548 * @return 1 on success, in which case *xh, *th, and *path are valid, or 0 on
1551 diff -urN xen-4.16.2.orig/tools/python/xen/migration/legacy.py xen-4.16.2/tools/python/xen/migration/legacy.py
1552 --- xen-4.16.2.orig/tools/python/xen/migration/legacy.py 2022-08-18 13:47:46.000000000 +0200
1553 +++ xen-4.16.2/tools/python/xen/migration/legacy.py 2023-07-23 20:27:33.484877729 +0200
1555 -#!/usr/bin/env python
1556 # -*- coding: utf-8 -*-
1559 diff -urN xen-4.16.2.orig/tools/python/xen/migration/libxc.py xen-4.16.2/tools/python/xen/migration/libxc.py
1560 --- xen-4.16.2.orig/tools/python/xen/migration/libxc.py 2022-08-18 13:47:46.000000000 +0200
1561 +++ xen-4.16.2/tools/python/xen/migration/libxc.py 2023-07-23 20:27:33.485877743 +0200
1563 -#!/usr/bin/env python
1564 # -*- coding: utf-8 -*-
1567 diff -urN xen-4.16.2.orig/tools/python/xen/migration/libxl.py xen-4.16.2/tools/python/xen/migration/libxl.py
1568 --- xen-4.16.2.orig/tools/python/xen/migration/libxl.py 2022-08-18 13:47:46.000000000 +0200
1569 +++ xen-4.16.2/tools/python/xen/migration/libxl.py 2023-07-23 20:27:33.485877743 +0200
1571 -#!/usr/bin/env python
1572 # -*- coding: utf-8 -*-
1575 diff -urN xen-4.16.2.orig/tools/python/xen/migration/public.py xen-4.16.2/tools/python/xen/migration/public.py
1576 --- xen-4.16.2.orig/tools/python/xen/migration/public.py 2022-08-18 13:47:46.000000000 +0200
1577 +++ xen-4.16.2/tools/python/xen/migration/public.py 2023-07-23 20:27:33.485877743 +0200
1579 -#!/usr/bin/env python
1580 # -*- coding: utf-8 -*-
1583 diff -urN xen-4.16.2.orig/tools/python/xen/migration/tests.py xen-4.16.2/tools/python/xen/migration/tests.py
1584 --- xen-4.16.2.orig/tools/python/xen/migration/tests.py 2022-08-18 13:47:46.000000000 +0200
1585 +++ xen-4.16.2/tools/python/xen/migration/tests.py 2023-07-23 20:27:33.485877743 +0200
1587 -#!/usr/bin/env python
1588 # -*- coding: utf-8 -*-
1592 (libxc.X86_TSC_INFO_FORMAT, 24),
1593 (libxc.HVM_PARAMS_ENTRY_FORMAT, 16),
1594 (libxc.HVM_PARAMS_FORMAT, 8),
1595 + (libxc.X86_CPUID_POLICY_FORMAT, 24),
1596 + (libxc.X86_MSR_POLICY_FORMAT, 16),
1598 self.assertEqual(calcsize(fmt), sz)
1601 (libxl.EMULATOR_HEADER_FORMAT, 8),
1603 self.assertEqual(calcsize(fmt), sz)
1607 - suite = unittest.TestSuite()
1609 - suite.addTest(unittest.makeSuite(TestLibxc))
1610 - suite.addTest(unittest.makeSuite(TestLibxl))
1614 -if __name__ == "__main__":
1616 diff -urN xen-4.16.2.orig/tools/python/xen/migration/verify.py xen-4.16.2/tools/python/xen/migration/verify.py
1617 --- xen-4.16.2.orig/tools/python/xen/migration/verify.py 2022-08-18 13:47:46.000000000 +0200
1618 +++ xen-4.16.2/tools/python/xen/migration/verify.py 2023-07-23 20:27:33.485877743 +0200
1620 -#!/usr/bin/env python
1621 # -*- coding: utf-8 -*-
1624 diff -urN xen-4.16.2.orig/tools/python/xen/migration/xl.py xen-4.16.2/tools/python/xen/migration/xl.py
1625 --- xen-4.16.2.orig/tools/python/xen/migration/xl.py 2022-08-18 13:47:46.000000000 +0200
1626 +++ xen-4.16.2/tools/python/xen/migration/xl.py 2023-07-23 20:27:33.485877743 +0200
1628 -#!/usr/bin/env python
1629 # -*- coding: utf-8 -*-
1632 diff -urN xen-4.16.2.orig/tools/python/xen/util.py xen-4.16.2/tools/python/xen/util.py
1633 --- xen-4.16.2.orig/tools/python/xen/util.py 2022-08-18 13:47:46.000000000 +0200
1634 +++ xen-4.16.2/tools/python/xen/util.py 2023-07-23 20:27:33.486877758 +0200
1636 -#!/usr/bin/env python
1637 # -*- coding: utf-8 -*-
1640 diff -urN xen-4.16.2.orig/tools/Rules.mk xen-4.16.2/tools/Rules.mk
1641 --- xen-4.16.2.orig/tools/Rules.mk 2022-08-18 13:47:46.000000000 +0200
1642 +++ xen-4.16.2/tools/Rules.mk 2023-07-23 20:27:33.514878153 +0200
1644 CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
1646 INSTALL_PYTHON_PROG = \
1647 - $(XEN_ROOT)/tools/python/install-wrap "$(PYTHON_PATH)" $(INSTALL_PROG)
1648 + $(XEN_ROOT)/tools/python/install-wrap "$(PYTHON_PATH) -s" $(INSTALL_PROG)
1651 $(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS_$*.opic) -fPIC -c -o $@ $< $(APPEND_CFLAGS)
1652 diff -urN xen-4.16.2.orig/tools/xenmon/xenmon.py xen-4.16.2/tools/xenmon/xenmon.py
1653 --- xen-4.16.2.orig/tools/xenmon/xenmon.py 2022-08-18 13:47:46.000000000 +0200
1654 +++ xen-4.16.2/tools/xenmon/xenmon.py 2023-07-23 20:27:33.514878153 +0200
1656 # This program is free software; you can redistribute it and/or modify
1657 # it under the terms of the GNU General Public License as published by
1658 # the Free Software Foundation; under version 2 of the License.
1661 # This program is distributed in the hope that it will be useful,
1662 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1663 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1664 # GNU General Public License for more details.
1667 # You should have received a copy of the GNU General Public License
1668 # along with this program; If not, see <http://www.gnu.org/licenses/>.
1669 #####################################################################
1671 parser.add_option("-p", "--prefix", dest="prefix",
1672 default = "log", help="prefix to use for output files")
1673 parser.add_option("-t", "--time", dest="duration",
1674 - action="store", type="int", default=10,
1675 + action="store", type="int", default=10,
1676 help="stop logging to file after this much time has elapsed (in seconds). set to 0 to keep logging indefinitely")
1677 parser.add_option("-i", "--interval", dest="interval",
1678 action="store", type="int", default=1000,
1680 return [total/(float(passed)/10**9), avg]
1682 def stats(self, passed):
1683 - return [self.gotten_stats(passed), self.allocated_stats(passed), self.blocked_stats(passed),
1684 + return [self.gotten_stats(passed), self.allocated_stats(passed), self.blocked_stats(passed),
1685 self.waited_stats(passed), self.ec_stats(passed), self.io_stats(passed)]
1687 # report values over desired interval
1688 @@ -187,13 +187,13 @@
1690 for i in range(0, NDOMAINS):
1691 dominfos[i] = DomainInfo()
1694 passed = 1 # to prevent zero division
1701 while passed < duration:
1702 for i in range(0, NDOMAINS):
1705 dominfos[i].blocked_sum += samples[curid][3*NDOMAINS + i]
1706 dominfos[i].exec_count += samples[curid][4*NDOMAINS + i]
1707 dominfos[i].iocount_sum += samples[curid][5*NDOMAINS + i]
1710 passed += samples[curid][6*NDOMAINS]
1711 lost_samples.append(samples[curid][6*NDOMAINS + 2])
1712 ffp_samples.append(samples[curid][6*NDOMAINS + 3])
1714 cpu_10sec_usage = 0.0
1716 global dom_in_use, options
1719 # mmap the (the first chunk of the) file
1720 shmf = open(SHM_FILE, "r+")
1721 shm = mmap.mmap(shmf.fileno(), QOS_DATA_SIZE)
1724 stdscr.timeout(1000)
1725 [maxy, maxx] = stdscr.getmaxyx()
1734 # calculate starting and ending datapoints; never look at "next" since
1735 - # it represents live data that may be in transition.
1736 + # it represents live data that may be in transition.
1738 if next + 10 < NSAMPLES:
1742 if h1[dom][0][1] > 0 or domain_id[dom] == IDLE_DOMAIN:
1747 display_domain_id(stdscr, row, col, domain_id[dom])
1751 if dom != IDLE_DOMAIN:
1752 cpu_1sec_usage = cpu_1sec_usage + h1[dom][0][1]
1756 if options.allocated:
1761 display_domain_id(stdscr, row, col, domain_id[dom])
1765 display(stdscr, row, col, "%d/s" % h2[dom][4])
1767 @@ -490,14 +490,14 @@
1768 display(stdscr, row, 1, star)
1769 display(stdscr, row, 2, TOTALS % (total_h2_cpu, total_h1_cpu))
1771 -# display(stdscr, row, 2,
1772 -# "\tFFP: %d (Min: %d, Max: %d)\t\t\tFFP: %d (Min: %d, Max %d)" %
1773 +# display(stdscr, row, 2,
1774 +# "\tFFP: %d (Min: %d, Max: %d)\t\t\tFFP: %d (Min: %d, Max %d)" %
1775 # (math.ceil(f2[1]), f2[0], f2[2], math.ceil(f1[1]), f1[0], f1[2]), _c.A_BOLD)
1779 - display(stdscr, row, 2,
1780 - "\tRecords lost: %d (Min: %d, Max: %d)\t\t\tRecords lost: %d (Min: %d, Max %d)" %
1781 + display(stdscr, row, 2,
1782 + "\tRecords lost: %d (Min: %d, Max: %d)\t\t\tRecords lost: %d (Min: %d, Max %d)" %
1783 (math.ceil(l2[1]), l2[0], l2[2], math.ceil(l1[1]), l1[0], l1[2]), _c.A_BOLD)
1785 # grab a char from tty input; exit if interrupt hit
1786 @@ -505,11 +505,11 @@
1797 # c = cycle to a new cpu of interest
1799 cpu = (cpu + 1) % ncpu
1811 h1[dom][2][0], h1[dom][2][1], h1[dom][2][2],
1812 h1[dom][3][0], h1[dom][3][1], h1[dom][3][2],
1815 h1[dom][5][0], h1[dom][5][1]))
1816 outfiles[dom].flush()
1819 options.mspersample > options.duration * 1000:
1820 parser.error("option --ms_per_sample: too large (> %d ms)" %
1821 (options.duration * 1000))
1826 show_livestats(options.cpu)