summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
| * memory: exit when hugepage allocation fails if mem-preallocLuiz Capitulino2016-01-261-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | When -mem-prealloc is passed on the command-line, the expected behavior is to exit if the hugepage allocation fails. However, this behavior is broken since commit cc57501dee which made hugepage allocation fall back to regular ram in case of faliure. This commit restores the expected behavior for -mem-prealloc. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Message-Id: <20160122091501.75bbd42a@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * cpus: use broadcast on qemu_pause_condDr. David Alan Gilbert2016-01-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Jiri saw a hang on pause_all_vcpus called from postcopy_start, where the cpus are all apparently stopped ('stopped' flag set) but pause_all_vcpus is still stuck on a cond_wait on qemu_paused_cond. We suspect this is happening if a qmp_stop is called at about the same time as the postcopy code calls that pause_all_vcpus; although they both should have the main lock held, Paolo spotted the cond_wait unlocks the global lock so perhaps they both could end up waiting at the same time? Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reported-by: Jiri Denemark <jdenemar@redhat.com> Message-Id: <1453716498-27238-1-git-send-email-dgilbert@redhat.com> Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Add optparse descriptionJanosch Frank2016-01-261-1/+28
| | | | | | | | | | | | | | | | | | | | | | | | Added a description text that explains what the script does and which requirements have to be met to let it run. The help formatter class is needed as the default optparse formatter makes the text unreadable. Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-35-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Add interactive filteringJanosch Frank2016-01-261-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | Interactively changing the filter is much more useful than the drilldown, because it is more versatile. With this patch, the filter can be changed by pressing 'f' in the text ui and entering a new filter regex. Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-34-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Fixup filteringJanosch Frank2016-01-261-11/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When filtering, the group leader event should not be disabled, as all other events under it will also be disabled. Also we should make sure that values from disabled fields will not be displayed. This also filters the fields from the log and batch output for better readability. Also the drilldown update now directly checks for the stats' field filter and (un)sets drilldown accordingly. Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-33-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Fix rlimit for unprivileged usersJanosch Frank2016-01-261-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Setting the hard limit as a unprivileged user either returns an error when it is higher than the current one or irreversibly sets it lower. Therefore we leave the hardlimit untouched as long as we don't need to raise it as this needs CAP_SYS_RESOURCE. This gives admins the possibility to run the script as an unprivileged user to increase security. Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-32-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Read event values as u64Janosch Frank2016-01-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The struct read_format, which denotes the returned values on a read states that the values are u64 and not long long which is used for struct unpacking. Therefore the 'q' long long formatter was exchanged with 'Q' which is the format for u64 data. Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-31-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Cleanup and pre-init perf_event_attrJanosch Frank2016-01-261-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | All initializations of the ctypes struct that don't need additional information were moved to its init method. The unneeded initializations for sample_type and sample_period were removed as they do not affect the counters that are read. This improves readability of the setup_event_attribute by halfing its LOC. Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-30-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Fix output formattingJanosch Frank2016-01-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | The key names in log mode were capped to 10 characters which is not enough for distinguishing between keys. Capping was therefore removed. In batch mode the spacing between keys and values was too narrow and therefore had to be extended to 42. Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-29-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Make tui function a classJanosch Frank2016-01-261-45/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The tui function itself had a few sub-functions and therefore basically already was class-like. Making it an actual one with proper methods improved readability. The curses wrapper was dropped in favour of __entry/exit__ methods that implement the same behaviour. Also renamed single character variable name, so the name reflects the content. Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-28-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Remove unneeded X86_EXIT_REASONSJanosch Frank2016-01-261-5/+0Star
| | | | | | | | | | | | | | | | | | The architecture detection method directly accesses vmx and smv exit reason constants. Therefore we don't need it anymore. Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-27-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Group arch specific dataJanosch Frank2016-01-261-58/+67
| | | | | | | | | | | | | | | | | | | | Using global variables and multiple initialization functions for arch specific data makes the code hard to read. By grouping them in the Arch classes we encapsulate and initialize them in one place. Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-26-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Cleanup of Event classJanosch Frank2016-01-261-24/+43
| | | | | | | | | | | | | | | | | | | | Added additional newlines for readability. Factored out attribute and event setup code into own methods. Exchanged file() with preferred open(). Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-25-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Cleanup of Groups classJanosch Frank2016-01-261-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | Introduced separating newlines for readability and removed special treatment/variable of the group leader. Renamed fmt to read_format. The group leader's file descriptor will not be turned into a file object anymore, instead os.read is used to read from the descriptor. Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-24-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Cleanup of Stats classJanosch Frank2016-01-261-21/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Converted class definition to new style and renamed improper named variables. Introduced property for fields_filter. Moved member variable declaration to init, so one can see all class variables when reading the init method. Completely clear the values dict, as we don't need to keep single values. Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-23-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Encapsulate filters variableJanosch Frank2016-01-261-9/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The variable was only used in one class but still was defined globally. Additionaly the detect_platform routine which prepares the data that goes into the variable was called on each start of the script, no matter if the class was needed. To make the variable local to the TracepointProvider class, a new function that calls detect_platform and returns the filters was introduced. Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-22-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Cleanup cpu list retrievalJanosch Frank2016-01-261-11/+20
| | | | | | | | | | | | | | | | | | Reading /sys/devices/system/cpu/online makes opening the cpu directories unnecessary and works on more/older systems. Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-21-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Cleanup of TracepointProviderJanosch Frank2016-01-261-19/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Variables with bad names like f and m were renamed to their full name, so it is clearer which data they contain. Unneeded variables were removed and the field generating code was moved in an own function. dict.iteritems() was removed as directly iterating over a dictionary also yields the needed keys. Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-20-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Introduce properties for providersJanosch Frank2016-01-261-8/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As previous commit authors used a mixture of setters/getters and direct access to class variables consolidating them the python way improved readability. Properties allow us to assign a value to a class variable through a setter without the need to call the setter ourselves. Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-19-git-send-email-frankja@linux.vnet.ibm.com> [prop.setter is new in Python 2.6, which is the earliest supported version. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Rename _perf_event_openJanosch Frank2016-01-261-2/+2
| | | | | | | | | | | | | | | | | | | | The underscore in front of the function name does not comply with the python coding guidelines. Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-18-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Make cpu detection a functionJanosch Frank2016-01-261-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | The online cpus detection method is in the Stats class but does not use any class variables. Moving it out of the class to the platform detection function makes the Stats class more readable. Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-17-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Cleanup of platform detectionJanosch Frank2016-01-261-16/+13Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | s390 machines can also be detected via uname -m, i.e. python's os.uname, no need for more complicated checks. Calling uname once and saving its value for multiple checks is perfectly sufficient. We don't expect the machine's architecture to change when the script is running anyway. On multi-cpu systems x86_init currently will get called multiple times, returning makes sure we don't waste cicles on that. Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-16-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Set sensible no. files rlimitJanosch Frank2016-01-261-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As num cpus * 1000 is NOT a sensible rlimit, we need to calculate a more accurate rlimit. The number of open files is directly dependent on the cpu count and on the number of trace points per cpu. A additional constant works as a buffer for files that are needed by python or do get opened when the script runs. Hence we have: cpus * traces + constant Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-15-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Fixup syscall error reportingJanosch Frank2016-01-261-5/+4Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In 2008 a patch was written that introduced ctypes.get_errno() and set_errno() as official interfaces to the libc errno variable. Using them we can avoid accessing private libc variables. The patch was included in python 2.6. Also we need to raise the right exception, with the right parameters and a helpful message. Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-14-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Moved DebugfsProviderJanosch Frank2016-01-261-12/+12
| | | | | | | | | | | | | | | | | | | | When it is next to the TracepointProvider less scrolling is needed to change related, surrounding code. Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-13-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Rename variables that redefine globalsJanosch Frank2016-01-261-11/+12
| | | | | | | | | | | | | | | | | | | | Filter, id and byte are builtin python modules which should not be redefined by local variables. Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-12-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Fix spaces around keyword assignmentsJanosch Frank2016-01-261-31/+31
| | | | | | | | | | | | | | | | | | | | Keyword assignments should not not have spaces around the equal character according to PEP8. Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-11-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Introduce main functionJanosch Frank2016-01-261-71/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main function should be the main location for initialization and helps encapsulating variables into a scope. This way they don't have to be global and might be mistaken for local ones. As the providers variable is scoped now it can't be accessed from within the Stats class. Hence, the global access to the variable was changed to a local one. Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-10-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Improve debugfs access checkingJanosch Frank2016-01-261-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Access checking with F_OK was replaced with the better readable os.path.exists(). On Linux exists() returns False when the user doesn't have sufficient permissions for statting the directory. Therefore the error message now states that sufficient rights are needed when the check fails. Also added check for /sys/kernel/debug/tracing/. Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-9-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Cleanup of path variablesJanosch Frank2016-01-261-7/+7
| | | | | | | | | | | | | | | | | | | | Paths to debugfs and trace dirs are now specified globally to remove redundancies in the code. Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-8-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Invert dictionariesJanosch Frank2016-01-261-176/+173Star
| | | | | | | | | | | | | | | | | | | | | | | | | | The exit reasons dictionaries were defined number -> value but later on were accessed the other way around. Therefore a invert function inverted them. Defining them the right way removes the need to invert them and therefore also speeds up the script's setup process. Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-7-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Mark globals in functionsJanosch Frank2016-01-261-19/+22
| | | | | | | | | | | | | | | | | | | | Updating globals over the globals().update() method is not the standard way of changing globals. Marking variables as global and modifying them the standard way is better readable. Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-6-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Removed unneeded PERF constantsJanosch Frank2016-01-261-26/+2Star
| | | | | | | | | | | | | | | | | | Only two of the constants are actually needed to set up the events, so the others were removed. All variables that used them were also removed. Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-5-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Make constants uppercaseJanosch Frank2016-01-261-32/+32
| | | | | | | | | | | | | | | | | | | | Constants should be uppercase with separating underscores, as requested in PEP8. This helps identifying them when reading the code. Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-4-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Replaced os.listdir with os.walkJanosch Frank2016-01-261-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | Os.walk gives back lists of directories and files, no need to filter directories from the list that listdir gives back. To make it better understandable a wrapper with docstring was introduced. Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-3-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * scripts/kvm/kvm_stat: Cleanup of multiple importsJanosch Frank2016-01-261-15/+11Star
| | | | | | | | | | | | | | | | | | | | | | | | | | Removed multiple imports of the same module and moved all imports to the top. It is not necessary to import a module each time one of its functions/classes is used. For readability each import should get its own line. Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1452525484-32309-2-git-send-email-frankja@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * qemu-char: avoid leak in qemu_chr_open_pp_fdPaolo Bonzini2016-01-261-5/+6
| | | | | | | | | | | | drv leaks if qemu_chr_alloc returns an error. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * docs: Style the command and its options in the synopsisSitsofe Wheeler2016-01-264-7/+7
| | | | | | | | | | | | Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com> Message-Id: <1452718226-25001-1-git-send-email-sitsofe@yahoo.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * char: introduce support for TLS encrypted TCP chardev backendDaniel P. Berrange2016-01-263-13/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This integrates support for QIOChannelTLS object in the TCP chardev backend. If the 'tls-creds=NAME' option is passed with the '-chardev tcp' argument, then it will setup the chardev such that the client is required to establish a TLS handshake when connecting. There is no support for checking the client certificate against ACLs in this initial patch. This is pending work to QOM-ify the ACL object code. A complete invocation to run QEMU as the server for a TLS encrypted serial dev might be $ qemu-system-x86_64 \ -nodefconfig -nodefaults -device sga -display none \ -chardev socket,id=s0,host=127.0.0.1,port=9000,tls-creds=tls0,server \ -device isa-serial,chardev=s0 \ -object tls-creds-x509,id=tls0,endpoint=server,verify-peer=off,\ dir=/home/berrange/security/qemutls To test with the gnutls-cli tool as the client: $ gnutls-cli --priority=NORMAL -p 9000 \ --x509cafile=/home/berrange/security/qemutls/ca-cert.pem \ 127.0.0.1 If QEMU was told to use 'anon' credential type, then use the priority string 'NORMAL:+ANON-DH' with gnutls-cli Alternatively, if setting up a chardev to operate as a client, then the TLS credentials registered must be for the client endpoint. First a TLS server must be setup, which can be done with the gnutls-serv tool $ gnutls-serv --priority=NORMAL -p 9000 --echo \ --x509cafile=/home/berrange/security/qemutls/ca-cert.pem \ --x509certfile=/home/berrange/security/qemutls/server-cert.pem \ --x509keyfile=/home/berrange/security/qemutls/server-key.pem Then QEMU can connect with $ qemu-system-x86_64 \ -nodefconfig -nodefaults -device sga -display none \ -chardev socket,id=s0,host=127.0.0.1,port=9000,tls-creds=tls0 \ -device isa-serial,chardev=s0 \ -object tls-creds-x509,id=tls0,endpoint=client,\ dir=/home/berrange/security/qemutls Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1453202071-10289-5-git-send-email-berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * char: don't assume telnet initialization will not blockDaniel P. Berrange2016-01-261-18/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The current code for doing telnet initialization is writing to a socket without checking the return status. While it is highly unlikely to be a problem when writing to a bare socket, as the buffers are large enough to prevent blocking, this cannot be assumed safe with TLS sockets. So write the telnet initialization code into a memory buffer and then use an I/O watch to fully send the data. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1453202071-10289-4-git-send-email-berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * char: convert from GIOChannel to QIOChannelDaniel P. Berrange2016-01-262-396/+254Star
| | | | | | | | | | | | | | | | | | | | | | | | In preparation for introducing TLS support to the TCP chardev backend, convert existing chardev code from using GIOChannel to QIOChannel. This simplifies the chardev code by removing most of the OS platform conditional code for dealing with file descriptor passing. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1453202071-10289-3-git-send-email-berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * char: remove fixed length filename allocationDaniel P. Berrange2016-01-261-43/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A variety of places were snprintf()ing into a fixed length filename buffer. Some of the buffers were stack allocated, while another was heap allocated with g_malloc(). Switch them all to heap allocated using g_strdup_printf() avoiding arbitrary length restrictions. This also facilitates later patches which will want to populate the filename by calling external functions which do not support use of a pre-allocated buffer. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1453202071-10289-2-git-send-email-berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* | Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into stagingPeter Maydell2016-01-269-117/+271
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | # gpg: Signature made Mon 25 Jan 2016 19:39:58 GMT using RSA key ID AAFC390E # gpg: Good signature from "John Snow (John Huston) <jsnow@redhat.com>" * remotes/jnsnow/tags/ide-pull-request: fdc: change auto fallback drive for ISA FDC to 288 qtest/fdc: Support for 2.88MB drives fdc: rework pick_geometry fdc: add physical disk sizes fdc: add drive type option fdc: Add fallback option fdc: add pick_drive fdc: Throw an assertion on misconfigured fd_formats table fdc: add disk field fdc: add drive type qapi enum fdc: reduce number of pick_geometry arguments fdc: move pick_geometry ide: Correct the CHS 'cyls_max' limit to be 65535 Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * | fdc: change auto fallback drive for ISA FDC to 288John Snow2016-01-252-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 2.88 drive is more suitable as a default because it can still read 1.44 images correctly, but the reverse is not true. Since there exist virtio-win drivers that are shipped on 2.88 floppy images, this patch will allow VMs booted without a floppy disk inserted to later insert a 2.88MB floppy and have that work. This patch has been tested with msdos, freedos, fedora, windows 8 and windows 10 without issue: if problems do arise for certain guests being unable to cope with 2.88MB drives as the default, they are in the minority and can use type=144 as needed (or insert a proper boot medium and omit type=144/288 or use type=auto) to obtain different drive types. As icing, the default will remain auto/144 for any pre-2.6 machine types, hopefully minimizing the impact of this change in legacy hw to basically zero. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1453495865-9649-13-git-send-email-jsnow@redhat.com
| * | qtest/fdc: Support for 2.88MB drivesJohn Snow2016-01-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The old test assumes a 1.44MB drive. Assert that the QEMU default drive is now either 1.44 or 2.88. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1453495865-9649-12-git-send-email-jsnow@redhat.com
| * | fdc: rework pick_geometryJohn Snow2016-01-251-20/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This one is the crazy one. fd_revalidate currently uses pick_geometry to tell if the diskette geometry has changed upon an eject/insert event, but it won't allow us to insert a 1.44MB diskette into a 2.88MB drive. This is inflexible. The new algorithm applies a new heuristic to guessing disk geometries that allows us to switch diskette types as long as the physical size matches before falling back to the old heuristic. The old one is roughly: - If the size (sectors) and type matches, choose it. - Fall back to the first geometry that matched our type. The new one is: - If the size (sectors) and type matches, choose it. - If the size (sectors) and physical size match, choose it. - Fall back to the first geometry that matched our type. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1453495865-9649-11-git-send-email-jsnow@redhat.com
| * | fdc: add physical disk sizesJohn Snow2016-01-251-8/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2.88MB capable drives can accept 1.44MB floppies, for instance. To rework the pick_geometry function, we need to know if our current drive can even accept the type of disks we're considering. NB: This allows us to distinguish between all of the "total sectors" collisions between 1.20MB and 1.44MB diskette types, by using the physical drive size as a differentiator. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1453495865-9649-10-git-send-email-jsnow@redhat.com
| * | fdc: add drive type optionJohn Snow2016-01-251-3/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a new explicit Floppy Drive Type option. The existing behavior in QEMU is to automatically guess a drive type based on the media inserted, or if a diskette is not present, arbitrarily assign one. This behavior can be described as "auto." This patch adds the option to pick an explicit behavior: 120, 144, 288 or none. The new "auto" option is intended to mimic current behavior, while the other types pick one explicitly. Set the type given by the CLI during fd_init. If the type remains the default (auto), we'll attempt to scan an inserted diskette if present to determine a type. If auto is selected but no diskette is present, we fall back to a predetermined default (currently 1.44MB to match legacy QEMU behavior.) Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1453495865-9649-9-git-send-email-jsnow@redhat.com
| * | fdc: Add fallback optionJohn Snow2016-01-253-2/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, QEMU chooses a drive type automatically based on the inserted media. If there is no disk inserted, it chooses a 1.44MB drive type. Change this behavior to be configurable, but leave it defaulted to 1.44. This is not earnestly intended to be used by a user or a management library, but rather exists so that pre-2.6 board types can configure it to be a legacy value. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1453495865-9649-8-git-send-email-jsnow@redhat.com
| * | fdc: add pick_driveJohn Snow2016-01-251-10/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Split apart pick_geometry by creating a pick_drive routine that will only ever called during device bring-up instead of relying on pick_geometry to be used in both cases. With this change, the drive field is changed to be 'write once'. It is not altered after the initialization routines exit. media_validated does not need to be migrated. The target VM will just revalidate the media on post_load anyway. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1453495865-9649-7-git-send-email-jsnow@redhat.com