1. 10 1月, 2020 1 次提交
  2. 04 12月, 2019 2 次提交
  3. 22 11月, 2019 1 次提交
  4. 11 11月, 2019 8 次提交
    • D
      python: sanitize indentation after line continuations · 3df69e62
      Daniel P. Berrangé 提交于
      Line continuations should be 4 space indented unless a previous opening
      brace required different alignment.
      
      docs/apibuild.py:2014:24: E126 continuation line over-indented for hanging indent
                             token[0], token[1]))
                             ^
      docs/apibuild.py:74:3: E121 continuation line under-indented for hanging indent
        "ATTRIBUTE_UNUSED": (0, "macro keyword"),
        ^
      ...more...
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      3df69e62
    • D
      python: sanitize spaces either side of operators · 43d29cb4
      Daniel P. Berrangé 提交于
      There should be a single space either side of operators. Inline
      comments should have two spaces before the '#'
      
      src/hyperv/hyperv_wmi_generator.py:130:45: E261 at least two spaces before inline comment
                  source += '    { "", "", 0 },\n' # null terminated
                                                  ^
      src/esx/esx_vi_generator.py:417:25: E221 multiple spaces before operator
          FEATURE__DESERIALIZE  = (1 << 6)
                              ^
      tests/cputestdata/cpu-cpuid.py:187:78: E225 missing whitespace around operator
                      f.write("  <msr index='0x%x' edx='0x%08x' eax='0x%08x'/>\n" %(
                                                                                   ^
      docs/apibuild.py:524:47: E226 missing whitespace around arithmetic operator
                                  self.line = line[i+2:]
                                                    ^
      ...more...
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      43d29cb4
    • D
      python: sanitize blank line usage · bc59247d
      Daniel P. Berrangé 提交于
      Coding style expects 1 blank line between each method and 2 blank lines
      before each class.
      
      docs/apibuild.py:171:5: E303 too many blank lines (2)
          def set_header(self, header):
          ^
      docs/apibuild.py:230:1: E302 expected 2 blank lines, found 1
      class index:
      ^
      docs/apibuild.py:175:5: E301 expected 1 blank line, found 0
          def set_module(self, module):
          ^
      ...more...
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      bc59247d
    • D
      python: avoid bare 'except:' clause · 2ba699cb
      Daniel P. Berrangé 提交于
      Exception catching statements should always match on a class name, the
      most specific one possible. Rather than analyse the code to look at what
      the most specific one is, this just uses the base Exception class.
      
      docs/apibuild.py:255:9: E722 do not use bare 'except'
              except:
              ^
      docs/apibuild.py:279:9: E722 do not use bare 'except'
              except:
              ^
      ...more...
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      2ba699cb
    • D
      python: avoid variable named 'l' · cfdd871f
      Daniel P. Berrangé 提交于
      Python code style recommends avoiding a variable named 'l' as it is
      visually similar to '1'.
      
      docs/apibuild.py:482:13: E741 ambiguous variable name 'l'
                  l = len(line)
                  ^
      docs/apibuild.py:503:21: E741 ambiguous variable name 'l'
                          l = len(line)
                          ^
      ...more...
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      cfdd871f
    • D
      python: mark regex strings with 'r' prefix · d5c5d8af
      Daniel P. Berrangé 提交于
      When writing regexes special regex matches like "\d" can get
      misinterpreted as normal string escape sequences:
      
      docs/apibuild.py:1359:51: W605 invalid escape sequence '\d'
                              value = value + re.sub("^(\d+)U$", "\\1", token[1])
                                                        ^
      docs/apibuild.py:2134:31: W605 invalid escape sequence '\('
                      m = re.match("\(?1<<(\d+)\)?", info[0])
                                    ^
      docs/apibuild.py:2134:38: W605 invalid escape sequence '\d'
                      m = re.match("\(?1<<(\d+)\)?", info[0])
                                           ^
      docs/apibuild.py:2134:42: W605 invalid escape sequence '\)'
                      m = re.match("\(?1<<(\d+)\)?", info[0])
                                               ^
      
      To avoid this probem all regexes should use the r"...." syntax for their
      strings, which disables normal string escape sequences.
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      d5c5d8af
    • D
      python: fix use of undeclared variables in python scripts · 524b377e
      Daniel P. Berrangé 提交于
      docs/apibuild.py:2436:65: F821 undefined name 'first_letter'
                              chunks.append(["chunk%s" % (chunk - 1), first_letter, letter])
                                                                      ^
      src/hyperv/hyperv_wmi_generator.py:415:57: F821 undefined name 'number'
              report_error("line %d: invalid block header" % (number))
                                                              ^
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      524b377e
    • D
      55cbe0fb
  5. 23 10月, 2019 3 次提交
  6. 15 10月, 2019 2 次提交
  7. 25 9月, 2019 1 次提交
  8. 27 7月, 2019 1 次提交
    • E
      backup: Introduce virDomainCheckpoint APIs · 0d44788f
      Eric Blake 提交于
      Introduce a bunch of new public APIs related to backup checkpoints.
      Checkpoints are modeled heavily after virDomainSnapshotPtr (both
      represent a point in time of the guest), although a snapshot exists
      with the intent of rolling back to that state, while a checkpoint
      exists to make it possible to create an incremental backup at a later
      time.  We may have a future hypervisor that can completely manage
      checkpoints without libvirt metadata, but the first two planned
      hypervisors (qemu and test) both always use libvirt for tracking
      metadata relations between checkpoints, so for now, I've deferred
      the counterpart of virDomainSnapshotHasMetadata for a separate
      API addition at a later date if there is ever a need for it.
      
      Note that until we allow snapshots and checkpoints to exist
      simultaneously on the same domain (although the actual prevention of
      this will be in a separate patch for the sake of an easier revert down
      the road), that it is not possible to branch out to create more than
      one checkpoint child to a given parent, although it may become
      possible later when we revert to a snapshot that coincides with a
      checkpoint.  This also means that for now, the decision of which
      checkpoint becomes the parent of a newly created one is the only
      checkpoint with no child (so while there are APIs for dealing with a
      current snapshot, we do not need those for checkpoints).  We may end
      up exposing a notion of a current checkpoint later, but it's easier to
      add stuff when proven needed than to blindly support it now and wish
      we hadn't exposed it.
      
      The following map shows the API relations to snapshots, with new APIs
      on the right:
      
      Operate on a domain object to create/redefine a child:
      virDomainSnapshotCreateXML          virDomainCheckpointCreateXML
      
      Operate on a child object for lifetime management:
      virDomainSnapshotDelete             virDomainCheckpointDelete
      virDomainSnapshotFree               virDomainCheckpointFree
      virDomainSnapshotRef                virDomainCheckpointRef
      
      Operate on a child object to learn more about it:
      virDomainSnapshotGetXMLDesc         virDomainCheckpointGetXMLDesc
      virDomainSnapshotGetConnect         virDomainCheckpointGetConnect
      virDomainSnapshotGetDomain          virDomainCheckpointGetDomain
      virDomainSnapshotGetName            virDomainCheckpiontGetName
      virDomainSnapshotGetParent          virDomainCheckpiontGetParent
      virDomainSnapshotHasMetadata        (deferred for later)
      virDomainSnapshotIsCurrent          (no counterpart, see note above)
      
      Operate on a domain object to list all children:
      virDomainSnapshotNum                (no counterparts, these are the old
      virDomainSnapshotListNames           racy interfaces)
      virDomainSnapshotListAllSnapshots   virDomainListAllCheckpoints
      
      Operate on a child object to list descendents:
      virDomainSnapshotNumChildren        (no counterparts, these are the old
      virDomainSnapshotListChildrenNames   racy interfaces)
      virDomainSnapshotListAllChildren    virDomainCheckpointListAllChildren
      
      Operate on a domain to locate a particular child:
      virDomainSnapshotLookupByName       virDomainCheckpointLookupByName
      virDomainSnapshotCurrent            (no counterpart, see note above)
      virDomainHasCurrentSnapshot         (no counterpart, old racy interface)
      
      Operate on a snapshot to roll back to earlier state:
      virDomainSnapshotRevert             (no counterpart, instead checkpoints
                                           are used in incremental backups via
      				     XML to virDomainBackupBegin)
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
      0d44788f
  9. 31 1月, 2019 1 次提交
    • P
      docs: Format bit shift and hex notation for bitwise flag enums · 63cbad4e
      Peter Krempa 提交于
      Big number itself does not make much sense in some cases. Format the
      bitshift format as well.
      
      Changes our web page docs from:
      
      VIR_MIGRATE_POSTCOPY = 32768 : Setting the VIR_MIGRATE_POSTCOPY...
      VIR_MIGRATE_TLS      = 65536 : Setting the VIR_MIGRATE_TLS flag...
      
      to:
      
      VIR_MIGRATE_POSTCOPY = 32768 (0x8000; 1 << 15)  : Setting the VIR_MIGRATE_POSTCOPY...
      VIR_MIGRATE_TLS      = 65536 (0x10000; 1 << 16) : Setting the VIR_MIGRATE_TLS flag...
      Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
      63cbad4e
  10. 14 12月, 2018 2 次提交
    • D
      Enforce a standard header file guard symbol name · 568a4172
      Daniel P. Berrangé 提交于
      Require that all headers are guarded by a symbol named
      
        LIBVIRT_$FILENAME
      
      where $FILENAME is the uppercased filename, with all characters
      outside a-z changed into '_'.
      
      Note we do not use a leading __ because that is technically a
      namespace reserved for the toolchain.
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      568a4172
    • D
      Remove all Author(s): lines from source file headers · 60046283
      Daniel P. Berrangé 提交于
      In many files there are header comments that contain an Author:
      statement, supposedly reflecting who originally wrote the code.
      In a large collaborative project like libvirt, any non-trivial
      file will have been modified by a large number of different
      contributors. IOW, the Author: comments are quickly out of date,
      omitting people who have made significant contribitions.
      
      In some places Author: lines have been added despite the person
      merely being responsible for creating the file by moving existing
      code out of another file. IOW, the Author: lines give an incorrect
      record of authorship.
      
      With this all in mind, the comments are useless as a means to identify
      who to talk to about code in a particular file. Contributors will always
      be better off using 'git log' and 'git blame' if they need to  find the
      author of a particular bit of code.
      
      This commit thus deletes all Author: comments from the source and adds
      a rule to prevent them reappearing.
      
      The Copyright headers are similarly misleading and inaccurate, however,
      we cannot delete these as they have legal meaning, despite being largely
      inaccurate. In addition only the copyright holder is permitted to change
      their respective copyright statement.
      Reviewed-by: NErik Skultety <eskultet@redhat.com>
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      60046283
  11. 20 3月, 2018 18 次提交