1. 23 3月, 2015 3 次提交
    • M
      objecteventtest: Check for virNetwork* return values · cbbb9baa
      Michal Privoznik 提交于
      Lets not give a bad example and check for return values of
      virNetwork* APIs called within the test. Even though it's
      unlikely that any API will fail, it can happen. We're connected
      to the test driver after all, and our API sequence is correct. So
      test driver should fail only in case of bug or OOM.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      cbbb9baa
    • M
      networkStateInitialize: Don't lock network driver · dd7bfb2c
      Michal Privoznik 提交于
      There's no need to lock the network driver, as network driver
      initialization is done prior accepting any client. There's nobody
      to hop in and do something over partially initialized driver. Nor
      qemu driver is doing that.
      
      ==30532== Observed (incorrect) order is: acquisition of lock at 0x1439EF50
      ==30532==    at 0x4C31A26: pthread_mutex_lock (in /usr/lib64/valgrind/vgpreload_helgrind-amd64-linux.so)
      ==30532==    by 0x5324895: virMutexLock (virthread.c:88)
      ==30532==    by 0x5307E86: virObjectLock (virobject.c:323)
      ==30532==    by 0x5396440: virNetworkObjListForEach (network_conf.c:4511)
      ==30532==    by 0x19B29308: networkStateInitialize (bridge_driver.c:686)
      ==30532==    by 0x53E1CCC: virStateInitialize (libvirt.c:777)
      ==30532==    by 0x11DEB7: daemonRunStateInit (libvirtd.c:906)
      ==30532==    by 0x5324B6A: virThreadHelper (virthread.c:197)
      ==30532==    by 0x4C30456: ??? (in /usr/lib64/valgrind/vgpreload_helgrind-amd64-linux.so)
      ==30532==    by 0xA1EC1F2: start_thread (in /lib64/libpthread-2.19.so)
      ==30532==    by 0xA4EDC8C: clone (in /lib64/libc-2.19.so)
      ==30532==
      ==30532==  followed by a later acquisition of lock at 0x1439CD60
      ==30532==    at 0x4C31A26: pthread_mutex_lock (in /usr/lib64/valgrind/vgpreload_helgrind-amd64-linux.so)
      ==30532==    by 0x5324895: virMutexLock (virthread.c:88)
      ==30532==    by 0x19B27B2C: networkDriverLock (bridge_driver.c:102)
      ==30532==    by 0x19B27B60: networkGetDnsmasqCaps (bridge_driver.c:113)
      ==30532==    by 0x19B2856A: networkUpdateState (bridge_driver.c:389)
      ==30532==    by 0x53963E9: virNetworkObjListForEachHelper (network_conf.c:4488)
      ==30532==    by 0x52E2224: virHashForEach (virhash.c:521)
      ==30532==    by 0x539645B: virNetworkObjListForEach (network_conf.c:4512)
      ==30532==    by 0x19B29308: networkStateInitialize (bridge_driver.c:686)
      ==30532==    by 0x53E1CCC: virStateInitialize (libvirt.c:777)
      ==30532==    by 0x11DEB7: daemonRunStateInit (libvirtd.c:906)
      ==30532==    by 0x5324B6A: virThreadHelper (virthread.c:197)
      ==30532==
      ==30532== Required order was established by acquisition of lock at 0x1439CD60
      ==30532==    at 0x4C31A26: pthread_mutex_lock (in /usr/lib64/valgrind/vgpreload_helgrind-amd64-linux.so)
      ==30532==    by 0x5324895: virMutexLock (virthread.c:88)
      ==30532==    by 0x19B27B2C: networkDriverLock (bridge_driver.c:102)
      ==30532==    by 0x19B28DF9: networkStateInitialize (bridge_driver.c:609)
      ==30532==    by 0x53E1CCC: virStateInitialize (libvirt.c:777)
      ==30532==    by 0x11DEB7: daemonRunStateInit (libvirtd.c:906)
      ==30532==    by 0x5324B6A: virThreadHelper (virthread.c:197)
      ==30532==    by 0x4C30456: ??? (in /usr/lib64/valgrind/vgpreload_helgrind-amd64-linux.so)
      ==30532==    by 0xA1EC1F2: start_thread (in /lib64/libpthread-2.19.so)
      ==30532==    by 0xA4EDC8C: clone (in /lib64/libc-2.19.so)
      ==30532==
      ==30532==  followed by a later acquisition of lock at 0x1439EF50
      ==30532==    at 0x4C31A26: pthread_mutex_lock (in /usr/lib64/valgrind/vgpreload_helgrind-amd64-linux.so)
      ==30532==    by 0x5324895: virMutexLock (virthread.c:88)
      ==30532==    by 0x5307E86: virObjectLock (virobject.c:323)
      ==30532==    by 0x538A09C: virNetworkAssignDef (network_conf.c:527)
      ==30532==    by 0x5391EB2: virNetworkLoadState (network_conf.c:3008)
      ==30532==    by 0x53922D4: virNetworkLoadAllState (network_conf.c:3128)
      ==30532==    by 0x19B2929A: networkStateInitialize (bridge_driver.c:671)
      ==30532==    by 0x53E1CCC: virStateInitialize (libvirt.c:777)
      ==30532==    by 0x11DEB7: daemonRunStateInit (libvirtd.c:906)
      ==30532==    by 0x5324B6A: virThreadHelper (virthread.c:197)
      ==30532==    by 0x4C30456: ??? (in /usr/lib64/valgrind/vgpreload_helgrind-amd64-linux.so)
      ==30532==    by 0xA1EC1F2: start_thread (in /lib64/libpthread-2.19.so)
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      dd7bfb2c
    • M
      Fix common misspellings · 0e7457e5
      Martin Kletzander 提交于
      Wikipedia's list of common misspellings [1] has a machine-readable
      version.  This patch fixes those misspellings mentioned in the list
      which don't have multiple right variants (as e.g. "accension", which can
      be both "accession" and "ascension"), such misspellings are left
      untouched.  The list of changes was manually re-checked for false
      positives.
      
      [1] https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machinesSigned-off-by: NMartin Kletzander <mkletzan@redhat.com>
      0e7457e5
  2. 20 3月, 2015 4 次提交
  3. 19 3月, 2015 16 次提交
  4. 18 3月, 2015 17 次提交
    • J
      maint: Distribute tests/vircgroupdata · 9c23b325
      Jiri Denemark 提交于
      My commit 2dbfa716 added test data for vircgrouptest but forgot to
      distribute the new directory.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      9c23b325
    • J
      network: Resolve Coverity FORWARD_NULL · 0e3c68ac
      John Ferlan 提交于
      The following is a long winded way to say this patch is avoiding a
      false positive.
      
      Coverity complains that calling networkPlugBandwidth() could eventually
      end up with a NULL dereference on iface->bandwidth because in the
      networkAllocateActualDevice there's a check of 'iface->bandwidth'
      before deciding to try to use the 'portgroup' if it exists or to not
      perferm the virNetDevBandwidthCopy if 'bandwidth' is not NULL.
      
      Later in networkPlugBandwidth the 'iface->bandwidth' is sourced from
      virDomainNetGetActualBandwidth - which would be either iface->bandwidth
      or (preferably) iface->data.network.actual->bandwidth which would have
      been filled in from either 'iface->bandwidth' or 'portgroup->bandwidth'
      back in networkAllocateActualDevice
      
      There *is* a check in networkCheckBandwidth for the result of the
      virDomainNetGetActualBandwidth being NULL and a return 1 based on
      that which would cause networkPlugBandwidth to exit properly and thus
      never hit the condition that Coverity complains about.
      
      However, since Coverity checks all paths - it somehow believes that
      a return of 0 by networkCheckBandwidth in this condition would end
      up causing the possible NULL dereference. The "fix" to silence Coverity
      is to not have networkCheckBandwidth also call virDomainNetGetActualBandwidth
      in order to get the ifaceBand, but rather have it accept it as an argument
      which causes Coverity to "see" that it's the exit condition of 1 that won't
      have the possible NULL dereference.  Since we're passing that, I added the
      passing of iface->mac rather than passing iface as well. This just hopefully
      makes sure someone doesn't undo this in the future...
      0e3c68ac
    • J
      Use PAUSED state for domains that are starting up · 18441ab9
      Jiri Denemark 提交于
      When libvirt is starting a domain, it reports the state as SHUTOFF until
      it's RUNNING. This is not ideal because domain startup may take a long
      time (usually because of some configuration issues, firewalls blocking
      access to network disks, etc.) and domain lists provided by libvirt look
      awkward. One can see weird shutoff domains with IDs in a list of active
      domains or even shutoff transient domains. In any case, it looks more
      like a bug in libvirt than a normal state a domain goes through.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      18441ab9
    • J
      tests: Add tests for virCgroupDetectMounts · 2dbfa716
      Jiri Denemark 提交于
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      2dbfa716
    • M
      qemuGetDHCPInterfaces: Don't leak @network · 3353c7c4
      Michal Privoznik 提交于
      The function needs a pointer to the network to get list of DHCP
      leases. The pointer is obtained via virNetworkLookupByName() which
      requires callers to free the returned network once no longer needed.
      Otherwise it's leaked.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      3353c7c4
    • M
      cmdDomIfAddr: Free @ip_addr_str · 0aff8fa8
      Michal Privoznik 提交于
      The variable holds formatted suffix to each line printed out
      (address type, address and prefix). However, the variable is
      never freed. At the same time, honour fact, that data held in
      the variable is not constant.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      0aff8fa8
    • M
      qemuAgentGetInterfaces: Don't error out on missing HW address · 100fb08c
      Michal Privoznik 提交于
      Now that we allow HW address to be not present on our RPC layer,
      don't error out if qemu-ga hasn't provided any.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      100fb08c
    • M
      virsh: Adapt to new HW address scenario · 50780207
      Michal Privoznik 提交于
      Make sure we don't print (null) (which in fact is printf()'s
      cleverness anyway, not ours). If no HW address is present, print
      "N/A" string just like we do for other fields.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      50780207
    • M
      RPC: Allow HW address in remote_domain_interface struct to be NULL · 3640245d
      Michal Privoznik 提交于
      Not all NICs (esp. the virtual ones like TUN) must have a hardware
      address. Teach our RPC that it's possible.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      3640245d
    • E
      qemu: read backing chain names from qemu · f9ea3d60
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1199182 documents that
      after a series of disk snapshots into existing destination images,
      followed by active commits of the top image, it is possible for
      qemu 2.2 and earlier to end up tracking a different name for the
      image than what it would have had when opening the chain afresh.
      That is, when starting with the chain 'a <- b <- c', the name
      associated with 'b' is how it was spelled in the metadata of 'c',
      but when starting with 'a', taking two snapshots into 'a <- b <- c',
      then committing 'c' back into 'b', the name associated with 'b' is
      now the name used when taking the first snapshot.
      
      Sadly, older qemu doesn't know how to treat different spellings of
      the same filename as identical files (it uses strcmp() instead of
      checking for the same inode), which means libvirt's attempt to
      commit an image using solely the names learned from qcow2 metadata
      fails with a cryptic:
      
      error: internal error: unable to execute QEMU command 'block-commit': Top image file /tmp/images/c/../b/b not found
      
      even though the file exists.  Trying to teach libvirt the rules on
      which name qemu will expect is not worth the effort (besides, we'd
      have to remember it across libvirtd restarts, and track whether a
      file was opened via metadata or via snapshot creation for a given
      qemu process); it is easier to just always directly ask qemu what
      string it expects to see in the first place.
      
      As a safety valve, we validate that any name returned by qemu
      still maps to the same local file as we have tracked it, so that
      a compromised qemu cannot accidentally cause us to act on an
      incorrect file.
      
      * src/qemu/qemu_monitor.h (qemuMonitorDiskNameLookup): New
      prototype.
      * src/qemu/qemu_monitor_json.h (qemuMonitorJSONDiskNameLookup):
      Likewise.
      * src/qemu/qemu_monitor.c (qemuMonitorDiskNameLookup): New function.
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONDiskNameLookup)
      (qemuMonitorJSONDiskNameLookupOne): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainBlockCommit)
      (qemuDomainBlockJobImpl): Use it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      f9ea3d60
    • A
      network: Add midonet virtual port type support to qemu · d490f47b
      Antoni Segura Puimedon 提交于
      Use the utilities introduced in the previous patches so the qemu
      driver is able to create tap devices that are bound (and unbound
      on domain destroyal) to Midonet virtual ports.
      Signed-off-by: NAntoni Segura Puimedon <toni+libvirt@midokura.com>
      d490f47b
    • A
      docs: schema and docs for the midonet virtualport type · a9fbe3b1
      Antoni Segura Puimedon 提交于
      Midonet is an opensource virtual networking that over lays the IP
      network between hypervisors. Currently, such networks can be made
      with the openvswitch virtualport type.
      
      This patch, defines the schema and documentation that will serve
      as basis for the follow up patches that will add support to libvirt
      for using Midonet virtual ports for its interfaces. The schema
      definition requires that the port profile expresses its interfaceid
      as part of the port profile. For that reason, this is part of the
      patch too.
      Signed-off-by: NAntoni Segura Puimedon <toni+libvirt@midokura.com>
      a9fbe3b1
    • A
      util: functions to support binding/unbinding midonet virtualports · e1f64856
      Antoni Segura Puimedon 提交于
      Adds the port type definitions and methods that will be used to bind
      interfaces to the Midonet virtual ports.
      
      virtnetdevmidonet.c adds the way to bind and unbind the ports by
      calling into the Midonet Host Agent control command line (installed
      with the midolman package).
      Signed-off-by: NAntoni Segura Puimedon <toni+libvirt@midokura.com>
      e1f64856
    • P
      conf: disk: Simplify checking if source definition was parsed · 7a8f54bf
      Peter Krempa 提交于
      Previously we had to check for 3 fields to see if the source was filled.
      Repurpose one of the variables as a boolean flag and use it instead of
      combining multiple sources.
      
      For the condition that checks that only CDROM/FLOPPY drives can be empty
      we can use the virStorageSourceIsEmpty() helper.
      7a8f54bf
    • P
      util: storage: Fix check for empty storage device · 158340e2
      Peter Krempa 提交于
      If the storage device type is parsed as network our parser still allows
      it to omit the <source> element. The empty drive check would not trigger
      on such device as it expects that every network storage source is valid.
      
      Use VIR_STORAGE_NET_PROTOCOL_NONE as a marker that the storage source is
      empty.
      158340e2
    • P
      qemu: driver: Fix cold-update of removable storage devices · d0dc6c03
      Peter Krempa 提交于
      Only selected fields from the disk source were copied when cold updating
      source in a CDROM drive. When such drive was backed by a network file
      this resulted into corruption of the definition:
      
          <disk type='network' device='cdrom'>
            <driver name='qemu' type='raw' cache='none'/>
            <source protocol='gluster' name='gluster-vol1(null)'>
              <host name='localhost'/>
            </source>
            <target dev='vdc' bus='virtio'/>
            <readonly/>
            <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
          </disk>
      
      Update the whole source instead of cherry-picking elements.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1166024
      d0dc6c03
    • P
      e7974b4f