1. 25 3月, 2014 14 次提交
    • E
      conf: use disk source accessors in vbox/ · 6c1eb084
      Eric Blake 提交于
      Part of a series of cleanups to use new accessor methods.
      
      * src/vbox/vbox_tmpl.c (vboxDomainGetXMLDesc, vboxAttachDrives)
      (vboxDomainAttachDeviceImpl, vboxDomainDetachDevice): Use
      accessors.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      6c1eb084
    • E
      conf: use disk source accessors in uml/ · 8082d9bb
      Eric Blake 提交于
      Part of a series of cleanups to use new accessor methods.
      
      * src/uml/uml_conf.c (umlBuildCommandLine): Use accessors.
      * src/uml/uml_driver.c (umlDomainAttachUmlDisk): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      8082d9bb
    • E
      conf: use disk source accessors in security/ · 2aad0ebe
      Eric Blake 提交于
      Part of a series of cleanups to use new accessor methods.
      
      * src/security/security_dac.c (virSecurityDACSetSecurityImageLabel)
      (virSecurityDACRestoreSecurityImageLabelInt)
      (virSecurityDACSetSecurityAllLabel): Use accessors.
      * src/security/security_selinux.c
      (virSecuritySELinuxRestoreSecurityImageLabelInt)
      (virSecuritySELinuxSetSecurityImageLabel)
      (virSecuritySELinuxSetSecurityAllLabel): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      2aad0ebe
    • E
      conf: use disk source accessors in qemu/ · cd01d2ad
      Eric Blake 提交于
      Part of a series of cleanups to use new accessor methods.
      
      * src/qemu/qemu_conf.c (qemuCheckSharedDevice)
      (qemuAddSharedDevice, qemuRemoveSharedDevice, qemuSetUnprivSGIO):
      Use accessors.
      * src/qemu/qemu_domain.c (qemuDomainDeviceDefPostParse)
      (qemuDomainObjCheckDiskTaint, qemuDomainSnapshotForEachQcow2Raw)
      (qemuDomainCheckRemoveOptionalDisk, qemuDomainCheckDiskPresence)
      (qemuDiskChainCheckBroken, qemuDomainDetermineDiskChain):
      Likewise.
      * src/qemu/qemu_hotplug.c (qemuDomainChangeEjectableMedia)
      (qemuDomainCheckEjectableMedia)
      (qemuDomainAttachVirtioDiskDevice, qemuDomainAttachSCSIDisk)
      (qemuDomainAttachUSBMassstorageDevice)
      (qemuDomainAttachDeviceDiskLive, qemuDomainRemoveDiskDevice)
      (qemuDomainDetachVirtioDiskDevice, qemuDomainDetachDiskDevice):
      Likewise.
      * src/qemu/qemu_migration.c (qemuMigrationStartNBDServer)
      (qemuMigrationDriveMirror, qemuMigrationCancelDriveMirror)
      (qemuMigrationIsSafe): Likewise.
      * src/qemu/qemu_process.c (qemuProcessGetVolumeQcowPassphrase)
      (qemuProcessHandleIOError, qemuProcessHandleBlockJob)
      (qemuProcessInitPasswords): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainChangeDiskMediaLive)
      (qemuDomainGetBlockInfo, qemuDiskPathToAlias): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      cd01d2ad
    • E
      conf: use disk source accessors in phyp/ · 73f4ae2a
      Eric Blake 提交于
      Part of a series of cleanups to use new accessor methods.
      
      * src/phyp/phyp_driver.c (phypDomainAttachDevice, phypBuildLpar):
      Use accessors.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      73f4ae2a
    • E
      conf: use disk source accessors in parallels/ · e04a4ab9
      Eric Blake 提交于
      Part of a series of cleanups to use new accessor methods.
      
      * src/parallels/parallels_driver.c (parallelsGetHddInfo)
      (parallelsAddHdd, parallelsApplyDisksParams, parallelsCreateVm):
      Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e04a4ab9
    • E
      conf: use disk source accessors in lxc/ · a7785ccf
      Eric Blake 提交于
      Part of a series of cleanups to use new accessor methods.
      
      * src/lxc/lxc_cgroup.c (virLXCCgroupSetupDeviceACL): Use
      accessors.
      * src/lxc/lxc_controller.c (virLXCControllerSetupLoopDeviceDisk)
      (virLXCControllerSetupNBDDeviceDisk)
      (virLXCControllerSetupLoopDevices, virLXCControllerSetupDisk):
      Likewise.
      * src/lxc/lxc_driver.c (lxcDomainAttachDeviceDiskLive)
      (lxcDomainDetachDeviceDiskLive): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      a7785ccf
    • E
      conf: use disk source accessors in locking/ · 6b44ccf7
      Eric Blake 提交于
      Part of a series of cleanups to use new accessor methods.
      
      * src/locking/domain_lock.c (virDomainLockManagerAddDisk): Use
      accessors.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      6b44ccf7
    • E
      conf: use disk source accessors in libxl/ · f7c81d84
      Eric Blake 提交于
      Part of a series of cleanups to use new accessor methods.
      
      * src/libxl/libxl_conf.c (libxlMakeDisk): Use accessors.
      * src/libxl/libxl_driver.c (libxlDomainChangeEjectableMedia)
      (libxlDomainAttachDeviceDiskLive): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      f7c81d84
    • E
      conf: use disk source accessors in esx/ · 3c975118
      Eric Blake 提交于
      Part of a series of cleanups to use new accessor methods.
      
      * src/esx/esx_driver.c (esxAutodetectSCSIControllerModel)
      (esxDomainDefineXML): Use accessors.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      3c975118
    • E
      conf: use disk source accessors in bhyve/ · 119a258c
      Eric Blake 提交于
      Part of a series of cleanups to use new accessor methods.
      
      * src/bhyve/bhyve_command.c (bhyveBuildDiskArgStr)
      (virBhyveProcessBuildLoadCmd): Use accessors.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      119a258c
    • E
      conf: use disk source accessors in conf/ · a9ab99ca
      Eric Blake 提交于
      Part of a series of cleanups to use new accessor methods.
      
      Several places in domain_conf.c still open-code raw field access,
      but that code will be touched later with the diskDef struct split
      so I'm avoiding churn here.
      
      * src/conf/domain_audit.c (virDomainAuditStart): Use accessors.
      * src/conf/domain_conf.c (virDomainDiskIndexByName)
      (virDomainDiskPathByName, virDomainDiskDefForeachPath)
      (virDomainDiskSourceIsBlockType): Likewise.
      * src/conf/snapshot_conf.c (virDomainSnapshotAlignDisks):
      Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      a9ab99ca
    • E
      conf: accessors for common source information · 1014c34e
      Eric Blake 提交于
      A future patch will split virDomainDiskDef, in order to track
      multiple host resources per guest <disk>.  To reduce the size
      of that patch, I've factored out the four most common accesses
      into functions, so that I can incrementally upgrade the code
      base to use the accessors, and so that code that doesn't care
      about the distinction of per-file details won't have to be
      changed when the struct changes.
      
      * src/conf/domain_conf.h (virDomainDiskGetType)
      (virDomainDiskSetType, virDomainDiskGetSource)
      (virDomainDiskSetSource, virDomainDiskGetDriver)
      (virDomainDiskSetDriver, virDomainDiskGetFormat)
      (virDomainDiskSetFormat): New prototypes.
      * src/conf/domain_conf.c (virDomainDiskGetType)
      (virDomainDiskSetType, virDomainDiskGetSource)
      (virDomainDiskSetSource, virDomainDiskGetDriver)
      (virDomainDiskSetDriver, virDomainDiskGetFormat)
      (virDomainDiskSetFormat): Implement them.
      * src/libvirt_private.syms (domain_conf.h): Export them.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1014c34e
    • E
      vmware: fix parse of disk source · e7b0e71d
      Eric Blake 提交于
      While writing disk source refactoring, I discovered that conversion
      from XML to vmware modified the disk source in place; if the same
      code is reached twice, the second call behaves differently because
      the first call didn't clean up its mess.
      
      * src/vmware/vmware_conf.c (vmwareParsePath): Avoid munging input
      string.
      * src/vmware/vmware_conf.h (vmwareParsePath): Make static.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e7b0e71d
  2. 24 3月, 2014 1 次提交
    • M
      qemuDomainGetImageIds: Skip <seclabel/> without label · 0d93526f
      Michal Privoznik 提交于
      It's easy to shed the daemon these days. With this XML snippet:
      
          <disk type='file' device='disk'>
            <driver name='qemu' type='raw'/>
            <source file='/some/dummy/path/test.bin'>
              <seclabel model='dac' relabel='no'/>
            </source>
            <target dev='vdb' bus='virtio'/>
            <readonly/>
            <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
          </disk>
      
      I get the SIGSEGV when starting the domain. The thing is, when
      starting a domain, we check for its disk presence. For some reason,
      when determining the disk chain, we parse the <seclabel/> (don't ask
      me why). However, there's no label attribute in the XML, so we end up
      calling virParseOwnershipIds() over NULL string:
      
       [Switching to Thread 0x7ffff10c4700 (LWP 30956)]
       __strchr_sse42 () at ../sysdeps/x86_64/multiarch/strchr.S:136
       136     ../sysdeps/x86_64/multiarch/strchr.S: No such file or directory.
       (gdb) bt
       #0  __strchr_sse42 () at ../sysdeps/x86_64/multiarch/strchr.S:136
       #1  0x00007ffff749f800 in virParseOwnershipIds (label=0x0, uidPtr=uidPtr@entry=0x7ffff10c2df0, gidPtr=gidPtr@entry=0x7ffff10c2df4) at util/virutil.c:2115
       #2  0x00007fffe929f006 in qemuDomainGetImageIds (gid=0x7ffff10c2df4, uid=0x7ffff10c2df0, disk=0x7fffe40cb000, vm=0x7fffe40a6410, cfg=0x7fffe409ae00) at qemu/qemu_domain.c:2385
       #3  qemuDomainDetermineDiskChain (driver=driver@entry=0x7fffe40120e0, vm=vm@entry=0x7fffe40a6410, disk=disk@entry=0x7fffe40cb000, force=force@entry=false) at qemu/qemu_domain.c:2414
       #4  0x00007fffe929f128 in qemuDomainCheckDiskPresence (driver=driver@entry=0x7fffe40120e0, vm=vm@entry=0x7fffe40a6410, cold_boot=cold_boot@entry=true) at qemu/qemu_domain.c:2250
       #5  0x00007fffe92b6fc8 in qemuProcessStart (conn=conn@entry=0x7fffd4000b60, driver=driver@entry=0x7fffe40120e0, vm=vm@entry=0x7fffe40a6410, migrateFrom=migrateFrom@entry=0x0, stdin_fd=stdin_fd@entry=-1, stdin_path=stdin_path@entry=0x0, snapshot=snapshot@entry=0x0,
           vmop=vmop@entry=VIR_NETDEV_VPORT_PROFILE_OP_CREATE, flags=flags@entry=1) at qemu/qemu_process.c:3813
       #6  0x00007fffe93087e8 in qemuDomainObjStart (conn=0x7fffd4000b60, driver=driver@entry=0x7fffe40120e0, vm=vm@entry=0x7fffe40a6410, flags=flags@entry=0) at qemu/qemu_driver.c:6051
       #7  0x00007fffe9308e32 in qemuDomainCreateWithFlags (dom=0x7fffcc000d50, flags=0) at qemu/qemu_driver.c:6105
       #8  0x00007ffff753c5cc in virDomainCreate (domain=domain@entry=0x7fffcc000d50) at libvirt.c:8861
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      0d93526f
  3. 23 3月, 2014 2 次提交
  4. 22 3月, 2014 1 次提交
  5. 21 3月, 2014 22 次提交
    • R
      Introduce virFDStreamOpenPTY · 4dae396f
      Roman Bogorodskiy 提交于
      Add virFDStreamOpenPTY() function which is a wrapper around
      virFDStreamOpenFileInternal() with putting the device it opens into a
      raw mode.
      
      Make virChrdevOpen() use virFDStreamOpenPTY() for
      VIR_DOMAIN_CHR_TYPE_PTY devices.
      
      This fixes mangled console output when libvirt runs on FreeBSD as it
      requires device it opens to be placed into a raw mode explicitly.
      4dae396f
    • J
      Add stubs for virDBusCreateReply{,V} · 80fb32c3
      Ján Tomko 提交于
      Fix the build without dbus.
      80fb32c3
    • J
      Fix build on mingw32 · 7f973f0d
      Ján Tomko 提交于
      tests/viriscsitest.c:27:12: error: 'EXIT_AM_SKIP' undeclared
      (first use in this function)
      7f973f0d
    • C
      libvirt support to force convergence of live guest migration · 05e1b06a
      Chegu Vinod 提交于
      Busy enterprise workloads hosted on large sized VM's tend to dirty
      memory faster than the transfer rate achieved via live guest migration.
      Despite some good recent improvements (& using dedicated 10Gig NICs
      between hosts) the live migration may NOT converge.
      
      Recently support was added in qemu (version 1.6) to allow a user to
      choose if they wish to force convergence of their migration via a
      new migration capability : "auto-converge". This feature allows for qemu
      to auto-detect lack of convergence and trigger a throttle-down of the
      VCPUs.
      
      This patch includes the libvirt support needed to trigger this
      feature. (Testing is in progress)
      Signed-off-by: NChegu Vinod <chegu_vinod@hp.com>
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      05e1b06a
    • W
      cgroup: Fix start VMs coincidently failed · bfb29654
      Wang Yufei 提交于
      When I start multi VMs coincidently and any of the cgroup directories
      named machine doesn't exist. There's a chance that VM start failed because
      of creating directory failed:
      Unable to initialize /machine cgroup: File exists
      When the errno returned by mkdir in virCgroupMakeGroup is EEXIST,
      we should pass it through and continue to start the VM.
      Signed-off-by: NWang Yufei <james.wangyufei@huawei.com>
      bfb29654
    • D
      Allow caller to handle DBus error messages · edff187a
      Daniel P. Berrange 提交于
      The caller may not want all DBus error conditions to be turned
      into libvirt errors, so provide a way for the caller to get
      back the full DBusError object. They can then check the errors
      and only report those that they consider to be fatal.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      edff187a
    • D
      Introduce alternate way to encode/decode arrays in DBus messages · 2c646033
      Daniel P. Berrange 提交于
      Currently the DBus helper APIs require the values for an array
      to be passed inline in the variadic argument list. This change
      introduces support for passing arrays using a pointer to a plain
      C array of the basic type. This is of particular benefit for
      decoding messages when you don't know how many array elements
      are being received.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      2c646033
    • D
      Remove bogus call to dbus_set_error_from_message · 217ac43e
      Daniel P. Berrange 提交于
      The dbus_connection_send_with_reply_and_block method will
      automatically call dbus_set_error_from_message for us. We
      mistakenly thought we had todo it because of a flaw in the
      systemd unit test mock impl. The latter should have directly
      set the error object, instead of creating an error message
      object.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      217ac43e
    • D
      Remove bogus unref in virDBusMessageRead · dc7f3ffc
      Daniel P. Berrange 提交于
      The virDBusMessageRead method should not have side-effects on
      the message parameter passed in, so unref'ing it is wrong.
      The caller should unref only when they decided they are done
      with it.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      dc7f3ffc
    • D
      Add DBus helper methods for creating reply messages · bd93dea3
      Daniel P. Berrange 提交于
      The test suites often have to create DBus method reply messages
      with payloads. Create two helpers for simplifying the process
      of creating replies with payloads.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      bd93dea3
    • D
      Refactor dbus helper methods for method calls · 838d0b04
      Daniel P. Berrange 提交于
      Split the virDBusMethodCall method into a couple of new methods
      virDBusCall, virDBusCreateMethod and virDBusCreateMethodV.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      838d0b04
    • Z
      virlog: Modify virLogParseDefaultPriority's comment of return value · 835a1cdf
      Zhou Yimin 提交于
      virLogParseDefaultPriority's successful return value is the same as
      virLogSetDefaultPriority's successful return value. So it should be 0
      rather than the parsed log level.
      Signed-off-by: NZhou Yimin <zhouyimin@huawei.com>
      835a1cdf
    • J
      Fix typo in configure.ac · b7a5a6ab
      Ján Tomko 提交于
      s/profram/program/
      b7a5a6ab
    • J
      Define ISCSIADM unconditionally · 69ad6b57
      Ján Tomko 提交于
      Commit 5e1d5dde moved the functions using isciadm to util/viriscsi.c,
      but ISCSIADM was only defined when the iscsi backend was compiled in.
      
      Define it unconditionally to fix the build (and allow testing
      of viriscsi.c) even if iscsi backend is disabled.
      69ad6b57
    • J
      Check boot order on device attach · 585076c7
      Jiri Denemark 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1007754
      
      When attaching a new device, we need to check if its boot order
      configuration is compatible with current domain definition.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      585076c7
    • J
      conf: Introduce virDomainDeviceGetInfo API · 563a12b3
      Jiri Denemark 提交于
      The offset of virDomainDeviceInfo structure within a device definition
      varies with device type and some types do not contain the info structure
      at all. This new API makes it easier to access the info structure from a
      generic virDomainDeviceDef structure.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      563a12b3
    • J
      Pass action to virDomainDefCompatibleDevice · 1c131661
      Jiri Denemark 提交于
      When checking compatibility of a device with a domain definition, we
      should know what we're going to do with the device. Because we may need
      to check for different things when we're attaching a new device versus
      detaching an existing device.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      1c131661
    • J
      Fix usage of virDomainDefCompatibleDevice · 6dc75f56
      Jiri Denemark 提交于
      A device needs to be checked for compatibility with the domain
      definition it corresponds to. Specifically, for VIR_DOMAIN_AFFECT_CONFIG
      case we should check against persistent def rather than active def.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      6dc75f56
    • J
      qemu: Return meaningful error when qemu dies early · cfa7ceab
      Jiri Denemark 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=844378
      
      When qemu dies early after connecting to its monitor but before we
      actually try to read something from the monitor, we would just fail
      domain start with useless message:
      
          "An error occurred, but the cause is unknown"
      
      This is because the real error gets reported in a monitor EOF handler
      executing within libvirt's event loop.
      
      The fix is to take any error set in qemuMonitor structure and propagate
      it into the thread-local error when qemuMonitorClose is called and no
      thread-local error is set.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      cfa7ceab
    • J
      tests: Set abs_*dir in a consistent way · 11cb128f
      Jiri Denemark 提交于
      Use $(shell cd $(...) && pwd) to set abs_*dir variables similarly to
      what src/Makefile.am does.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      11cb128f
    • E
      qemu: allow filtering events by regex · 43b17dd4
      Eric Blake 提交于
      When listening for a subset of monitor events, it can be tedious
      to register for each event name in series; nicer is to register
      for multiple events in one go.  Implement a flag to use regex
      interpretation of the event filter.
      
      While at it, prove how much I hate the shift key, by adding a
      way to filter for 'shutdown' instead of 'SHUTDOWN'. :)
      
      * include/libvirt/libvirt-qemu.h
      (virConnectDomainQemuMonitorEventRegisterFlags): New enum.
      * src/libvirt-qemu.c (virConnectDomainQemuMonitorEventRegister):
      Document flags.
      * tools/virsh-domain.c (cmdQemuMonitorEvent): Expose them.
      * tools/virsh.pod (qemu-monitor-event): Document this.
      * src/conf/domain_event.c
      (virDomainQemuMonitorEventStateRegisterID): Add flags.
      (virDomainQemuMonitorEventFilter): Handle regex, and optimize
      client side.
      (virDomainQemuMonitorEventCleanup): Clean up regex.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      43b17dd4
    • E
      qemu: enable monitor event filtering by name · d0ba8dd7
      Eric Blake 提交于
      Filtering monitor events by name requires tracking the name for
      the duration of the filtering.  In order to free the name, I
      found it easiest to just piggyback on the user's freecb function,
      which gets called when the event is deregistered.
      
      For events without a name filter, we have the design of multiple
      client registrations sharing a common server registration, because
      the server side uses the same callback function and we reject
      duplicate use of the same function.  But with events in the mix,
      we want to be able to allow the same function pointer to be used
      with more than one event name.  The solution is to tweak the
      duplicate detection code to only act when there is no additional
      filtering; if name filtering is in use, there is exactly one
      client registration per server registration.  Yes, this means
      that there is no longer a bound on the number of server
      registrations possible, so a malicious client could repeatedly
      register for the same name event to exhaust server memory.  On
      the other hand, we already restricted monitor events to require
      write access (compared to normal events only needing read access),
      and separated it into the intentionally unsupported
      libvirt-qemu.so, with documentation that using this function is
      for debug purposes only; so it is not a security risk worth
      worrying about a client trying to abuse multiple registrations.
      
      * src/conf/domain_event.c (virDomainQemuMonitorEventData): New
      struct.
      (virDomainQemuMonitorEventFilter)
      (virDomainQemuMonitorEventCleanup): New functions.
      (virDomainQemuMonitorEventDispatchFunc)
      (virDomainQemuMonitorEventStateRegisterID): Use new struct.
      * src/conf/object_event.c (virObjectEventCallbackListCount)
      (virObjectEventCallbackListAddID)
      (virObjectEventCallbackListRemoveID)
      (virObjectEventCallbackListMarkDeleteID): Drop duplicate detection
      when filtering is in effect.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d0ba8dd7