1. 24 4月, 2013 4 次提交
    • P
      qemu: Split out code to generate VNC command line · 66135c72
      Peter Krempa 提交于
      Decrease size of qemuBuildGraphicsCommandLine() by splitting out
      spice-related code into qemuBuildGraphicsVNCCommandLine().
      
      This patch also fixes 2 possible memory leaks on error path in the code
      that was split-out. The buffer containing the already generated options
      and a listen address string could be leaked.
      
      Also break a few very long lines and reflow code that fits now.
      66135c72
    • P
      qemu: Split out code to generate SPICE command line · d05b6844
      Peter Krempa 提交于
      Decrease size of qemuBuildGraphicsCommandLine() by splitting out
      spice-related code into qemuBuildGraphicsSPICECommandLine().
      
      This patch also fixes 2 possible memory leaks on error path in the code
      that was split-out. The buffer containing the already generated options
      and a listen address string could be leaked.
      
      Also break a few very long lines.
      d05b6844
    • J
      qemu: Use -machine accel=tcg|kvm when available · 6d480485
      Jiri Denemark 提交于
      This is a better interface to choose accelerator than guessing whether
      we should enable or disable kvm to get the right one.
      6d480485
    • J
      cfe24c1a
  2. 23 4月, 2013 8 次提交
    • D
      Switch to a more extensible annotation system for RPC protocols · a98541bf
      Daniel P. Berrange 提交于
      Currently the RPC protocol files can contain annotations after
      the protocol enum eg
      
         REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_CHILDREN_NAMES = 247, /* autogen autogen priority:high */
      
      This is not very extensible as the number of annotations grows.
      Change it to use
      
          /**
           * @generate: both
           * @priority: high
           */
         REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_CHILDREN_NAMES = 247,
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      a98541bf
    • P
      qemu: Fix setting of memory tunables · fa006c4f
      Peter Krempa 提交于
      Refactoring done in 19c6ad9a didn't
      correctly take into account the order cgroup limit modification needs to
      be done in. This resulted into errors when decreasing the limits.
      
      The operations need to take place in this order:
      
      decrease hard limit
      change swap hard limit
      
      or
      
      change swap hard limit
      increase hard limit
      
      This patch also fixes the check if the hard_limit is less than
      swap_hard_limit to print better error messages. For this purpose I
      introduced a helper function virCompareLimitUlong to compare limit
      values where value of 0 is equal to unlimited. Additionally the check is
      now applied also when the user does not provide all of the tunables
      through the API and in that case the currently set values are used.
      
      This patch resolves:
      https://bugzilla.redhat.com/show_bug.cgi?id=950478
      fa006c4f
    • J
      fd2e5530
    • J
      qemu: Ignore libvirt logs when reading QEMU error output · 6d1b3edc
      Jiri Denemark 提交于
      When QEMU fails to start, libvirt read its error output and reports it
      back in an error message. However, when libvirtd is configured to log
      debug messages, one would get the following unhelpful garbage:
      
          virsh # start cd
          error: Failed to start domain cd
          error: internal error process exited while connecting to monitor: \
            2013-04-22 14:24:54.214+0000: 2194219: debug : virFileClose:72 : \
            Closed fd 21
          2013-04-22 14:24:54.214+0000: 2194219: debug : virFileClose:72 : \
            Closed fd 27
          2013-04-22 14:24:54.215+0000: 2194219: debug : virFileClose:72 : \
            Closed fd 3
          2013-04-22 14:24:54.215+0000: 2194220: debug : virExec:602 : Run \
            hook 0x7feb8f600bf0 0x7feb86ef9300
          2013-04-22 14:24:54.215+0000: 2194220: debug : qemuProcessHook:2507 \
            : Obtaining domain lock
          2013-04-22 14:24:54.216+0000: 2194220: debug : \
            virDomainLockProcessStart:170 : plugin=0x7feb780261f0 \
            dom=0x7feb7802a360 paused=1 fd=0x7feb86ef8ec4
          2013-04-22 14:24:54.216+0000: 2194220: debug : \
            virDomainLockManagerNew:128 : plugin=0x7feb780261f0 \
            dom=0x7feb7802a360 withResources=1
          2013-04-22 14:24:54.216+0000: 2194220: debug : \
            virLockManagerPluginGetDriver:297 : plugin=0x7feb780261f0
          2013-04-22 14:24:54.216+0000: 2194220: debug : \
            virLockManagerNew:321 : driver=0x7feb8ef08640 type=0 nparams=5 \
            params=0x7feb86ef8d60 flags=0
          2013-04-22 14:24:54.216+000
      
      instead of (the output with this patch applied):
      
          virsh # start cd
          error: Reconnected to the hypervisor
          error: Failed to start domain cd
          error: internal error process exited while connecting to monitor: \
            char device redirected to /dev/pts/33 (label charserial0)
          qemu-system-x86_64: -drive file=/home/vm/systemrescuecd-x86-1.2.0.\
            iso,if=none,id=drive-ide0-1-0,readonly=on,format=raw,cache=none: \
            could not open disk image /home/vm/systemrescuecd-x86-1.2.0.iso: \
            Permission denied
      6d1b3edc
    • J
      e4bdba8d
    • G
      update input ip processing · 1e5306c7
      Gene Czarcinski 提交于
      1. Handle invalid ULong prefix specified.
      When parsing for @prefix as a ULong, a -2 can be returned
      if the specification is not a valid ULong.
      
      2.  Error out if address= is not specified.
      
      3.  Merge netmask process/tests under family tests.
      
      4. Max sure that prefix does not exceed maximum.
      .
      Signed-off-by: NGene Czarcinski <gene@czarc.net>
      1e5306c7
    • G
      create virSocketAddrGetIpPrefix utility function · bd7c7c1b
      Gene Czarcinski 提交于
      Create the utility function virSocketAddrGetIpPrefix() to
      determine the prefix for this network.  The code in this
      function was adapted from virNetworkIpDefPrefix().
      
      Update virNetworkIpDefPrefix() in src/conf/network_conf.c
      to use the new utility function.
      Signed-off-by: NGene Czarcinski <gene@czarc.net>
      bd7c7c1b
    • D
      Replace more cases of /system with /machine · 1e05073f
      Daniel P. Berrange 提交于
      The change in commit aed49863
      was incomplete, missing a couple of cases of /system. This
      caused failure to start VMs.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      1e05073f
  3. 22 4月, 2013 3 次提交
    • H
      sheepdog: Omit braces with a single-line body · 0f35e001
      Harry Wei 提交于
      libvirt/HACKING suggests omitting braces with a
      single-line body; this patch fixes the coding style
      problem for the Sheepdog storage backend driver.
      Signed-off-by: NHarry Wei <harryxiyou@gmail.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      0f35e001
    • D
      Change default resource partition to /machine · aed49863
      Daniel P. Berrange 提交于
      After discussions with systemd developers it was decided that
      a better default policy for resource partitions is to have
      3 default partitions at the top level
      
         /system   - system services
         /machine - virtual machines / containers
         /user    - user login session
      
      This ensures that the default policy isolates guest from
      user login sessions & system services, so a mis-behaving
      guest can't consume 100% of CPU usage if other things are
      contending for it.
      
      Thus we change the default partition from /system to
      /machine
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      aed49863
    • O
      qemu: Fix the wrong expression · a71ec988
      Osier Yang 提交于
      Wrong use of the parentheses causes "rc" always having a boolean value,
      either "1" or "0", and thus we can't get the detailed error message
      when it fails:
      
      Before (I only have 1 node):
      % virsh numatune f18 --nodeset 12
      error: Unable to change numa parameters
      error: unable to set numa tunable: Unknown error -1
      
      After:
      virsh numatune f18 --nodeset 12
      error: Unable to change numa parameters
      error: unable to set numa tunable: Invalid argument
      a71ec988
  4. 20 4月, 2013 5 次提交
  5. 19 4月, 2013 20 次提交
    • J
      qemu: move PCI address check out of qemuPCIAddressAsString · db180a1d
      Ján Tomko 提交于
      Create a new function qemuPCIAddressValidate and call it everywhere
      the user might supply an incorrect address:
      * qemuCollectPCIAddress for domain definition
      * qemuDomainPCIAddressEnsureAddr and ReleaseSlot for hotplug
      
      Slot and function shouldn't be wrong at this point, since values
      out of range should be rejected by the XML parser.
      db180a1d
    • J
      qemu: QEMU_PCI constant consistency · 62940d6c
      Ján Tomko 提交于
      Change QEMU_PCI_ADDRESS_LAST_SLOT to the number of slots in the bus,
      not the maximum slot value, to match QEMU_PCI_ADDRESS_LAST_FUNCTION
      and rename them both to have _LAST at the end.
      62940d6c
    • J
      qemu: print PCI address hexadecimally in errors · ba8b8ddb
      Ján Tomko 提交于
      Use the same formatting as we do for XML in error and debug outputs.
      ba8b8ddb
    • J
      qemu: make qemuComparePCIDevice aware of multiple buses · 8e5928de
      Ján Tomko 提交于
      Bus and domain need to be checked as well, otherwise we might
      get false positives when searching for multi-function devices.
      8e5928de
    • P
      conf: Reword error message to be more universal · bcefb507
      Peter Krempa 提交于
      The error message reported when attempting to change/get persistent
      configuration of a transient domain suggests that changes are being
      made. Reword it to suit getter APIs too.
      
      Before:
      $ virsh vcpucount transient-domain --config
      error: Requested operation is not valid: cannot change persistent config of a transient domain
      
      After:
      $ virsh vcpucount transient-domain --config
      error: Requested operation is not valid: transient domains do not have any persistent config
      bcefb507
    • P
      network: bridge_driver: don't lose transient networks on daemon restart · 446dd66b
      Peter Krempa 提交于
      Until now tranisent networks weren't really useful as libvirtd wasn't
      able to remember them across restarts. This patch adds support for
      loading status files of transient networks (that already were generated)
      so that the status isn't lost.
      
      This patch chops up virNetworkObjUpdateParseFile and turns it into
      virNetworkLoadState and a few friends that will help us to load status
      XMLs and refactors the functions that are loading the configs to use
      them.
      446dd66b
    • J
      cpu: Rename PowerPCUpdate and PowerPCDataFree functions · f1a1ebf1
      Jiri Denemark 提交于
      For consistency with other functions in PowerPC CPU driver, the two
      functions are renamed as ppcUpdate and ppcDataFree, respectively.
      f1a1ebf1
    • J
      cpu: Remove hardcoded list of PowerPC models · 7a4f1238
      Jiri Denemark 提交于
      The cpu_map.xml file is there to separate CPU model definitions from the
      code. Having the only interesting data for PowerPC models only in the
      source code. This patch moves this data to the XML file and removes the
      hardcoded list completely.
      7a4f1238
    • J
      cpu: Reimplement PowerPCDecode · f42ecaf1
      Jiri Denemark 提交于
      PowerPC CPUs are either identical or incompatible and thus we just need
      to look up the right model for given PVR without pretending we have
      several candidates which we may choose from.
      
      The function is also renamed as ppcDecode to match other functions in
      PowerPC CPU driver.
      f42ecaf1
    • J
      cpu: Reimplement PowerPCBaseline · fdf6efde
      Jiri Denemark 提交于
      Baseline API is supposed to return guest CPU definition that can be used
      on any of the provided host CPUs. Since PowerPC CPUs are either
      identical or incompatible, the API just needs to check that all provided
      CPUs are identical. Previous implementation was completely bogus.
      
      The function is also renamed as ppcBaseline to match other functions in
      PowerPC CPU driver.
      fdf6efde
    • J
      cpu: Fix loading PowerPC vendor from cpu_map.xml · ba8ba247
      Jiri Denemark 提交于
      When ppcVendorLoad fails to parse the vendor element for whatever
      reason, it is supposed to ignore it and return 0 rather than -1. The
      patch also removes PowerPC vendor string from the XML as it is not
      actually used for anything.
      ba8ba247
    • J
      cpu: Fix PowerPCNodeData · 70349cb9
      Jiri Denemark 提交于
      Make getting node CPU data for PowerPC unsupported on other
      architectures. The function is also renamed as ppcNodeData to match
      other functions in PowerPC CPU driver.
      70349cb9
    • J
      cpu: Make comparing PowerPC CPUs easier to read · 6af5a062
      Jiri Denemark 提交于
      Revert the condition to make it easier to read. The function is also
      renamed as ppcCompare to match other functions in PowerPC CPU driver.
      6af5a062
    • J
      cpu: Introduce cpuModelIsAllowed internal API · 16c6b60c
      Jiri Denemark 提交于
      The API can be used to check if the model is on the supported models
      list, which needs to be done in several places.
      16c6b60c
    • P
      virsh-domain: Refactor cmdVcpucount and fix output on inactive domains · 642261a8
      Peter Krempa 提交于
      This patch factors out the vCPU count retrieval including fallback means
      into vshCPUCountCollect() and removes the duplicated code to retrieve
      individual counts.
      
      The --current flag (this flag is assumed by default) now works also with
      --maximum or --active without the need to explicitly specify the state
      of the domain that is requested.
      
      This patch also fixes the output of "virsh vcpucount domain" on inactive
      domains:
      
      Before:
      $ virsh vcpucount domain
      maximum      config         4
      error: Requested operation is not valid: domain is not running
      current      config         4
      error: Requested operation is not valid: domain is not running
      
      After:
      $virsh vcpucount domain
      maximum      config         4
      current      config         4
      
      .. and for transient domains too:
      
      Before:
      $ virsh vcpucount transient-domain
      error: Requested operation is not valid: cannot change persistent config of a transient domain
      maximum      live           3
      error: Requested operation is not valid: cannot change persistent config of a transient domain
      current      live           1
      
      After:
      $ virsh vcpucount transient-domain
      maximum      live           3
      current      live           1
      642261a8
    • L
      Set legacy USB option with default for ppc64. · 88c6159c
      Li Zhang 提交于
      Currently, -device xxx still doesn't work well for ppc64 platform.
      It's better use legacy USB option with default for ppc64.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      88c6159c
    • J
      qemu: fix default spice password setting · 4327df7e
      Ján Tomko 提交于
      Set spice password even if default VNC password hasn't been set.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=953720
      4327df7e
    • P
      78d7c3c5
    • P
      util: allow using virCommandAllowCap with setuid helpers · 5c1cfea4
      Paolo Bonzini 提交于
      When running unprivileged, virSetUIDGIDWithCaps will fail because it
      tries to add the requested capabilities to the permitted and effective
      sets.
      
      Detect this case, and invoke the child with cleared permitted and
      effective sets.  If it is a setuid program, it will get them.
      
      Some care is needed also because you cannot drop capabilities from the
      bounding set without CAP_SETPCAP.  Because of that, ignore errors from
      setting the bounding set.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      5c1cfea4
    • P
      util: simplify virSetUIDGIDWithCaps · 65871845
      Paolo Bonzini 提交于
      The need_prctl variable is not really needed.  If it is false,
      capng_apply will be called twice with the same set, causing
      a little extra work but no problem.  This keeps the code a bit
      simpler.
      
      It is also clearer to invoke capng_apply(CAPNG_SELECT_BOUNDS)
      separately, to make sure it is done while we have CAP_SETPCAP.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      65871845