1. 09 7月, 2019 1 次提交
  2. 09 5月, 2019 3 次提交
    • E
      snapshot: Make virDomainSnapshotDef a virObject · 57387ff5
      Eric Blake 提交于
      This brings about a couple of benefits:
      - use of VIR_AUTOUNREF() simplifies several callers
      - Fixes a todo about virDomainMomentObjList not being polymorphic enough
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Acked-by: NPeter Krempa <pkrempa@redhat.com>
      57387ff5
    • E
      snapshot: s/current/parent/ as prep for virObject · 098043ed
      Eric Blake 提交于
      VIR_CLASS_NEW insists that descendents of virObject have 'parent' as
      the name of their inherited base class member at offset 0. While it
      would be possible to write a new class-creation macro that takes the
      actual field name 'current', and rewrite VIR_CLASS_NEW to call the new
      macro with the hard-coded name 'parent', it seems less confusing if
      all object code uses similar naming. Thus, this is a mechanical rename
      in preparation of making virDomainSnapshotDef a descendent of
      virObject.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Acked-by: NPeter Krempa <pkrempa@redhat.com>
      098043ed
    • E
      snapshot: s/parent/parent_name/ as prep for virObject · 36603bc5
      Eric Blake 提交于
      VIR_CLASS_NEW insists that descendents of virObject have 'parent' as
      the name of their inherited base class member at offset 0. While it
      would be possible to write a new class-creation macro that takes the
      actual field name, and rewrite VIR_CLASS_NEW to call the new macro
      with the hard-coded name 'parent', so that we could make
      virDomainMomentDef use a custom name for its base class, it seems less
      confusing if all object code uses similar naming. Thus, this is a
      mechanical rename in preparation of making virDomainSnapshotDef a
      descendent of virObject, when we can no longer use 'parent' for a
      different purpose than the base class.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Acked-by: NPeter Krempa <pkrempa@redhat.com>
      36603bc5
  3. 10 4月, 2019 1 次提交
  4. 22 3月, 2019 2 次提交
    • E
      snapshot: Factor out virDomainMomentDef class · ffc0fbeb
      Eric Blake 提交于
      Pull out the common parts of virDomainSnapshotDef that will be reused
      for virDomainCheckpointDef into a new base class.  Adjust all callers
      that use the direct fields (some of it is churn that disappears when
      the next patch refactors virDomainSnapshotObj; oh well...).
      
      Someday, I hope to switch this type to be a subclass of virObject, but
      that requires a more thorough audit of cleanup paths, and besides
      minimal incremental changes are easier to review.
      
      As for the choice of naming:
      I promised my teenage daughter Evelyn that I'd give her credit for her
      contribution to this commit. I asked her "What would be a good name
      for a base class for DomainSnapshot and DomainCheckpoint". After
      explaining what a base class was (using the classic OOB Square and
      Circle inherit from Shape), she came up with "DomainMoment", which is
      way better than my initial thought of "DomainPointInTime" or
      "DomainPIT".
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      ffc0fbeb
    • E
      snapshot: Drop virDomainSnapshotDef.current · f1056279
      Eric Blake 提交于
      The only use for the 'current' member of virDomainSnapshotDef was with
      the PARSE/FORMAT_INTERNAL flag for controlling an internal-use
      <active> element marking whether a particular snapshot definition was
      current, and even then, only by the qemu driver on output, and by qemu
      and test driver on input. But this duplicates vm->snapshot_current,
      and gets in the way of potential simplifications to have qemu store a
      single file for all snapshots rather than one file per snapshot.  Get
      rid of the member by adding a bool* parameter during parse (ignored if
      the PARSE_INTERNAL flag is not set), and by adding a new flag during
      format (if FORMAT_INTERNAL is set, the value printed in <active>
      depends on the new FORMAT_CURRENT).
      
      Then update the qemu driver accordingly, which involves hoisting
      assignments to vm->current_snapshot to occur prior to any point where
      a snapshot XML file is written (although qemu kept
      vm->current_snapshot and snapshot->def_current in sync by the end of
      the function, they were not always identical in the middle of
      functions, so the shuffling gets a bit interesting). Later patches
      will clean up some of that confusing churn to vm->current_snapshot.
      
      Note: even if later patches refactor qemu to no longer use
      FORMAT_INTERNAL for output (by storing bulk snapshot XML instead), we
      will always need PARSE_INTERNAL for input (because on upgrade, a new
      libvirt still has to parse XML left from a previous libvirt).
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      f1056279
  5. 08 3月, 2019 1 次提交
    • E
      snapshot: Give virDomainSnapshotDefFormat its own flags · c5029559
      Eric Blake 提交于
      virDomainSnapshotDefFormat currently takes two sets of knobs:
      an 'unsigned int flags' argument that can currently just be
      VIR_DOMAIN_DEF_FORMAT_SECURE, and an 'int internal' argument used as
      a bool to determine whether to output an additional element.  It
      then reuses the 'flags' knob to call into virDomainDefFormatInternal(),
      which takes a different set of flags. In fact, prior to commit 0ecd6851
      (1.2.12), the 'flags' argument actually took the public
      VIR_DOMAIN_XML_SECURE, which was even more confusing.  Let's borrow
      from the style of that earlier commit, by introducing a function
      for translating from the public flags (VIR_DOMAIN_SNAPSHOT_XML_SECURE
      was just recently introduced) into a new enum specific to snapshot
      formatting, and adjust all callers to use snapshot-specific enum
      values when formatting, and where the formatter now uses a new
      variable 'domainflags' to make it obvious when we are translating
      from snapshot flags back to domain flags.  We don't even have to
      use the conversion function for drivers that don't accept the
      public VIR_DOMAIN_SNAPSHOT_XML_SECURE flag.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      c5029559
  6. 07 3月, 2019 1 次提交
  7. 20 2月, 2019 1 次提交
    • E
      domain: Fix unknown flags diagnosis in virDomainGetXMLDesc · 27c8fd74
      Eric Blake 提交于
      Many drivers had a comment that they did not validate the incoming
      'flags' to virDomainGetXMLDesc() because they were relying on
      virDomainDefFormat() to do it instead. This used to be the case
      (at least since 461e0f1a and friends in 0.9.4 added unknown flag
      checking in general), but regressed in commit 0ecd6851 (1.2.12),
      when all of the drivers were changed to pass 'flags' through the
      new helper virDomainDefFormatConvertXMLFlags(). Since this helper
      silently ignores unknown flags, we need to implement flag checking
      in each driver instead.
      
      Annoyingly, this means that any new flag values added will silently
      be ignored when targeting an older libvirt, rather than our usual
      practice of loudly diagnosing an unsupported flag.  Add comments
      in domain_conf.[ch] to remind us to be extra vigilant about the
      impact when adding flags (a new flag to add data is safe if the
      older server omitting the requested data doesn't break things in
      the newer client; a new flag to suppress data rather than enhancing
      the existing VIR_DOMAIN_XML_SECURE may form a data leak or even a
      security hole).
      
      In the qemu driver, there are multiple callers all funnelling to
      qemuDomainDefFormatBufInternal(); many of them already validated
      flags (and often only a subset of the full set of possible flags),
      but for ease of maintenance, we can also check flags at the common
      helper function.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
      27c8fd74
  8. 16 8月, 2018 1 次提交
  9. 14 8月, 2018 1 次提交
  10. 13 8月, 2018 1 次提交
  11. 03 8月, 2018 1 次提交
  12. 23 7月, 2018 2 次提交
    • A
      src: Make virStr*cpy*() functions return an int · 6c0d0210
      Andrea Bolognani 提交于
      Currently, the functions return a pointer to the
      destination buffer on success or NULL on failure.
      
      Not only does this kind of error handling look quite
      alien in the context of libvirt, where most functions
      return zero on success and a negative int on failure,
      but it's also somewhat pointless because unless there's
      been a failure the returned pointer will be the same
      one passed in by the user, thus offering no additional
      value.
      
      Change the functions so that they return an int
      instead.
      Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
      6c0d0210
    • A
      src: Use virStrcpyStatic() to avoid truncation · c9d5f2d9
      Andrea Bolognani 提交于
      The way virStrncpy() is called here will never result in
      buffer overflow, but it won't prevent or detect truncation
      either, despite what the error message might suggest. Use
      virStrcpyStatic(), which does all of the above, instead.
      Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
      c9d5f2d9
  13. 11 7月, 2018 1 次提交
  14. 04 7月, 2018 2 次提交
  15. 03 7月, 2018 2 次提交
  16. 04 5月, 2018 1 次提交
  17. 12 4月, 2018 3 次提交
  18. 16 3月, 2018 1 次提交
  19. 22 2月, 2018 1 次提交
  20. 03 11月, 2017 1 次提交
    • A
      Remove backslash alignment attempts · 3e7db8d3
      Andrea Bolognani 提交于
      Right-aligning backslashes when defining macros or using complex
      commands in Makefiles looks cute, but as soon as any changes is
      required to the code you end up with either distractingly broken
      alignment or unnecessarily big diffs where most of the changes
      are just pushing all backslashes a few characters to one side.
      
      Generated using
      
        $ git grep -El '[[:blank:]][[:blank:]]\\$' | \
          grep -E '*\.([chx]|am|mk)$$' | \
          while read f; do \
            sed -Ei 's/[[:blank:]]*[[:blank:]]\\$/ \\/g' "$f"; \
          done
      Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
      3e7db8d3
  21. 04 9月, 2017 1 次提交
  22. 07 6月, 2017 1 次提交
  23. 03 4月, 2017 1 次提交
    • M
      virGetDomain: Set domain ID too · 5683b213
      Michal Privoznik 提交于
      So far our code is full of the following pattern:
      
        dom = virGetDomain(conn, name, uuid)
        if (dom)
            dom->id = 42;
      
      There is no reasong why it couldn't be just:
      
        dom = virGetDomain(conn, name, uuid, id);
      
      After all, client domain representation consists of tuple (name,
      uuid, id).
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      5683b213
  24. 22 11月, 2016 1 次提交
  25. 26 9月, 2016 1 次提交
  26. 23 9月, 2016 1 次提交
  27. 13 7月, 2016 1 次提交
    • T
      esx: Fetch snapshot info directly for filtering · 8ddc56e7
      Tomáš Golembiovský 提交于
      When fetching domains with virConnectListAllDomains() and when filtering
      by snapshot existence is requested the ESX driver first lists all the
      domains and then check one-by-one for snapshot existence. This process
      takes unnecessarily long time.
      
      To significantly improve the time necessary to finish the query we can
      request the snapshot related info directly when querying the list of
      domains from VMware.
      Signed-off-by: NTomáš Golembiovský <tgolembi@redhat.com>
      8ddc56e7
  28. 27 6月, 2016 1 次提交
    • L
      global: consistently use IP rather than Ip in identifiers · 22a6873a
      Laine Stump 提交于
      I'm tired of mistyping this all the time, so let's do it the same all
      the time (similar to how we changed all "Pci" to "PCI" awhile back).
      
      (NB: I've left alone some things in the esx and vbox drivers because
      I'm unable to compile them and they weren't obviously *not* a part of
      some API. I also didn't change a couple of variables named,
      e.g. "somethingIptables", because they were derived from the name of
      the "iptables" command)
      22a6873a
  29. 08 6月, 2016 1 次提交
  30. 07 6月, 2016 1 次提交
  31. 27 5月, 2016 1 次提交
    • D
      esx: do not store escaped password in esxVI_Context. · 3ef5e218
      Dawid Zamirski 提交于
      This patch fixes an issue where screenshot API call was failing when
      the esx/vcenter password contains special characters such as
      apostrophee. The reason for failures was that passwords were escaped
      for XML and stored in esxVI_Context which was then passed to raw CURL
      API calls where the password must be passed in original form to
      authenticate successfully. So this patch addresses this by storing
      original passwords in the esxVI_Context struct and escape only for
      esxVI_Login call.
      3ef5e218
  32. 05 2月, 2016 1 次提交