1. 25 3月, 2014 3 次提交
    • Q
      qemu: add support for virDomainCoreDumpWithFormat API · 8c023e31
      Qiao Nuohan 提交于
      This patch makes qemu driver support virDomainCoreDumpWithFormat API.
      Signed-off-by: NQiao Nuohan <qiaonuohan@cn.fujitsu.com>
      8c023e31
    • Q
      qemu: add qemuMonitorGetDumpGuestMemoryCapability · 43177e2f
      Qiao Nuohan 提交于
      This patch adds qemuMonitorGetDumpGuestMemoryCapability, which is used to check
      whether the specified dump-guest-memory format is supported by qemu.
      Signed-off-by: NQiao Nuohan <qiaonuohan@cn.fujitsu.com>
      43177e2f
    • E
      conf: prepare to track multiple host source files per <disk> · 4f202266
      Eric Blake 提交于
      It's finally time to start tracking disk backing chains in
      <domain> XML.  The first step is to start refactoring code
      so that we have an object more convenient for representing
      each host source resource in the context of a single guest
      <disk>.  Ultimately, I plan to move the new type into src/util
      where it can be reused by virStorageFile, but to make the
      transition easier to review, this patch just creates the
      new type then fixes everything until it compiles again.
      
      * src/conf/domain_conf.h (_virDomainDiskDef): Split...
      (_virDomainDiskSourceDef): ...to new struct.
      (virDomainDiskAuthClear): Use new type.
      * src/conf/domain_conf.c (virDomainDiskDefFree): Split...
      (virDomainDiskSourceDefClear): ...to new function.
      (virDomainDiskGetType, virDomainDiskSetType)
      (virDomainDiskGetSource, virDomainDiskSetSource)
      (virDomainDiskGetDriver, virDomainDiskSetDriver)
      (virDomainDiskGetFormat, virDomainDiskSetFormat)
      (virDomainDiskAuthClear, virDomainDiskGetActualType)
      (virDomainDiskDefParseXML, virDomainDiskSourceDefFormat)
      (virDomainDiskDefFormat, virDomainDiskDefForeachPath)
      (virDomainDiskDefGetSecurityLabelDef)
      (virDomainDiskSourceIsBlockType): Adjust all users.
      * src/lxc/lxc_controller.c (virLXCControllerSetupDisk):
      Likewise.
      * src/lxc/lxc_driver.c (lxcDomainAttachDeviceMknodHelper):
      Likewise.
      * src/qemu/qemu_command.c (qemuAddRBDHost, qemuParseRBDString)
      (qemuParseDriveURIString, qemuParseGlusterString)
      (qemuParseISCSIString, qemuParseNBDString)
      (qemuDomainDiskGetSourceString, qemuBuildDriveStr)
      (qemuBuildCommandLine, qemuParseCommandLineDisk)
      (qemuParseCommandLine): Likewise.
      * src/qemu/qemu_conf.c (qemuCheckSharedDevice)
      (qemuAddISCSIPoolSourceHost, qemuTranslateDiskSourcePool):
      Likewise.
      * src/qemu/qemu_driver.c (qemuDomainUpdateDeviceConfig)
      (qemuDomainPrepareDiskChainElement)
      (qemuDomainSnapshotCreateInactiveExternal)
      (qemuDomainSnapshotPrepareDiskExternalBackingInactive)
      (qemuDomainSnapshotPrepareDiskInternal)
      (qemuDomainSnapshotPrepare)
      (qemuDomainSnapshotCreateSingleDiskActive)
      (qemuDomainSnapshotUndoSingleDiskActive)
      (qemuDomainBlockPivot, qemuDomainBlockJobImpl)
      (qemuDomainBlockCopy, qemuDomainBlockCommit): Likewise.
      * src/qemu/qemu_migration.c (qemuMigrationIsSafe): Likewise.
      * src/qemu/qemu_process.c (qemuProcessGetVolumeQcowPassphrase)
      (qemuProcessInitPasswords): Likewise.
      * src/security/security_selinux.c
      (virSecuritySELinuxSetSecurityFileLabel): Likewise.
      * src/storage/storage_driver.c (virStorageFileInitFromDiskDef):
      Likewise.
      * tests/securityselinuxlabeltest.c (testSELinuxLoadDef):
      Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      4f202266
  2. 21 3月, 2014 7 次提交
  3. 20 3月, 2014 1 次提交
    • D
      Fix unitialized data in virSocketAddrMask · ba08c593
      Daniel P. Berrange 提交于
      The virSocketAddrMask method did not initialize all fields
      in the sockaddr_in6 struct. In paticular the 'sin6_scope_id'
      field could contain random garbage, which would in turn
      affect the result of any later virSocketAddrFormat calls.
      This led to ip6tables rules in the FORWARD chain which
      matched on random garbage sin6_scope_id. Fortunately these
      were ACCEPT rules, so the impact was merely that desired
      traffic was blocked, rather than undesired traffic allowed.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      ba08c593
  4. 19 3月, 2014 3 次提交
    • N
      qemuhotplugtest: Fix mem-leaking testcases · 0ab0f7e3
      Nehal J Wani 提交于
      While running qemuhotplugtest, it was found that valgrind pointed out
      the following memory leak:
      
      ==7906== 5 bytes in 1 blocks are definitely lost in loss record 7 of 121
      ==7906==    at 0x4A069EE: malloc (vg_replace_malloc.c:270)
      ==7906==    by 0x3E782A754D: xmlStrndup (in /usr/lib64/libxml2.so.2.7.6)
      ==7906==    by 0x4CDAE03: virDomainDeviceInfoParseXML.isra.32 (domain_conf.c:3685)
      ==7906==    by 0x4CE3BB9: virDomainNetDefParseXML (domain_conf.c:6707)
      ==7906==    by 0x4CFBA08: virDomainDefParseXML (domain_conf.c:12235)
      ==7906==    by 0x4CFBC1E: virDomainDefParseNode (domain_conf.c:13039)
      ==7906==    by 0x4CFBD95: virDomainDefParse (domain_conf.c:12981)
      ==7906==    by 0x41FEB4: testQemuHotplug (qemuhotplugtest.c:66)
      ==7906==    by 0x420F41: virtTestRun (testutils.c:201)
      ==7906==    by 0x41F287: mymain (qemuhotplugtest.c:422)
      ==7906==    by 0x4216BD: virtTestMain (testutils.c:784)
      ==7906==    by 0x3E6CE1ED1C: (below main) (libc-start.c:226)
      ...and 10 more.
      
      Problem is, since 20745748 we do both, parse <alias/> elements from
      XML files and call qemuAssignDeviceAliases(). While generating runtime
      info for domain at runtime is just fine in the test, we can parse just
      inactive XML and remove all <alias/>-es from the XML files.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      0ab0f7e3
    • M
      build: Fix make distcheck · eeb1e80e
      Martin Kletzander 提交于
      I forgot to delete the underscore in object_locking_SOURCES when
      changing the name in one of previous cleanups.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      eeb1e80e
    • D
      Add ability to register callback for virCommand dry run · 7b3f1f8c
      Daniel P. Berrange 提交于
      To allow for fault injection of the virCommand dry run,
      add the ability to register a callback. The callback will
      be passed the argv, env and stdin buffer and is expected
      to return the exit status and optionally fill stdout and
      stderr buffers.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      7b3f1f8c
  5. 18 3月, 2014 7 次提交
  6. 15 3月, 2014 1 次提交
    • C
      qemu: XMLToNative: Don't show -S · e8400564
      Cole Robinson 提交于
      -S causes qemu to start in the paused state. Since XML2Native is intended
      to generate something that users can run directly, this will trip them up.
      e8400564
  7. 13 3月, 2014 1 次提交
  8. 12 3月, 2014 1 次提交
  9. 11 3月, 2014 2 次提交
  10. 10 3月, 2014 2 次提交
  11. 07 3月, 2014 3 次提交
  12. 04 3月, 2014 9 次提交
    • C
      add 'driver' info to used_by · de6fa535
      Chunyan Liu 提交于
      Specify which driver and which domain in used_by area to avoid conflict among
      different drivers.
      Signed-off-by: NChunyan Liu <cyliu@suse.com>
      de6fa535
    • J
      Check if systemd is running before creating machines · 12ee0b98
      Ján Tomko 提交于
      If systemd is installed, but is not the init system,
      systemd-machined fails with an unhelpful error message:
      Launch helper exited with unknown return code 1
      
      Currently we only check if the "machine1" service is
      available (in ListActivatableNames).
      Also check if "systemd1" service is registered with DBus
      (ListNames).
      
      This fixes https://bugs.gentoo.org/show_bug.cgi?id=493246#c22
      12ee0b98
    • J
      Don't always skip virportallocatortest · d7e0f113
      Ján Tomko 提交于
      Include dlfcn.h before checking if RTLD_NEXT is defined
      d7e0f113
    • M
      tests: Create privileged driver config in qemuxml2argvtest · 29151830
      Martin Kletzander 提交于
      This is actually a proper setting since we're not checking
      session-mode related XMLs.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      29151830
    • J
      build: Include sys/wait.h in commandtest.c · 460e42b1
      Ján Tomko 提交于
      Commit 631923e7 used a few macros from sys/wait.h without including
      it. On Linux, they were also defined in stdlib.h, but on FreeBSD
      the build failed:
      
      ../../tests/commandtest.c: In function 'test1':
      warning: implicit declaration of function 'WIFEXITED'
      warning: nested extern declaration of 'WIFEXITED' [-Wnested-externs]
      460e42b1
    • E
      virFork: simplify semantics · 25f87817
      Eric Blake 提交于
      The old semantics of virFork() violates the priciple of good
      usability: it requires the caller to check the pid argument
      after use, *even when virFork returned -1*, in order to properly
      abort a child process that failed setup done immediately after
      fork() - that is, the caller must call _exit() in the child.
      While uses in virfile.c did this correctly, uses in 'virsh
      lxc-enter-namespace' and 'virt-login-shell' would happily return
      from the calling function in both the child and the parent,
      leading to very confusing results. [Thankfully, I found the
      problem by inspection, and can't actually trigger the double
      return on error without an LD_PRELOAD library.]
      
      It is much better if the semantics of virFork are impossible
      to abuse.  Looking at virFork(), the parent could only ever
      return -1 with a non-negative pid if it misused pthread_sigmask,
      but this never happens.  Up until this patch series, the child
      could return -1 with non-negative pid if it fails to set up
      signals correctly, but we recently fixed that to make the child
      call _exit() at that point instead of forcing the caller to do
      it.  Thus, the return value and contents of the pid argument are
      now redundant (a -1 return now happens only for failure to fork,
      a child 0 return only happens for a successful 0 pid, and a
      parent 0 return only happens for a successful non-zero pid),
      so we might as well return the pid directly rather than an
      integer of whether it succeeded or failed; this is also good
      from the interface design perspective as users are already
      familiar with fork() semantics.
      
      One last change in this patch: before returning the pid directly,
      I found cases where using virProcessWait unconditionally on a
      cleanup path of a virFork's -1 pid return would be nicer if there
      were a way to avoid it overwriting an earlier message.  While
      such paths are a bit harder to come by with my change to a direct
      pid return, I decided to keep the virProcessWait change in this
      patch.
      
      * src/util/vircommand.h (virFork): Change signature.
      * src/util/vircommand.c (virFork): Guarantee that child will only
      return on success, to simplify callers.  Return pid rather than
      status, now that the situations are always the same.
      (virExec): Adjust caller, also avoid open-coding process death.
      * src/util/virprocess.c (virProcessWait): Tweak semantics when pid
      is -1.
      (virProcessRunInMountNamespace): Adjust caller.
      * src/util/virfile.c (virFileAccessibleAs, virFileOpenForked)
      (virDirCreate): Likewise.
      * tools/virt-login-shell.c (main): Likewise.
      * tools/virsh-domain.c (cmdLxcEnterNamespace): Likewise.
      * tests/commandtest.c (test23): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      25f87817
    • E
      util: make it easier to grab only regular command exit · b9dd878f
      Eric Blake 提交于
      Auditing all callers of virCommandRun and virCommandWait that
      passed a non-NULL pointer for exit status turned up some
      interesting observations.  Many callers were merely passing
      a pointer to avoid the overall command dying, but without
      caring what the exit status was - but these callers would
      be better off treating a child death by signal as an abnormal
      exit.  Other callers were actually acting on the status, but
      not all of them remembered to filter by WIFEXITED and convert
      with WEXITSTATUS; depending on the platform, this can result
      in a status being reported as 256 times too big.  And among
      those that correctly parse the output, it gets rather verbose.
      Finally, there were the callers that explicitly checked that
      the status was 0, and gave their own message, but with fewer
      details than what virCommand gives for free.
      
      So the best idea is to move the complexity out of callers and
      into virCommand - by default, we return the actual exit status
      already cleaned through WEXITSTATUS and treat signals as a
      failed command; but the few callers that care can ask for raw
      status and act on it themselves.
      
      * src/util/vircommand.h (virCommandRawStatus): New prototype.
      * src/libvirt_private.syms (util/command.h): Export it.
      * docs/internals/command.html.in: Document it.
      * src/util/vircommand.c (virCommandRawStatus): New function.
      (virCommandWait): Adjust semantics.
      * tests/commandtest.c (test1): Test it.
      * daemon/remote.c (remoteDispatchAuthPolkit): Adjust callers.
      * src/access/viraccessdriverpolkit.c (virAccessDriverPolkitCheck):
      Likewise.
      * src/fdstream.c (virFDStreamCloseInt): Likewise.
      * src/lxc/lxc_process.c (virLXCProcessStart): Likewise.
      * src/qemu/qemu_command.c (qemuCreateInBridgePortWithHelper):
      Likewise.
      * src/xen/xen_driver.c (xenUnifiedXendProbe): Simplify.
      * tests/reconnect.c (mymain): Likewise.
      * tests/statstest.c (mymain): Likewise.
      * src/bhyve/bhyve_process.c (virBhyveProcessStart)
      (virBhyveProcessStop): Don't overwrite virCommand error.
      * src/libvirt.c (virConnectAuthGainPolkit): Likewise.
      * src/openvz/openvz_driver.c (openvzDomainGetBarrierLimit)
      (openvzDomainSetBarrierLimit): Likewise.
      * src/util/virebtables.c (virEbTablesOnceInit): Likewise.
      * src/util/viriptables.c (virIpTablesOnceInit): Likewise.
      * src/util/virnetdevveth.c (virNetDevVethCreate): Fix debug
      message.
      * src/qemu/qemu_capabilities.c (virQEMUCapsInitQMP): Add comment.
      * src/storage/storage_backend_iscsi.c
      (virStorageBackendISCSINodeUpdate): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b9dd878f
    • E
      util: make it easier to grab only regular process exit · c72e76c3
      Eric Blake 提交于
      Right now, a caller waiting for a child process either requires
      the child to have status 0, or must use WIFEXITED() and friends
      itself.  But in many cases, we want the middle ground of treating
      fatal signals as an error, and directly accessing the normal exit
      value without having to use WEXITSTATUS(), in order to easily
      detect an expected non-zero exit status.  This adds the middle
      ground to the low-level virProcessWait; the next patch will add
      it to virCommand.
      
      * src/util/virprocess.h (virProcessWait): Alter signature.
      * src/util/virprocess.c (virProcessWait): Add parameter.
      (virProcessRunInMountNamespace): Adjust caller.
      * src/util/vircommand.c (virCommandWait): Likewise.
      * src/util/virfile.c (virFileAccessibleAs): Likewise.
      * src/lxc/lxc_container.c (lxcContainerHasReboot)
      (lxcContainerAvailable): Likewise.
      * daemon/libvirtd.c (daemonForkIntoBackground): Likewise.
      * tools/virt-login-shell.c (main): Likewise.
      * tools/virsh-domain.c (cmdLxcEnterNamespace): Likewise.
      * tests/testutils.c (virtTestCaptureProgramOutput): Likewise.
      * tests/commandtest.c (test23): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      c72e76c3
    • E
      util: make it easier to reflect child exit status · 2b4f162e
      Eric Blake 提交于
      Thanks to namespaces, we have a couple of places in the code
      base that want to reflect a child exit status, including the
      ability to detect death by a signal, back to a grandparent.
      Best to make it a reusable function.
      
      * src/util/virprocess.h (virProcessExitWithStatus): New prototype.
      * src/libvirt_private.syms (util/virprocess.h): Export it.
      * src/util/virprocess.c (virProcessExitWithStatus): New function.
      * tests/commandtest.c (test23): Test it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      2b4f162e