1. 26 8月, 2011 5 次提交
    • E
      snapshot: track current snapshot across restarts · 6766ff10
      Eric Blake 提交于
      Audit all changes to the qemu vm->current_snapshot, and make them
      update the saved xml file for both the previous and the new
      snapshot, so that there is always at most one snapshot with
      <active>1</active> in the xml, and that snapshot is used as the
      current snapshot even across libvirtd restarts.
      
      This patch does not fix the case of virDomainSnapshotDelete(,CHILDREN)
      where one of the children is the current snapshot; that will be later.
      
      * src/conf/domain_conf.h (_virDomainSnapshotDef): Alter member
      type and name.
      * src/conf/domain_conf.c (virDomainSnapshotDefParseString)
      (virDomainSnapshotDefFormat): Update clients.
      * docs/schemas/domainsnapshot.rng: Tighten rng.
      * src/qemu/qemu_driver.c (qemuDomainSnapshotLoad): Reload current
      snapshot.
      (qemuDomainSnapshotCreateXML, qemuDomainRevertToSnapshot)
      (qemuDomainSnapshotDiscard): Track current snapshot.
      6766ff10
    • E
      snapshot: only pass snapshot to qemu command line when reverting · 5e47785b
      Eric Blake 提交于
      Changing the current vm, and writing that change to the file
      system, all before a new qemu starts, is risky; it's hard to
      roll back if starting the new qemu fails for some reason.
      Instead of abusing vm->current_snapshot and making the command
      line generator decide whether the current snapshot warrants
      using -loadvm, it is better to just directly pass a snapshot all
      the way through the call chain if it is to be loaded.
      
      This frees up the last use of snapshot->def->active for qemu's
      use, so the next patch can repurpose that field for tracking
      which snapshot is current.
      
      * src/qemu/qemu_command.c (qemuBuildCommandLine): Don't use active
      field of snapshot.
      * src/qemu/qemu_process.c (qemuProcessStart): Add a parameter.
      * src/qemu/qemu_process.h (qemuProcessStart): Update prototype.
      * src/qemu/qemu_migration.c (qemuMigrationPrepareAny): Update
      callers.
      * src/qemu/qemu_driver.c (qemudDomainCreate)
      (qemuDomainSaveImageStartVM, qemuDomainObjStart)
      (qemuDomainRevertToSnapshot): Likewise.
      (qemuDomainSnapshotSetCurrentActive)
      (qemuDomainSnapshotSetCurrentInactive): Delete unused functions.
      5e47785b
    • E
      snapshot: don't leak resources on qemu snapshot failure · 861dc84b
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=727709
      mentions that if qemu fails to create the snapshot (such as what
      happens on Fedora 15 qemu, which has qmp but where savevm is only
      in hmp, and where libvirt is old enough to not try the hmp fallback),
      then 'virsh snapshot-list dom' will show a garbage snapshot entry,
      and the libvirt internal directory for storing snapshot metadata
      will have a bogus file.
      
      This fixes the fallout bug of polluting the snapshot-list with
      garbage on failure (the root cause of the F15 bug of not having
      fallback to hmp has already been fixed in newer libvirt releases).
      
      * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML): Allocate
      memory before making snapshot, and cleanup on failure.  Don't
      dereference NULL if transient domain exited during snapshot creation.
      861dc84b
    • A
      libvirt: avoid dead store in virDomainMigrateVersion3 · 5495e45e
      Alex Jia 提交于
      * src/qemu/qemu_migration.c: avoid dead 'ret' assignment and silence
        clang warning.
      
      Detected by ccc-analyzer:
      
      libvirt.c:4277:5: warning: Value stored to 'ret' is never read
          ret = domain->conn->driver->domainMigrateConfirm3
          ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      5495e45e
    • A
      qemu: avoid dead store in doPeer2PeerMigrate3 · d69d3210
      Alex Jia 提交于
      * src/qemu/qemu_migration.c: avoid dead 'ret' assignment and silence
        clang warning.
      
      Detected by ccc-analyzer:
      
        CC     libvirt_driver_qemu_la-qemu_migration.lo
      qemu/qemu_migration.c:2046:5: warning: Value stored to 'ret' is never read
          ret = qemuMigrationConfirm(driver, sconn, vm,
          ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      d69d3210
  2. 25 8月, 2011 6 次提交
  3. 24 8月, 2011 6 次提交
    • E
      libvirt: log all flags parameters · ba0c2199
      Eric Blake 提交于
      I was testing a virsh patch, and wanted to see if I had passed the
      flags I thought.  But with LIBVIRT_DEBUG in the environment, I just
      saw:
      
      14:24:52.359: 15022: debug : virDomainSnapshotNum:15586 : dom=0xc9c180, (VM: name=rhel_6-64, uuid=48f8e8e7-e14f-0e14-02f0-ce71997bdcab),
      
      including a trailing space.  This fixes the issues.
      
      * src/libvirt.c: Log flag parameters, even if currently unused.
      (VIR_DOMAIN_DEBUG_0): Drop trailing comma in log.
      (VIR_DOMAIN_DEBUG_1): Split guts into...
      (VIR_DOMAIN_DEBUG_2): ...new macro.
      ba0c2199
    • E
      virsh: add list --managed-save · 13154027
      Eric Blake 提交于
      Knowing whether 'virsh start' will resume a saved image or do
      a fresh boot is useful enough to expose via 'virsh list'.
      
      Also, translate the state column.
      
      * tools/virsh.c (cmdList): add --managed-save flag
      * tools/virsh.pod (list): Document it.
      Based on a suggestion by Miklos Vajna.
      13154027
    • M
      6aa57af3
    • O
      qemu: Report error if qemu monitor command not found for BlockJob · 10b10024
      Osier Yang 提交于
      * src/qemu/qemu_monitor_json.c: Handle error "CommandNotFound" and
        report the error.
      
      * src/qemu/qemu_monitor_text.c: If a sub info command is not found,
        it prints the output of "help info", for other commands,
        "unknown command" is printed.
      
      Without this patch, libvirt always report:
      
        An error occurred, but the cause is unknown
      
      This patch was adapted from a patch by Osier Yang <jyang@redhat.com> to
      break out detection of unrecognized text monitor commands into a separate
      function.
      Signed-off-by: NAdam Litke <agl@us.ibm.com>
      10b10024
    • M
      esx: Refactor a repeated string in the generator · 678cd0f0
      Matthias Bolte 提交于
      678cd0f0
    • E
      maint: fix comment typos · 3a52b864
      Eric Blake 提交于
      * src/qemu/qemu_driver.c (qemuDomainSaveInternal): Fix typo.
      * src/conf/domain_event.c (virDomainEventDispatchMatchCallback):
      Likewise.
      * daemon/libvirtd.c (daemonRunStateInit): Likewise.
      * src/lxc/lxc_container.c (lxcContainerChildMountSort): Likewise.
      * src/util/virterror.c (virCopyError, virRaiseErrorFull): Likewise.
      * src/xenxs/xen_sxpr.c (xenParseSxprSound): Likewise.
      3a52b864
  4. 23 8月, 2011 12 次提交
  5. 22 8月, 2011 2 次提交
    • K
      send-key: fix scan keycode map · 9f5afc73
      KAMEZAWA Hiroyuki 提交于
      Now, bad key-code in send-key can cause segmentation fault in libvirt.
      (example)
       % virsh send-key --codeset win32 12
         error: End of file while reading data: Input/output error
      
      This is caused by overrun at scanning keycode array.
      
      Fix it.
      Signed-off-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      9f5afc73
    • E
      build: work around older systemtap header · 6611d9eb
      Eric Blake 提交于
      Systemtap 1.2 <sys/sdt.h> tried to expand STAP_PROBE3 into an
      initialization:
        volatile __typeof__(arg) foo = arg;
      but that fails if arg was declared as 'char arg[100]'.
      Rather than make all callers to PROBE deal with the stupidity
      of <sys/sdt.h>, we instead make PROBE cast away the problem.
      Some of this preprocessor abuse copies ideas in src/libvirt.c.
      
      * daemon/libvirtd.h (PROBE): Add casts to all arguments, using...
      (VIR_ADD_CASTS, VIR_ADD_CAST, VIR_ADD_CAST2, VIR_ADD_CAST3)
      (VIR_ADD_CAST_EXPAND, VIR_ADD_CAST_PASTE, VIR_COUNT_ARGS)
      (VIR_ARG5, PROBE_EXPAND): New macros.
      Reported by Wen Congyang.
      6611d9eb
  6. 19 8月, 2011 9 次提交
    • E
      virsh: properly interleave shared stdout and stderr · baac9c37
      Eric Blake 提交于
      Without this patch, invoking 'virsh >file 2>&1' results in
      error messages appearing before normal output, even if they
      occurred later in time than the normal output (since stderr
      is unbuffered, but stdout waits until a full buffer).
      
      * tools/virsh.c (print_job_progress, vshError): Flush between
      stream transitions.
      * tests/undefine: Test it.
      baac9c37
    • E
      maint: simplify lots of libxml2 clients · d89dd42d
      Eric Blake 提交于
      Repetitive patterns should be factored.  The sign of a good
      factorization is a change that kills 5x more lines than it adds :)
      
      * src/conf/domain_conf.c (virDomainDeviceDefParse)
      (virDomainSnapshotDefParseString): Use new convenience macros.
      * src/conf/storage_conf.c (virStoragePoolDefParseSourceString):
      Likewise.
      * src/cpu/cpu.c (cpuCompareXML, cpuBaselineXML): Likewise.
      * src/esx/esx_vi.c (esxVI_Context_Execute): Likewise.
      * src/qemu/qemu_migration.c (qemuMigrationCookieXMLParseStr):
      Likewise.
      * src/security/virt-aa-helper.c (caps_mockup): Likewise.
      * src/test/test_driver.c (testOpenFromFile): Likewise.
      * tests/cputest.c (cpuTestLoadXML, cpuTestLoadMultiXML):
      Likewise.
      * tools/virsh.c (cmdFreecell, makeCloneXML, cmdVNCDisplay)
      (cmdTTYConsole, cmdDetachInterface, cmdDetachDisk)
      (cmdSnapshotCreate, cmdSnapshotCreateAs, cmdSnapshotCurrent)
      (cmdSnapshotList, cmdSnapshotParent): Likewise.
      d89dd42d
    • E
      xml: add another convenience function · 751304e3
      Eric Blake 提交于
      Often, we want to use XPath functions on the just-parsed document;
      fold this into the parser function for convenience.
      
      * src/util/xml.h (virXMLParseHelper): Add argument.
      (virXMLParseStrHelper, virXMLParseFileHelper): Delete.
      (virXMLParseCtxt, virXMLParseStringCtxt, virXMLParseFileCtxt): New
      macros.
      * src/libvirt_private.syms (xml.h): Remove deleted functions.
      * src/util/xml.c (virXMLParseHelper): Add argument.
      (virXMLParseStrHelper, virXMLParseFileHelper): Delete.
      751304e3
    • E
      maint: treat more libxml2 functions as free-like · e472fe25
      Eric Blake 提交于
      * cfg.mk (useless_free_options): Add xmlFreeDoc, xmlBufferFree.
      * src/esx/esx_vi.c (ESX_VI__TEMPLATE__FREE): Fix offenders.
      * tools/virsh.c (cmdFreecell, cmdVNCDisplay, cmdTTYConsole)
      (cmdDetachInterface, cmdDetachDisk, cmdSnapshotCreate)
      (cmdSnapshotCreateAs, cmdSnapshotList, cmdSnapshotParent):
      Likewise.
      e472fe25
    • E
      test: rewrite test to match change in behavior · 5f98c437
      Eric Blake 提交于
      Test failure exposed in commit 7d3390f8.
      
      * tests/undefine: Fix to match updated test driver semantics.
      5f98c437
    • E
      build: fix typo in recent test patch · 04682e69
      Eric Blake 提交于
      * src/test/test_driver.c (testDomainUndefineFlags): Use right
      variable name.
      04682e69
    • E
      Revert "xen: Allow to undefine a running domain (xm_internal)" · ecc27354
      Eric Blake 提交于
      ACK was given too soon.  According to the code, the xm driver is
      only used for inactive domains, and has no notion of an active
      domain, thus, it cannot support undefine of a running domain.
      The real fix for xen needs to be in the unified driver and/or
      the xend level.
      
      This reverts commit 49186ded.
      ecc27354
    • O
      xen: Allow to undefine a running domain (xm_internal) · 49186ded
      Osier Yang 提交于
      49186ded
    • O
      vmware: Allow to undefine a running domain · b9736d5b
      Osier Yang 提交于
      b9736d5b