1. 27 10月, 2012 3 次提交
    • E
      build: silence compiler warning about signedness · 60f54f61
      Eric Blake 提交于
      Commit 246143b6 fixed a warning on older gcc, but caused a warning
      on newer gcc.
      
      ../../src/rpc/virnetserverservice.c: In function 'virNetServerServiceNewPostExecRestart':
      ../../src/rpc/virnetserverservice.c:277:41: error: pointer targets in passing argument 3 of 'virJSONValueObjectGetNumberUint' differ in signedness [-Werror=pointer-sign]
      
      * src/rpc/virnetserverservice.c: Use correct types.
      60f54f61
    • E
      build: fix type-punning bug · 246143b6
      Eric Blake 提交于
      With older gcc and 64-bit size_t, the compiler issues a real warning:
      rpc/virnetserverservice.c:277: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
      
      Introduced in commit 0cc79255.  Depending on machine endianness,
      this warning represents a real bug that could mis-interpret the
      value by a factor of 2^32.  I don't know why I couldn't get newer
      gcc to report the same warning message.
      
      * src/rpc/virnetserverservice.c
      (virNetServerServiceNewPostExecRestart): Use temporary instead.
      246143b6
    • L
      parallels: fix build for some older compilers · 73ebd86d
      Laine Stump 提交于
      Found this when building on RHEL5:
      
      parallels/parallels_storage.c: In function 'parallelsStorageOpen':
      parallels/parallels_storage.c:180: error: 'for' loop initial declaration used outside C99 mode
      
      (and similar error in parallels_driver.c). This was in spite of
      configuring with "-Wno-error".
      73ebd86d
  2. 26 10月, 2012 6 次提交
    • C
      daemon: Fix LIBVIRT_DEBUG=1 default output · eba36a38
      Cole Robinson 提交于
      This commit changes the behavior of LIBVIRT_DEBUG=1 libvirtd:
      
      $ git show 7022b091
      commit 7022b091
      Author: Daniel P. Berrange <berrange@redhat.com>
      Date:   Thu Sep 27 13:13:09 2012 +0100
      
          Automatically enable systemd journal logging
      
          Probe to see if the systemd journal is accessible, and if
          so enable logging to the journal by default, rather than
          stderr (current default under systemd).
      
      Previously  'LIBVIRT_DEBUG=1 /usr/sbin/libvirtd' would show all debug
      output to stderr, now it send debug output to the journal.
      
      Only use the journal by default if running in daemon mode, or
      if stdin is _not_ a tty. This should make libvirtd launched from
      systemd use the journal, but preserve the old behavior in most
      situations.
      eba36a38
    • L
      network: fix networkValidate check for default portgroup and vlan · d8aae15a
      Laine Stump 提交于
      This was found during testing of the fix for:
      
         https://bugzilla.redhat.com/show_bug.cgi?id=868483
      
      networkValidate was supposed to check for the existence of multiple
      portgroups and report an error if this was encountered. It did, but
      there were two problems:
      
      1) even though it logged an error, it still returned success, allowing
      the operation to continue.
      
      2) It could exit the portgroup checking loop early (or possibly not
      even do it once) if a vlan tag was supplied in the base network config
      or one of the portgroups.
      
      This patch fixes networkValidate to return failure in addition to
      logging the error, and also changes it to not exit the portgroup
      checking loop early. The logic was a bit off in the checking for vlan
      anyway, and it's intertwined with fixing the early loop exit, so I
      fixed that as well. Now it correctly checks for combinations where a
      <virtualport> is specified in the base network def and <vlan> is given
      in a portgroup, as well as the opposite (<vlan> in base network def
      and <virtualport> in portgroup), and ignores the case of a disallowed
      vlan when using *no* portgroup if there is a default portgroup (since
      in that case there is no way to not use any portgroup).
      d8aae15a
    • V
      virNodeGetCPUMap: Implement driver support · e3ba6703
      Viktor Mihajlovski 提交于
      Driver support added for:
      - test: pretending 8 host CPUS, 3 being online
      - qemu, lxc, openvz, uml: using nodeGetCPUMap
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      e3ba6703
    • V
      virNodeGetCPUMap: Implement support function in nodeinfo · d34439c9
      Viktor Mihajlovski 提交于
      Added an implemention of virNodeGetCPUMap to nodeinfo.c,
      (nodeGetCPUMap) which can be used by all drivers for a Linux
      hypervisor host.
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      d34439c9
    • E
      nodeinfo: improve probing node cpu bitmap · 2f4c5338
      Eric Blake 提交于
      Callers should not need to know what the name of the file to
      be read in the Linux-specific version of nodeGetCPUmap;
      furthermore, qemu cares about online cpus, not present cpus,
      when determining which cpus to skip.
      
      While at it, I fixed the fact that we were computing the maximum
      online cpu id by doing a slow iteration, when what we really want
      to know is the max available cpu.
      
      * src/nodeinfo.h (nodeGetCPUmap): Rename...
      (nodeGetCPUBitmap): ...and simplify signature.
      * src/nodeinfo.c (linuxParseCPUmax): New function.
      (linuxParseCPUmap): Simplify and alter signature.
      (nodeGetCPUBitmap): Change implementation.
      * src/libvirt_private.syms (nodeinfo.h): Reflect rename.
      * src/qemu/qemu_driver.c (qemuDomainGetPercpuStats): Update
      caller.
      2f4c5338
    • E
      bitmap: add virBitmapCountBits · 0711c4b7
      Eric Blake 提交于
      Sometimes it's handy to know how many bits are set.
      
      * src/util/bitmap.h (virBitmapCountBits): New prototype.
      (virBitmapNextSetBit): Use correct type.
      * src/util/bitmap.c (virBitmapNextSetBit): Likewise.
      (virBitmapSetAll): Maintain invariant of clear tail bits.
      (virBitmapCountBits): New function.
      * src/libvirt_private.syms (bitmap.h): Export it.
      * tests/virbitmaptest.c (test2): Test it.
      0711c4b7
  3. 25 10月, 2012 2 次提交
    • J
      Fix build with apparmor · 0111b409
      Jiri Denemark 提交于
      Recent storage patches changed signature of virStorageFileGetMetadata
      and replaced chain with backingChain in virDomainDiskDef.
      0111b409
    • M
      esx: Update version checks for vSphere 5.1 · 1e7cd395
      Matthias Bolte 提交于
      Also remove warnings for upcoming versions. There hadn't been any
      compatibility problems with new ESX version over the whole lifetime
      of the ESX driver, so I don't expect any in the future.
      
      Update documentation to mention vSphere 5.x support.
      1e7cd395
  4. 24 10月, 2012 10 次提交
    • P
      cpu: Add recently added cpu feature flags. · 012f9b19
      Peter Krempa 提交于
      Qemu has added some new feature flags. This patch adds them to libvirt.
      
      The new features are for the cpuid function 0x7 that takes an argument
      in the ecx register. Currently only 0x0 is used as the argument so I was
      lazy and I just clear the registers to 0 before calling cpuid. In future
      when there maybe will be some other possible arguments, we will need to
      improve the cpu detection code to take this into account.
      012f9b19
    • O
      qemu: Prohibit chaning affinity of domain process if placement is 'auto' · a6bd7c22
      Osier Yang 提交于
      On one hand, numad probably will manage the affinity of domain process
      dynamically in future. On the other hand, even numad won't manage it,
      it still could confusion. Let's make things simpler enough to avoid
      the lair for now.
      a6bd7c22
    • O
      qemu: Keep the affinity when creating cgroup for emulator thread · bb81021b
      Osier Yang 提交于
      When the cpu placement model is "auto", it sets the affinity for
      domain process with the advisory nodeset from numad, however,
      creating cgroup for the domain process (called emulator thread
      in some contexts) later overrides that with pinning it to all
      available pCPUs.
      
      How to reproduce:
      
        * Configure the domain with "auto" placement for <vcpu>, e.g.
          <vcpu placement='auto'>4</vcpu>
        * % virsh start dom
        * % cat /proc/$dompid/status
      
      Though the emulator cgroup cause conflicts, but we can't simply
      prohibit creating it, as other tunables are still useful, such
      as "emulator_period", which is used by API
      virDomainSetSchedulerParameter. So this patch doesn't prohibit
      creating the emulator cgroup, but inherit the nodeset from numad,
      and reset the affinity for domain process.
      
      * src/qemu/qemu_cgroup.h: Modify definition of qemuSetupCgroupForEmulator
                                to accept the passed nodenet
      * src/qemu/qemu_cgroup.c: Set the affinity with the passed nodeset
      bb81021b
    • O
      qemu: Add helper to prepare cpumap for affinity setting · 0039a32f
      Osier Yang 提交于
      Abstract the codes to prepare cpumap into a helper a function,
      which can be used later.
      
      * src/qemu/qemu_process.h: Declare qemuPrepareCpumap
      * src/qemu/qemu_process.c: Implement qemuPrepareCpumap, and use it.
      0039a32f
    • V
      virNodeGetCPUMap: Implement wire protocol. · d804d35f
      Viktor Mihajlovski 提交于
      - Defined the wire protocol format for virNodeGetCPUMap and its
        arguments
      - Implemented remote method invocation (remoteNodeGetCPUMap)
      - Implemented method dispatcher (remoteDispatchNodeGetCPUMap)
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d804d35f
    • V
      virNodeGetCPUMap: Define public API. · 7ecc1d81
      Viktor Mihajlovski 提交于
      Adding a new API to obtain information about the
      host node's present, online and offline CPUs.
      
      int virNodeGetCPUMap(virConnectPtr conn,
                           unsigned char **cpumap,
                           unsigned int *online,
                           unsigned int flags);
      
      The function will return the number of CPUs present on the host
      or -1 on failure;
      If cpumap is non-NULL virNodeGetCPUMap will allocate an array
      containing a bit map representation of the online CPUs. It's
      the callers responsibility to deallocate cpumap using free().
      If online is non-NULL, the variable pointed to will contain
      the number of online host node CPUs.
      The variable flags has been added to support future extensions
      and must be set to 0.
      
      Extend the driver structure by nodeGetCPUMap entry in support of the
      new API virNodeGetCPUMap.
      Added implementation of virNodeGetCPUMap to libvirt.c
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      7ecc1d81
    • K
      qemu_migration: Transport OVS per-port data during live migration · 2f3e2c0c
      Kyle Mestery 提交于
      Transport Open vSwitch per-port data during live
      migration by using the utility functions
      virNetDevOpenvswitchGetMigrateData() and
      virNetDevOpenvswitchSetMigrateData().
      Signed-off-by: NKyle Mestery <kmestery@cisco.com>
      2f3e2c0c
    • K
      openvswitch: Add utility functions for getting and setting Open vSwitch per-port data · f6a2f97e
      Kyle Mestery 提交于
      Add utility functions for Open vSwitch to both save
      per-port data before a live migration, and restore the
      per-port data after a live migration.
      Signed-off-by: NKyle Mestery <kmestery@cisco.com>
      f6a2f97e
    • K
      qemu_migration: Add hooks to transport network data during migration · 694d0c52
      Kyle Mestery 提交于
      Add the ability for the Qemu V3 migration protocol to
      include transporting network configuration. A generic
      framework is proposed with this patch to allow for the
      transfer of opaque data.
      Signed-off-by: NKyle Mestery <kmestery@cisco.com>
      Signed-off-by: NLaine Stump <laine@laine.org>
      694d0c52
    • J
      Fix detection of Xen sysctl version 9 · 9785f2b6
      Jim Fehlig 提交于
      In commit 371ddc98, I mistakenly added the check for sysctl
      version 9 after setting the hypercall version to 1, which will
      fail with
      
      error : xenHypervisorDoV1Op:967 : Unable to issue hypervisor
      ioctl 3166208: Function not implemented
      
      This check should be included along with the others that use
      hypercall version 2.
      9785f2b6
  5. 23 10月, 2012 8 次提交
    • C
      selinux: Don't fail RestoreAll if file doesn't have a default label · 767be8be
      Cole Robinson 提交于
      When restoring selinux labels after a VM is stopped, any non-standard
      path that doesn't have a default selinux label causes the process
      to stop and exit early. This isn't really an error condition IMO.
      
      Of course the selinux API could be erroring for some other reason
      but hopefully that's rare enough to not need explicit handling.
      
      Common example here is storing disk images in a non-standard location
      like under /mnt.
      767be8be
    • E
      build: print uids as unsigned · add633bd
      Eric Blake 提交于
      Reported by Michal Privoznik.
      
      * src/security/security_dac.c (virSecurityDACGenLabel): Use
      correct format.
      add633bd
    • J
      xml: omit domain name from comment if it contains double hyphen · 9b704ab8
      Ján Tomko 提交于
      We put a comment containing "virsh edit <domain_name>" at the start of
      the XML. W3C recommendation forbids the use of "--" in comments [1] and
      libvirt can't parse it either. This patch omits the domain name if it
      contains a double hyphen.
      
      [1] http://www.w3.org/TR/REC-xml/#sec-comments
      9b704ab8
    • J
      storage: don't shadow global 'wait' declaration · b326765c
      Ján Tomko 提交于
      Rename the 'wait' parameter to 'loop'.
      This silences the warning:
      storage/storage_backend.c:1348:34: error: declaration of 'wait' shadows
      a global declaration [-Werror=shadow]
      and fixes the build with -Werror.
      --
      Note: loop is pool backwards.
      b326765c
    • E
      snapshot: sanity check when reusing file for snapshot · 33eaebe4
      Eric Blake 提交于
      The snapshot code when reusing an existing file had hard-to-read
      logic, as well as a missing sanity check: REUSE_EXT should require
      the destination to already be present.
      
      * src/qemu/qemu_driver.c (qemuDomainSnapshotDiskPrepare): Require
      destination on REUSE_EXT, rename variable for legibility.
      33eaebe4
    • E
      build: use correct printf types for uid/gid · 23a4df88
      Eric Blake 提交于
      Fixes a build failure on cygwin:
      cc1: warnings being treated as errors
      security/security_dac.c: In function 'virSecurityDACSetProcessLabel':
      security/security_dac.c:862:5: error: format '%u' expects type 'unsigned int', but argument 7 has type 'uid_t' [-Wformat]
      security/security_dac.c:862:5: error: format '%u' expects type 'unsigned int', but argument 8 has type 'gid_t' [-Wformat]
      
      * src/security/security_dac.c (virSecurityDACSetProcessLabel)
      (virSecurityDACGenLabel): Use proper casts.
      23a4df88
    • C
      storage: Don't do wait loops from VolLookupByPath · 77eff5ee
      Cole Robinson 提交于
      virStorageVolLookupByPath is an API call that virt-manager uses
      quite a bit when dealing with storage. This call use BackendStablePath
      which has several usleep() heuristics that can be tripped up
      and hang virt-manager for a while.
      
      Current example: an empty mpath pool pointing to /dev/mapper makes
      _any_ calls to virStorageVolLookupByPath take 5 seconds.
      
      The sleep heuristics are actually only needed in certain cases
      when we are waiting for new storage to appear, so let's skip the
      timeout steps when calling from LookupByPath.
      77eff5ee
    • C
      qemu: Don't use -enable-nesting with qemu 1.2.0+ · e58dfad4
      Cole Robinson 提交于
      Since the option doesn't exist. Fixes booting with
      cpu mode='host-model' and qemu 1.2.0
      e58dfad4
  6. 22 10月, 2012 8 次提交
    • D
      qemu: Don't blindly assume VNC is supported · 2da776b1
      Doug Goldstein 提交于
      Currently it's assumed that qemu always supports VNC, however it is
      definitely possible to compile qemu without VNC support so we should at
      the very least check for it and handle that correctly.
      2da776b1
    • E
      storage: let format probing work on root-squash NFS · d9d77bfa
      Eric Blake 提交于
      Yet another instance of where using plain open() mishandles files
      that live on root-squash NFS, and where improving the API can
      improve the chance of a successful probe.
      
      * src/util/storage_file.h (virStorageFileProbeFormat): Alter
      signature.
      * src/util/storage_file.c (virStorageFileProbeFormat): Use better
      method for opening file.
      * src/qemu/qemu_driver.c (qemuDomainGetBlockInfo): Update caller.
      * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget):
      Likewise.
      d9d77bfa
    • J
      migrate: v2: use VIR_DOMAIN_XML_MIGRATABLE when available · b6ab7a06
      Ján Tomko 提交于
      In v2 migration protocol, XML is obtained by calling domainGetXMLDesc.
      This includes the default USB controller in XML, which breaks migration
      to older libvirt (before 0.9.2).
      
      Commit 409b5f54
          qemu: Emit compatible XML when migrating a domain
      only fixed this for v3 migration.
      
      This patch uses the new VIR_DOMAIN_XML_MIGRATABLE flag (detected by
      VIR_DRV_FEATURE_XML_MIGRATABLE) to obtain XML without the default controller,
      enabling backward v2 migration.
      b6ab7a06
    • M
      qemu: set seamless migration capability · 508451e4
      Michal Privoznik 提交于
      As we switched to setting capabilities based on QMP communication,
      qemu seamless-migration capability was not set. In the -help output
      this knob is called seamless-migration=[on|off]. The equivalent in
      QMP world is SPICE_MIGRATE_COMPLETED event (qemu upstream commit
      2fdd16e2).
      508451e4
    • O
      b0f1ba47
    • O
      qemu: Cleanup the unused 'nodeinfo' · 5828080f
      Osier Yang 提交于
      "nodeinfo" is not used in these two functions, and it's waste
      of goto in qemuProcessSetEmulatorAffinites
      5828080f
    • C
      Log parameters passed to virFileMakePath · b62f9b99
      Cole Robinson 提交于
      b62f9b99
    • C
      Log file name passed to virConfReadFile · 7fcf8d9d
      Cole Robinson 提交于
      7fcf8d9d
  7. 21 10月, 2012 2 次提交
    • L
      network: don't allow multiple default portgroups · 6f8a8b30
      Laine Stump 提交于
      This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=868483
      
      virNetworkUpdate, virNetworkDefine, and virNetworkCreate all three
      allow network definitions to contain multiple <portgroup> elements
      with default='yes'. Only a single default portgroup should be allowed
      for each network.
      
      This patch updates networkValidate() (called by both
      virNetworkCreate() and virNetworkDefine()) and
      virNetworkDefUpdatePortGroup (called by virNetworkUpdate() to not
      allow multiple default portgroups.
      6f8a8b30
    • L
      network: always create dnsmasq hosts and addnhosts files, even if empty · 1cb1f9da
      Laine Stump 提交于
      This fixes the problem reported in:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=868389
      
      Previously, the dnsmasq hosts file (used for static dhcp entries, and
      addnhosts file (used for additional dns host entries) were only
      created/referenced on the dnsmasq commandline if there was something
      to put in them at the time the network was started. Once we can update
      a network definition while it's active (which is now possible with
      virNetworkUpdate), this is no longer a valid strategy - if there were
      0 dhcp static hosts (resulting in no reference to the hosts file on the
      commandline), then one was later added, the commandline wouldn't have
      linked dnsmasq up to the file, so even though we create it, dnsmasq
      doesn't pay any attention.
      
      The solution is to just always create these files and reference them
      on the dnsmasq commandline (almost always, anyway). That way dnsmasq
      can notice when a new entry is added at runtime (a SIGHUP is sent to
      dnsmasq by virNetworkUdpate whenever a host entry is added or removed)
      
      The exception to this is that the dhcp static hosts file isn't created
      if there are no lease ranges *and* no static hosts. This is because in
      this case dnsmasq won't be setup to listen for dhcp requests anyway -
      in that case, if the count of dhcp hosts goes from 0 to 1, dnsmasq
      will need to be restarted anyway (to get it listening on the dhcp
      port). Likewise, if the dhcp hosts count goes from 1 to 0 (and there
      are no dhcp ranges) we need to restart dnsmasq so that it will stop
      listening on port 67. These special situations are handled in the
      bridge driver's networkUpdate() by checking for ((bool)
      nranges||nhosts) both before and after the update, and triggering a
      dnsmasq restart if the before and after don't match.
      1cb1f9da
  8. 20 10月, 2012 1 次提交
    • L
      network: free/null newDef if network fails to start · 78fab277
      Laine Stump 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=866364
      
      pointed out a crash due to virNetworkObjAssignDef free'ing
      network->newDef without NULLing it afterward. A fix for this is in
      upstream commit b7e92024. While the
      NULLing of newDef was a legitimate fix, newDef should have already
      been empty (NULL) anyway (as indicated in the comment that was deleted
      by that commit).
      
      The reason that newDef had a non-NULL value (i.e. the root cause) was
      that networkStartNetwork() had failed after populating
      network->newDef, but then neglected to free/NULL newDef in the
      cleanup.
      
      (A bit of background here: network->newDef should contain the
      persistent config of a network when a network is active (and of course
      only when it is persisten), and NULL at all other times. There is also
      a network->def which should contain the persistent definition of the
      network when it is inactive, and the current live state at all other
      times. The idea is that you can make changes to network->newDef which
      will take effect the next time the network is restarted, but won't
      mess with the current state of the network (virDomainObj has a similar
      pair of virDomainDefs that behave in the same fashion). Personally I
      think there should be a network->live and network->config, and the
      location of the persistent config should *always* be in
      network->config, but that's for a later cleanup).
      
      Since I love things to be symmetric, I created a new function called
      virNetworkObjUnsetDefTransient(), which reverses the effects of
      virNetworkObjSetDefTransient(). I don't really like the name of the
      new function, but then I also didn't really like the name of the old
      one either (it's just named that way to match a similar function in
      the domain conf code).
      78fab277