1. 15 2月, 2016 3 次提交
    • L
      util: clean up and expand 802.1QbX negotiation logging · 9cb8b0e5
      Laine Stump 提交于
      The existing log messages for this have several problems; there are
      two lines of log when one will suffice, they duplicate the function
      name in log message (when it's already included by VIR_DEBUG), they're
      missing some useful bits, they get logged even when the call is a NOP.
      
      This patch cleans up the problems with those existing logs, and also
      adds a new VIR_INFO-level log down at the function that is actually
      creating and sending the netlink message that logs *everything* going
      into the netlink message (which turns out to be much more useful in
      practice for me; I didn't want to eliminate the logs at the existing
      location though, in case they are useful in some scenario I'm
      unfamiliar with; anyway those logs are remaining at debug level, so it
      shouldn't be a bother to anyone).
      9cb8b0e5
    • L
      network: consolidated info log for all network allocate/free operations · eb72bd63
      Laine Stump 提交于
      There are three functions that deal with allocating and freeing
      devices from a networks netdev/pci device pool:
      network(Allocate|Notify|Release)ActualDevice(). These functions also
      maintain a counter of the number of domains currently using a network
      (regardless of whether or not that network uses a device pool). Each
      of these functions had multiple log messages (output using VIR_DEBUG)
      that were in slightly different formats and gave varying amounts of
      information.
      
      This patch creates a single function to log the pertinent information
      in a consistent manner for all three of these functions. Along with
      assuring that all the functions produce a consistent form of output
      (and making it simpler to change), it adds the MAC address of the
      domain interface involved in the operation, making it possible to
      verify which interface of which domain the operation is being done for
      (assuming that all MAC addresses are unique, of course).
      
      All of these messages are raised from DEBUG to INFO, since they don't
      happen that often (once per interface per domain/libvirtd start or
      domain stop), and can be very informative and helpful - eliminating
      the need to log debug level messages makes it much easier to sort
      these out.
      eb72bd63
    • L
      network: consolidate connection count updates for device pool · 3ea8b8b8
      Laine Stump 提交于
      networkReleaseActualDevice() and networkNotifyActualDevice() both were
      updating the individual devices' connections count in two separate
      places (unlike networkAllocateActualDevice() which does it in a single
      unified place after success:). The code is correct, but prone to
      confusion / later breakage. All of these updates are anyway located at
      the end of if/else clauses that are (with the exception of a single
      VIR_DEBUG() in each case) immediately followed by the success: label
      anyway, so this patch replaces the duplicated ++/-- instructions with
      a single ++/-- inside a qualifying "if (dev)" down below success:.
      (NB: if dev != NULL, by definition we are using a device (either pci
      or netdev, doesn't matter for these purposes) from the network's pool)
      
      The VIR_DEBUG args (which will be replaced in a followup patch anyway)
      were all adjusted to account for the connection count being out of
      date at the time.
      3ea8b8b8
  2. 13 2月, 2016 3 次提交
  3. 12 2月, 2016 15 次提交
    • A
      domsuspend: Fix warning on mingw build · 9a457be1
      Andrea Bolognani 提交于
      Commit d82170d7 introduced a workaround for domtop: in that example
      program, we define a symbol called ERROR for our own use, but since
      a symbol with the same name is already defined in one of mingw's
      header files, we get a warning when using that compiler.
      
      domsuspend defines the same problematic symbol, so the workaround
      has been copied over.
      9a457be1
    • M
      storageVolCreateXMLFrom: Check if backend knows how to createVol · 611a278f
      Michal Privoznik 提交于
      It is highly unlikely that a backend will know how to create a
      volume from a different volume (buildVolFrom) and not know how to
      create an empty volume (createVol). But:
      1) we call the function without any prior check so if that's the
      case we would SIGSEGV immediatelly
      2) it's better to be safe than sorry.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      611a278f
    • M
      storageVolCreateXML: Swap order of two operations · 78490acc
      Michal Privoznik 提交于
      Firstly, we realloc internal list to hold new item (=volume that
      will be potentially created) and then we check whether we
      actually know how to create it. If we don't we consume more
      memory than we really need for no good reason.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      78490acc
    • M
      virsh: Teach vol-create-as to --print-xml · 64e66d8e
      Michal Privoznik 提交于
      We have the same argument to many other commands that produce an
      XML based on what user typed. But unfortunately vol-create-as
      was missing it. Maybe nobody had needed it yet. Well, I did
      just now.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      64e66d8e
    • M
      cmdVolCreateAs: Rework to follow usual func pattern · bb0b8e5d
      Michal Privoznik 提交于
      The way we usually write functions is that we start the work and
      if something goes bad we goto cleanup and roll back there. Or
      just free resources that are no longer needed. Do the same here.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      bb0b8e5d
    • M
      virportallocatortest: Run on linux only · 26946f67
      Michal Privoznik 提交于
      After the rework of mocking of our tests there's the
      virportallocator test failing to link on mingw. Well, it's the
      mocking library actually:
      
      ../gnulib/lib/.libs/libgnu.a(bind.o): In function `rpl_bind':
      /home/jenkins/libvirt-mingw/build32/gnulib/lib/../../../gnulib/lib/bind.c:33: multiple definition of `rpl_bind'
      .libs/virportallocatormock_la-virportallocatormock.o:/home/jenkins/libvirt-mingw/build32/tests/../../tests/virportallocatormock.c:79: first defined here
      
      I've no idea why this matters to mingw and does not to others.
      Nevertheless, if we make the test linux only the problem goes
      away.
      
      Apparently, our test for RTLD_NEXT is not sufficient because
      mingw32 defines it. Lets put aside for a while fact that it has
      the same value as RTLD_DEFAULT which by description has different
      meaning, shall we?
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      26946f67
    • M
      vz: fix race condition when adding domain to domains list · 9c14a9ab
      Mikhail Feoktistov 提交于
      Race condition:
      User calls defineXML to create new instance.
      The main thread from vzDomainDefineXMLFlags() creates new instance by prlsdkCreateVm.
      Then this thread calls prlsdkAddDomain to add new domain to domains list.
      The second thread receives notification from hypervisor that new VM was created.
      It calls prlsdkHandleVmAddedEvent() and also tries to add new domain to domains list.
      These two threads call virDomainObjListFindByUUID() from prlsdkAddDomain() and don't find new domain.
      So they add two domains with the same uuid to domains list.
      
      This fix splits logic of prlsdkAddDomain() into two functions.
      1. vzNewDomain() creates new empty domain in domains list with the specific uuid.
      2. prlsdkLoadDomain() add data from VM to domain object.
      
      New algorithm for creating an instance:
      In vzDomainDefineXMLFlags() we add new domain to domain list by calling vzNewDomain()
      and only after that we call CreateVm() to create VM.
      It means that we "reserve" domain object with the specific uuid.
      After creation of new VM we add info from this VM
      to reserved domain object by calling prlsdkLoadDomain().
      
      Before this patch prlsdkLoadDomain() worked in 2 different cases:
      1. It creates and initializes new domain. Then updates it from sdk handle.
      2. It updates existed domain from sdk handle.
      In this patch we remove code which creates new domain from LoadDomain()
      and move it to vzNewDomain().
      Now prlsdkLoadDomain() only updates domain from skd handle.
      
      In notification handler prlsdkHandleVmAddedEvent() we check
      the existence of a domain and if it doesn't exist we add new domain by calling
      vzNewDomain() and load info from sdk handle via prlsdkLoadDomain().
      9c14a9ab
    • M
      vz: fix notification subscription · d5f0cf99
      Mikhail Feoktistov 提交于
      Bug cause:
      Update the domain that is subscribed to hypervisor notification.
      LoadDomain() rewrites notifications fields in vzDomObj structure and makes domain as "unsubscribed".
      Fix:
      Initialize notification fields in vzDomObj only if we create a new domain.
      And do not reinitialize these fields if we update domain (by calling LoadDomain with olddom argument)
      d5f0cf99
    • M
      vz: remove unused struct field · a7b2257e
      Mikhail Feoktistov 提交于
      In commit 7039bb3c we have removed code that saves uuid to vzDomObj.uuid
      So this field is no longer needed.
      a7b2257e
    • M
      vz: make output arguments in prlsdkGetDomainIds as optional · 2286986a
      Mikhail Feoktistov 提交于
      prlsdkGetDomainIds() returns name and uuid for specified instance.
      Now output arguments can be NULL.
      It allows to get only necessary info(name or uuid).
      2286986a
    • M
      Change maintainers list · 39e22674
      Maxim Nestratov 提交于
      Add Maxim Nestratov to the commiters list.
      Move Dmitry Guryanov to the previous maintainers list.
      39e22674
    • A
      tests: Rename virmockdbus -> virdbusmock for consistency · 92ec2e5e
      Andrea Bolognani 提交于
      All mock libraries were called vir*mock except for this one; now
      the naming is consistent across the board.
      92ec2e5e
    • A
      tests: Don't use "lib" prefix for mock libraries · f6d6d21f
      Andrea Bolognani 提交于
      virportallocatormock was the only one using it, and has been
      changed accordingly.
      f6d6d21f
    • A
      tests: Allow use of close() in mock libraries · b4ddb883
      Andrea Bolognani 提交于
      As mock libraries are not to be linked against libvirt, the
      sc_prohibit_close syntax-check rule does not apply.
      
      This fixes a syntax-check failure introduced by commit a03cbfe0.
      b4ddb883
    • A
      tests: Split off the mock part of the port allocator test · caf8d479
      Andrea Bolognani 提交于
      Instead of compiling either the mock or the non-mock part of the
      file based on a compiler flag, split the mock part off to its
      own file.
      caf8d479
  4. 11 2月, 2016 19 次提交
    • P
      conf: snapshot: Avoid autogenerating duplicate snapshot names · b60af444
      Peter Krempa 提交于
      The snapshot name generator truncates the original file name after a '.'
      and replaces the suffix with the snapshot name. If two disks source
      images differ only in the suffix portion, the generated name will be
      duplicate.
      
      Since this is a corner case just error out stating that a duplicate name
      was generated. The user can work around this situation by providing
      the file names explicitly.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1283085
      b60af444
    • P
      conf: snapshot: Refactor virDomainSnapshotDefAssignExternalNames · 4319444d
      Peter Krempa 提交于
      Get rid of one indentation level by negating condition and remove ugly
      pointer arithmetic at the cost of one extra allocation.
      4319444d
    • P
    • P
      conf: snapshot: Rename disksorter to virDomainSnapshotCompareDiskIndex · d5c7655c
      Peter Krempa 提交于
      Stick to the naming pattern.
      d5c7655c
    • A
      tests: Link mock libraries against gnulib and gnulib only · 1ed0bdd8
      Andrea Bolognani 提交于
      Mock libraries should not be linked against libvirt, but some of
      them did - fix that.
      
      On the other hand, not linking against gnulib can cause build
      failures on mingw, so define a new $(MOCKLIBS_LIBS) variable and
      use it everywhere.
      1ed0bdd8
    • A
      tests: Use plain close() in mock code · a03cbfe0
      Andrea Bolognani 提交于
      The virportallocatortest.c file is compiled both as a test case
      and as a mock library; in the latter case, it can't use
      VIR_FORCE_CLOSE() because mock libraries are not linked against
      libvirt.
      
      Replace VIR_FORCE_CLOSE() with plain close() to solve the issue.
      a03cbfe0
    • M
      dbus: Don't unref NULL messages · 862298a2
      Michal Privoznik 提交于
      Apparently we are not the only ones with dumb free functions
      because dbus_message_unref() does not accept NULL either. But if
      I were to vote, this one is even more evil. Instead of returning
      an error just like we do it immediately dereference any pointer
      passed and thus crash you app. Well done DBus!
      
        Program received signal SIGSEGV, Segmentation fault.
        [Switching to Thread 0x7f878ebda700 (LWP 31264)]
        0x00007f87be4016e5 in ?? () from /usr/lib64/libdbus-1.so.3
        (gdb) bt
        #0  0x00007f87be4016e5 in ?? () from /usr/lib64/libdbus-1.so.3
        #1  0x00007f87be3f004e in dbus_message_unref () from /usr/lib64/libdbus-1.so.3
        #2  0x00007f87bf6ecf95 in virSystemdGetMachineNameByPID (pid=9849) at util/virsystemd.c:228
        #3  0x00007f879761bd4d in qemuConnectCgroup (driver=0x7f87600a32a0, vm=0x7f87600c7550) at qemu/qemu_cgroup.c:909
        #4  0x00007f87976386b7 in qemuProcessReconnect (opaque=0x7f87600db840) at qemu/qemu_process.c:3386
        #5  0x00007f87bf6edfff in virThreadHelper (data=0x7f87600d5580) at util/virthread.c:206
        #6  0x00007f87bb602334 in start_thread (arg=0x7f878ebda700) at pthread_create.c:333
        #7  0x00007f87bb3481bd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
        (gdb) frame 2
        #2  0x00007f87bf6ecf95 in virSystemdGetMachineNameByPID (pid=9849) at util/virsystemd.c:228
        228         dbus_message_unref(reply);
        (gdb) p reply
        $1 = (DBusMessage *) 0x0
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      862298a2
    • J
      virhook: do not save the return value of virBuildPath · 21e2e081
      Ján Tomko 提交于
      This function returns -1 on allocation error, there's no
      need to check the path for NULL again.
      21e2e081
    • J
      Clean up usage of 'ret' variable · 2542eb75
      Ján Tomko 提交于
      Do not store the return value of called functions in the same variable
      as the (future) return value of the current function.
      
      This makes tracking the origin of the value easier and reduces
      the chance of introducing a new point of exit without resetting
      the return value back to -1.
      2542eb75
    • J
      Prohibit verbose strcat · 28e5655d
      Ján Tomko 提交于
      Using strcat directly is more readable than passing strlen
      of the copied string to strncat.
      28e5655d
    • J
      vbox: remove more extra spaces · 4d569245
      Ján Tomko 提交于
      4d569245
    • J
      vbox: remove extra spaces from function headers · a3dd574a
      Ján Tomko 提交于
      Also fix the curly brace to pass sytnax-check.
      a3dd574a
    • J
      vbox: remove extra spaces from assignments · b31e4d00
      Ján Tomko 提交于
      b31e4d00
    • J
      ebe24c84
    • J
      vbox: remove extra spaces from macro definitions · 62859993
      Ján Tomko 提交于
      62859993
    • M
      qemu: Connect to guest agent iff needed · 88ed9d77
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1293351
      
      Since we already have virtio channel events, we know when guest
      agent within guest has (dis-)connected. Instead of us blindly
      connecting to a socket that no one is listening to, we can just
      follow what qemu-ga does. This has a nice benefit that we don't
      need to 'guest-ping' the agent just to timeout and find out
      nobody is listening.
      
      The way that this commit is implemented:
      - don't connect in qemuProcessLaunch directly, defer that to event
        callback (which already follows the agent) -
        processSerialChangedEvent
      - after migration is settled, before we resume vCPUs, ask qemu
        whether somebody is listening on the socket and if so, connect
        to it.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      88ed9d77
    • J
      qemu: Split the command parsing routines into own module · d860b2f5
      John Ferlan 提交于
      Extract out the qemuParseCommandLine{String|Pid} into their own
      separate module - taking with it all the various static functions.
      
      Causes a ripple effect with a few other modules to include the
      new qemu_parse_command.h.
      
      Narrowed down the list of #include's in the split out module to
      those that are necessary for build.
      d860b2f5
    • J
      qemu: Check return status for virDomainGraphicsListenSetAddress · 336d4dac
      John Ferlan 提交于
      Recent refactors in the vbox code to check the return status for the
      function tipped Coverity's scales of justice for any functions that
      do not check status - such as this one.
      
      While I'm at it, since the call is essentially the same other than
      whether starting from val or val+1 when val[0] = '[', just adjust
      the val pointer by one and have one call instead of two.
      
      Additionally, the call to virDomainGraphicsListenGetAddress is redundant
      since it checking that the address field got filled.  It's a leftover
      from the strndup -> ListenSetAddress conversion (commit id 'ef79fb5b')
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      336d4dac
    • J
      qemu: Introduce qemuParseCommandLineVnc · 7b3adac4
      John Ferlan 提交于
      Refactor qemuParseCommandLine to pull out the "-vnc" argument parsing
      into its own helper function.  Modify the code to use "cleanup" instead
      of "error" and use the standard return processing to indicate success
      or failure by using ret
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      7b3adac4