1. 28 4月, 2015 32 次提交
  2. 20 4月, 2015 2 次提交
  3. 17 4月, 2015 1 次提交
    • E
      virsh: fix regression in 'virsh event' by domain · 44fdfbb0
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1212620
      
      Commit a0670aef caused a regression in 'virsh event' and
      'virsh qemu-monitor-event' - if a user tries to filter the
      command to a specific domain, an error message is printed:
      
      $ virsh event dom --loop
      error: internal error: virsh qemu-monitor-event: no domain VSH_OT_DATA option
      
      and then the command continues as though no domain had been
      supplied (giving events for ALL domains, instead of the
      requested one).  This is because the code was incorrectly
      assuming that all "domain" options would be supplied via a
      mandatory VSH_OT_DATA, even though "domain" is optional for
      these two commands, so we had changed them to VSH_OT_STRING
      to quit failing for other reasons (ever since it was decided
      that VSH_OT_DATA and VSH_OT_STRING should no longer be
      synonyms).
      
      In looking at the situation, though, the code for looking up
      a domain was making a pointless check for whether the option
      exists prior to finding the option's string value, as
      vshCommandOptStringReq does just fine at reporting any errors
      when looking up a string whether or not the option was present.
      
      So this is a case of regression fixing by pure code deletion :)
      
      * tools/virsh-domain.c (vshCommandOptDomainBy): Drop useless filter.
      * tools/virsh-interface.c (vshCommandOptInterfaceBy): Likewise.
      * tools/virsh-network.c (vshCommandOptNetworkBy): Likewise.
      * tools/virsh-nwfilter.c (vshCommandOptNWFilterBy): Likewise.
      * tools/virsh-secret.c (vshCommandOptSecret): Likewise.
      * tools/virsh.h (vshCmdHasOption): Drop unused function.
      * tools/virsh.c (vshCmdHasOption): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      (cherry picked from commit 31ef0836)
      44fdfbb0
  4. 16 4月, 2015 4 次提交
    • C
      virsh: Improve change-media success message · 8a5b7ecf
      Cole Robinson 提交于
      $ sudo virsh change-media f19 hdc /mnt/data/devel/media/Fedora-16-x86_64-Live-KDE.iso
      succeeded to complete action update on media
      
      Change the message to:
      
        Successfully {inserted,ejected,changed} media.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=967946
      (cherry picked from commit e3aa4c91)
      8a5b7ecf
    • M
      virNetSocketNewConnectUNIX: Use flocks when spawning a daemon · 59668f63
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1200149
      
      Even though we have a mutex mechanism so that two clients don't spawn
      two daemons, it's not strong enough. It can happen that while one
      client is spawning the daemon, the other one fails to connect.
      Basically two possible errors can happen:
      
        error: Failed to connect socket to '/home/mprivozn/.cache/libvirt/libvirt-sock': Connection refused
      
      or:
      
        error: Failed to connect socket to '/home/mprivozn/.cache/libvirt/libvirt-sock': No such file or directory
      
      The problem in both cases is, the daemon is only starting up, while we
      are trying to connect (and fail). We should postpone the connecting
      phase until the daemon is started (by the other thread that is
      spawning it). In order to do that, create a file lock 'libvirt-lock'
      in the directory where session daemon would create its socket. So even
      when called from multiple processes, spawning a daemon will serialize
      on the file lock. So only the first to come will spawn the daemon.
      Tested-by: NRichard W. M. Jones <rjones@redhat.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      (cherry picked from commit be78814a)
      59668f63
    • P
      rpc: Don't unref identity object while callbacks still can be executed · 72e4e1a1
      Peter Krempa 提交于
      While this thread is cleaning up the client and connection objects:
       #2  virFileReadAll (path=0x7f28780012b0 "/proc/1319/stat", maxlen=maxlen@entry=1024, buf=buf@entry=0x7f289c60fc40) at util/virfile.c:1287
       #3  0x00007f28adbb1539 in virProcessGetStartTime (pid=<optimized out>, timestamp=timestamp@entry=0x7f289c60fc98) at util/virprocess.c:838
       #4  0x00007f28adb91981 in virIdentityGetSystem () at util/viridentity.c:151
       #5  0x00007f28ae73f17c in remoteClientFreeFunc (data=<optimized out>) at remote.c:1131
       #6  0x00007f28adcb7f33 in virNetServerClientDispose (obj=0x7f28aecad180) at rpc/virnetserverclient.c:858
       #7  0x00007f28adba8eeb in virObjectUnref (anyobj=<optimized out>) at util/virobject.c:265
       #8  0x00007f28ae74ad05 in virNetServerHandleJob (jobOpaque=<optimized out>, opaque=0x7f28aec93ff0) at rpc/virnetserver.c:205
       #9  0x00007f28adbbef4e in virThreadPoolWorker (opaque=opaque@entry=0x7f28aec88030) at util/virthreadpool.c:145
      
      In stack frame #6 the client->identity object got unref'd, but the code
      that removes the event callbacks in frame #5 did not run yet as we are
      trying to obtain the system identity (frames #4, #3, #2).
      
      In other thead:
       #0  virObjectUnref (anyobj=anyobj@entry=0x7f288c162c60) at util/virobject.c:264
              klass = 0xdeadbeef
              obj = 0x7f288c162c60
       #1  0x00007f28ae71c709 in remoteRelayDomainEventCheckACL (client=<optimized out>, conn=<optimized out>, dom=dom@entry=0x7f28aecaafc0) at remote.c:164
       #2  0x00007f28ae71fc83 in remoteRelayDomainEventTrayChange (conn=<optimized out>, dom=0x7f28aecaafc0, ... ) at remote.c:717
       #3  0x00007f28adc04e53 in virDomainEventDispatchDefaultFunc (conn=0x7f287c0009a0, event=0x7f28aecab1a0, ...) at conf/domain_event.c:1455
       #4  0x00007f28adc03831 in virObjectEventStateDispatchCallbacks (callbacks=<optimized out>, ....) at conf/object_event.c:724
       #5  virObjectEventStateQueueDispatch (callbacks=0x7f288c083730, queue=0x7fff51f90030, state=0x7f288c18da20) at conf/object_event.c:738
       #6  virObjectEventStateFlush (state=0x7f288c18da20) at conf/object_event.c:816
       #7  virObjectEventTimer (timer=<optimized out>, opaque=0x7f288c18da20) at conf/object_event.c:562
       #8  0x00007f28adb859cd in virEventPollDispatchTimeouts () at util/vireventpoll.c:459
      
      Frame #0 is unrefing an invalid identity object while frame #2 hints
      that the client is still dispatching the event.
      
      For untrimmed backtrace see the bugzilla attachment.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1203030
      (cherry picked from commit a98129c0)
      72e4e1a1
    • L
      lxc: create the required directories upon driver start · ed1cf00a
      Lubomir Rintel 提交于
      /var/run may reside on a tmpfs and we fail to create the PID file if
      /var/run/lxc does not exist.
      
      Since commit 0a8addc1, the lxc driver's state directory isn't
      automatically created before starting a domain. Now, the lxc driver
      makes sure the state directory exists when it initializes.
      Signed-off-by: NLubomir Rintel <lkundrak@v3.sk>
      (cherry picked from commit da33a1ac)
      ed1cf00a
  5. 03 4月, 2015 1 次提交
    • E
      qemu: read backing chain names from qemu · ece6debb
      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>
      (cherry picked from commit f9ea3d60)
      ece6debb