1. 11 12月, 2012 5 次提交
    • D
      parallels: split parallelsStorageOpen function · 21e1bdeb
      Dmitry Guryanov 提交于
      Move code for loading inforation about pools to a separate
      function - parallelsLoadPools.
      Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
      21e1bdeb
    • D
      parallels: handle disk devices in parallelsDomainDefineXML · 45e63171
      Dmitry Guryanov 提交于
      Allow changing some parameters of the hard disks: bus,
      image and drive address.
      
      Creating new disk devices and removing existing ones
      require changes in the storage driver, so it will be
      implemented later.
      Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
      45e63171
    • D
      parallels: add info about hard disk devices · 6718b2d7
      Dmitry Guryanov 提交于
      Parse information about hard disks and fill disks array
      in virDomainDef structure.
      Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
      6718b2d7
    • L
      Add support for offline migration · 8b9bf787
      liguang 提交于
      Offline migration transfers inactive definition of a domain (which may
      or may not be active). After successful completion, the domain remains
      in its current state on source host and is defined but inactive on
      destination host. It's a bit more clever than virDomainGetXMLDesc() on
      source host followed by virDomainDefineXML() on destination host, as
      offline migration will run pre-migration hook to update the domain XML
      on destination host. Currently, copying non-shared storage is not
      supported during offline migration.
      
      Offline migration can be requested with a new migration flag called
      VIR_MIGRATE_OFFLINE (which has to be combined with
      VIR_MIGRATE_PERSIST_DEST flag).
      8b9bf787
    • L
      qemu: eliminate bogus error log when changing netdev's bridge · e5577872
      Laine Stump 提交于
      This fixes a problem that showed up during testing of:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=881480
      
      Due to a logic error in the function that gets the name of the bridge
      an interface connects to, any time a bridge was specified directly
      (type='bridge') rather than indirectly (type='network'), An error
      would be logged (although the operation would then complete
      successfully):
      
         Network type 6 is not supported
      
      The final virReportError() in the function
      qemuDomainNetGetBridgeName() was apparently avoided in the past with a
      "goto cleanup" at the end of each case, but the case of bridge somehow
      no longer has that final goto cleanup.
      
      The proper solution is anyway to not rely on goto's, but put the error
      log inside an else {} clause, so that it's executed only if the type
      is neither bridge nor network (in reality, this function should only
      ever be called for those two types, that's why this is an internal
      error).
      
      While making this change, the error message was also tuned to be more
      correct (since it's not really the type of the network, but the type
      of the interface, and it *is* otherwise supported, it's just that the
      interface type in question doesn't *have* a bridge device associated
      with it, or at least we don't know how to get it).
      e5577872
  2. 10 12月, 2012 2 次提交
  3. 08 12月, 2012 1 次提交
  4. 07 12月, 2012 8 次提交
    • P
      virsh: Fix usage of header termios.h · 989a427d
      Peter Krempa 提交于
      The termios struct exported by the termios.h header is used as an
      argument for vshMakeStdinRaw(). The header isn't used anywhere in
      tools/virsh-domain.c.
      
      This patch adds the header to the header declaring vshMakeStdinRaw() and
      removes other places in virsh.
      989a427d
    • J
      virsh: allow metadata preallocation when creating volumes · 790dfee5
      Ján Tomko 提交于
      Add --prealloc-metadata flag to these commands:
      vol-clone
      vol-create
      vol-create-as
      vol-create-from
      790dfee5
    • J
      storage: allow metadata preallocation when creating qcow2 images · 1c9a2fb1
      Ján Tomko 提交于
      Add VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA flag to virStorageVolCreateXML
      and virStorageVolCreateXMLFrom. This flag requests metadata
      preallocation when creating/cloning qcow2 images, resulting in creating
      a sparse file with qcow2 metadata. It has only slightly larger disk usage
      compared to new image with no allocation, but offers higher performance.
      1c9a2fb1
    • O
      qemu: Allow the user to specify vendor and product for disk · b718ded3
      Osier Yang 提交于
      QEMU supports setting vendor and product strings for disk since
      1.2.0 (only scsi-disk, scsi-hd, scsi-cd support it), this patch
      exposes it with new XML elements <vendor> and <product> of disk
      device.
      b718ded3
    • J
      Convert libxl driver to Xen 4.2 · dfa1e1dd
      Jim Fehlig 提交于
      Based on a patch originally authored by Daniel De Graaf
      
        http://lists.xen.org/archives/html/xen-devel/2012-05/msg00565.html
      
      This patch converts the Xen libxl driver to support only Xen >= 4.2.
      Support for Xen 4.1 libxl is dropped since that version of libxl is
      designated 'technology preview' only and is incompatible with Xen 4.2
      libxl.  Additionally, the default toolstack in Xen 4.1 is still xend,
      for which libvirt has a stable, functional driver.
      dfa1e1dd
    • G
      Inhibit daemon shutdown during driver initialization · 6856b937
      Guido Günther 提交于
      As of 1a50ba2c qemu capabilities probing
      takes longer since we timeout waiting for the monitor socket. When
      probing qemu for different architectures this can add up so the daemon
      auto shutdown timeout is reached and the client doesn't have a chance
      to connect. To avoid that inhibit daemon shutdown during driver
      initialization (which includes capabilities probing).
      
      This fixes
      
      	http://honk.sigxcpu.org:8001/job/libvirt-tck-debian-wheezy-qemu-session/227/
      6856b937
    • C
      util: Don't fail virGetGroupIDByName when group not found · a33f4eae
      Christophe Fergeau 提交于
      virGetGroupIDByName is documented as returning 1 if the groupname
      cannot be found. getgrnam_r is documented as returning:
      « 0 or ENOENT or ESRCH or EBADF or EPERM or ...  The given name
      or gid was not found. »
       and that:
      « The formulation given above under "RETURN VALUE" is from POSIX.1-2001.
      It  does  not  call  "not  found"  an error, hence does not specify what
      value errno might have in this situation.  But that makes it impossible to
      recognize errors.  One might argue that according to POSIX errno should be
      left unchanged if an entry is not found.  Experiments on various UNIX-like
      systems shows that lots of different values occur in this situation: 0,
      ENOENT, EBADF, ESRCH, EWOULDBLOCK, EPERM and probably others. »
      
      virGetGroupIDByName returns an error when the return value of getgrnam_r
      is non-0. However on my RHEL system, getgrnam_r returns ENOENT when the
      requested user cannot be found, which then causes virGetGroupID not
      to behave as documented (it returns an error instead of falling back
      to parsing the passed-in value as an gid).
      
      This commit makes virGetGroupIDByName only report an error when errno
      is set to one of the values in the posix description of getgrnam_r
      (which are the same as the ones described in the manpage on my system).
      a33f4eae
    • C
      util: Don't fail virGetUserIDByName when user not found · 6c6c03dc
      Christophe Fergeau 提交于
      virGetUserIDByName is documented as returning 1 if the username
      cannot be found. getpwnam_r is documented as returning:
      « 0 or ENOENT or ESRCH or EBADF or EPERM or ...  The given name
      or uid was not found. »
       and that:
      « The formulation given above under "RETURN VALUE" is from POSIX.1-2001.
      It  does  not  call  "not  found"  an error, hence does not specify what
      value errno might have in this situation.  But that makes it impossible to
      recognize errors.  One might argue that according to POSIX errno should be
      left unchanged if an entry is not found.  Experiments on various UNIX-like
      systems shows that lots of different values occur in this situation: 0,
      ENOENT, EBADF, ESRCH, EWOULDBLOCK, EPERM and probably others. »
      
      virGetUserIDByName returns an error when the return value of getpwnam_r
      is non-0. However on my RHEL system, getpwnam_r returns ENOENT when the
      requested user cannot be found, which then causes virGetUserID not
      to behave as documented (it returns an error instead of falling back
      to parsing the passed-in value as an uid).
      
      This commit makes virGetUserIDByName only report an error when errno
      is set to one of the values in the posix description of getpwnam_r
      (which are the same as the ones described in the manpage on my system).
      6c6c03dc
  5. 06 12月, 2012 6 次提交
    • M
      dnsmasq: Fix parsing of the version number · ff33f807
      Michal Privoznik 提交于
      If debugging is enabled, the debug messages are sent to stderr.
      Moreover, if a command has catching of stderr set, the messages
      gets mixed with stdout output (assuming both outputs are stored
      in the same variable). The resulting string then doesn't
      necessarily have to start with desired prefix then. This bug
      exposes itself when parsing dnsmasq output:
      
      2012-12-06 11:18:11.445+0000: 18491: error :
      dnsmasqCapsSetFromBuffer:664 : internal error cannot parse
      /usr/sbin/dnsmasq version number in '2012-12-06
      11:11:02.232+0000: 18492: debug : virFileClose:72 : Closed fd 22'
      
      We can clearly see that the output of dnsmasq --version doesn't
      start with expected "Dnsmasq version " string but a libvirt debug
      output.
      ff33f807
    • M
      dnsmasq: Fix parsing of the version number · 51144313
      Michal Privoznik 提交于
      If the debugging is enabled, the virCommand subsystem catches debug
      messages in the command output as well. In that case, we can't assume
      the string corresponding to command's stdout will start with specific
      prefix. But the prefix can be moved deeper in the string. This bug
      shows itself when parsing dnsmasq output:
      
      2012-12-06 11:18:11.445+0000: 18491: error :
      dnsmasqCapsSetFromBuffer:664 : internal error cannot parse
      /usr/sbin/dnsmasq version number in '2012-12-06 11:11:02.232+0000:
      18492: debug : virFileClose:72 : Closed fd 22'
      
      We can clearly see that the output of dnsmasq --version
      doesn't start with expected "Dnsmasq version " string but a libvirt
      debug output.
      51144313
    • L
      network: prevent a few invalid configuration combinations · fd54f1de
      Laine Stump 提交于
      This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=767057
      
      It was possible to define a network with <forward mode='bridge'> that
      had both a bridge device and a forward device defined. These two are
      mutually exclusive by definition (if you are using a bridge device,
      then this is a host bridge, and if you have a forward dev defined,
      this is using macvtap). It was also possible to put <ip>, <dns>, and
      <domain> elements in this definition, although those aren't supported
      by the current driver (although it's conceivable that some other
      driver might support that).
      
      The items that are invalid by definition, are now checked in the XML
      parser (since they will definitely *always* be wrong), and the others
      are checked in networkValidate() in the network driver (since, as
      mentioned, it's possible that some other network driver, or even this
      one, could some day support setting those).
      fd54f1de
    • G
      network: allow guest to guest IPv6 without gateway definition · 705e67d4
      Gene Czarcinski 提交于
      This patch adds the capability for virtual guests to do IPv6
      communication via a virtual network interface with no IPv6 (gateway)
      addresses specified.  This capability has always been enabled by
      default for IPv4, but disabled for IPv6 for security concerns, and
      because it requires the ip6tables command to be operational (which
      isn't the case on a system with the ipv6 module completely disabled).
      
      This patch adds a new attribute "ipv6" at the toplevel of a <network>
      object.  If ipv6='yes', the extra ip6tables rules required to permite
      inter-guest communications are added when the network is started. If
      it is 'no', or not present, those rules will not be added; thus the
      default behavior doesn't change, so there should be no compatibility
      issues with any existing installations.
      
      Note that virtual guests cannot communication with the virtualization
      host via this interface, because the following kernel tunable has
      been set:
      
         net.ipv6.conf.<bridge_interface_name>.disable_ipv6 = 1
      
      This assures that the bridge interface will not have an IPv6
      link-local (fe80::) address.
      
      To control this behavior so that it is not enabled by default, the parameter
      ipv6='yes' on the <network> statement has been added.
      
      Documentation related to this patch has been updated.
      The network schema has also been updated.
      705e67d4
    • O
      storage: Error out earlier if the volume target path already exists · d1f3d149
      Osier Yang 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=832302
      
      It's odd to fall through to buildVol, and the existed file is
      removed when buildVol fails. This checks if the volume target
      path already exists in createVol. The reason for not using
      error like "Volume already exists" is that there isn't volume
      maintained by libvirt for the path until a operation like
      pool-refresh, using error like that will just cause confusion.
      d1f3d149
    • D
      remote: Avoid the thread race condition · b362938e
      Daniel P. Berrange 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=866524
      
      Since the virConnect object is not locked wholely when doing
      virConenctDispose, a thread can get the lock and thus might
      cause the race.
      
      Detected by valgrind:
      
      ==23687== Invalid read of size 4
      ==23687==    at 0x38BAA091EC: pthread_mutex_lock (pthread_mutex_lock.c:61)
      ==23687==    by 0x3FBA919E36: remoteClientCloseFunc (remote_driver.c:337)
      ==23687==    by 0x3FBA936BF2: virNetClientCloseLocked (virnetclient.c:688)
      ==23687==    by 0x3FBA9390D8: virNetClientIncomingEvent (virnetclient.c:1859)
      ==23687==    by 0x3FBA851AAE: virEventPollRunOnce (event_poll.c:485)
      ==23687==    by 0x3FBA850846: virEventRunDefaultImpl (event.c:247)
      ==23687==    by 0x40CD61: vshEventLoop (virsh.c:2128)
      ==23687==    by 0x3FBA8626F8: virThreadHelper (threads-pthread.c:161)
      ==23687==    by 0x38BAA077F0: start_thread (pthread_create.c:301)
      ==23687==    by 0x33F68E570C: clone (clone.S:115)
      ==23687==  Address 0x4ca94e0 is 144 bytes inside a block of size 312 free'd
      ==23687==    at 0x4A0595D: free (vg_replace_malloc.c:366)
      ==23687==    by 0x3FBA8588B8: virFree (memory.c:309)
      ==23687==    by 0x3FBA86AAFC: virObjectUnref (virobject.c:145)
      ==23687==    by 0x3FBA8EA767: virConnectClose (libvirt.c:1458)
      ==23687==    by 0x40C8B8: vshDeinit (virsh.c:2584)
      ==23687==    by 0x41071E: main (virsh.c:3022)
      
      The above race is caused by the eventLoop thread tries to handle
      the net client event by calling the callback set by:
          virNetClientSetCloseCallback(priv->client,
                                       remoteClientCloseFunc,
                                       conn, NULL);
      
      I.E. remoteClientCloseFunc, which lock/unlock the virConnect object.
      
      This patch is to fix the bug by setting the callback to NULL when
      doRemoteClose.
      b362938e
  6. 05 12月, 2012 15 次提交
    • P
      pci: Fix building of 32bit PCI command array · 35aa14fc
      Peter Krempa 提交于
      The pciWrite32 function assembled the array of data to be written to the
      fd with a bad offset on the last byte. This issue was probably caused by
      a typo (14, 24).
      35aa14fc
    • J
      util: Do not keep PCI device config file open · ad65d1e5
      Jiri Denemark 提交于
      Directly open and close PCI config file in the APIs that need it rather
      than keeping the file open for the whole life of PCI device structure.
      ad65d1e5
    • J
      qemu: Fix memory (and FD) leak on PCI device detach · 69103187
      Jiri Denemark 提交于
      Unmanaged PCI devices were only leaked if pciDeviceListAdd failed but
      managed devices were always leaked. And leaking PCI device is likely to
      leave PCI config file descriptor open. This patch fixes
      qemuReattachPciDevice to either free the PCI device or add it to the
      inactivePciHostdevs list.
      69103187
    • J
      util: Slightly refactor PCI list functions · 5eb8a7ac
      Jiri Denemark 提交于
      In order to be able to steal PCI device by its index in the list.
      5eb8a7ac
    • J
      qemu: Don't free PCI device if adding it to activePciHostdevs fails · ea1a9b5f
      Jiri Denemark 提交于
      The device is still referenced from pcidevs and freeing it would leave
      an invalid pointer there.
      ea1a9b5f
    • J
      qemu: Fix error code when attaching existing device · 935550c6
      Jiri Denemark 提交于
      An attempt to attach device that is already attached to a domain results
      in the following error:
      
      virsh # attach-device rhel6 pci2 --persistent
      error: Failed to attach device from pci2
      error: invalid argument: device is already in the domain configuration
      
      The "invalid argument" error code looks wrong, we usually use "operation
      invalid" when the action cannot be done in current state.
      935550c6
    • E
      spec: require dbus-daemon when using libvirtd in Fedora · 2edbd3d9
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=830201
      
      In older Fedora, the spec file for libivrt depended on avahi, which
      included avahi-daemon, which in turn depended on dbus.  But now that
      avahi libs and avahi-daemon are (correctly) in separate pacakges,
      and since we REALLY don't want a mandatory dependency on avahi-daemon,
      and considering that our init scripts require the messagebus service
      from dbus, we need to explicitly require dbus ourselves.
      
      * libvirt.spec.in (Requires): Add dbus for libvirt-daemon.
      2edbd3d9
    • E
      systemd: require dbus service · c748037f
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=830201
      
      The initscript and upstart services depend on dbus starting
      before libvirtd.  When we first wrote the systemd script, we
      tried to do the same, but we depended on dbus.target (which
      does not exist) in comparison to network.target (which does
      exist), so we removed that in commit 4c7973e1.  But we still
      need dbus up and running first, especially now that we want
      to support shutdown inhibition via dbus (whereas we originally
      needed dbus only for firewall control).
      
      http://www.freedesktop.org/software/systemd/man/systemd.target.html
      explains how a target (such as network.target) is just a collection
      of common services bundled together, and why we want network.target
      but dbus.service.
      
      * daemon/libvirtd.service.in (Unit): Depend on dbus starting
      first.
      c748037f
    • O
      qemu: Simplify the code · 9ee809d6
      Osier Yang 提交于
      "disk" is initialized to "dev->data.disk" in the beginning of the
      function.
      9ee809d6
    • O
      storage: Remove the redundant white lines · 8f218fbd
      Osier Yang 提交于
      Pushed under trivial rule.
      8f218fbd
    • E
      qemu: improve error for failed JSON commands · 149fa591
      Eric Blake 提交于
      Only one error in qemu_monitor was already using the relatively
      new OPERATION_UNSUPPORTED error, even though it is a better fit
      for all of the messages related to options that are unsupported
      due to the version of qemu in use rather than due to a user's
      XML or .conf file choice.  Suggested by Osier Yang.
      
      * src/qemu/qemu_monitor.c (qemuMonitorSendFileHandle)
      (qemuMonitorAddHostNetwork, qemuMonitorRemoveHostNetwork)
      (qemuMonitorAttachDrive, qemuMonitorDiskSnapshot)
      (qemuMonitorDriveMirror, qemuMonitorTransaction)
      (qemuMonitorBlockCommit, qemuMonitorDrivePivot)
      (qemuMonitorBlockJob, qemuMonitorSystemWakeup)
      (qemuMonitorGetVersion, qemuMonitorGetMachines)
      (qemuMonitorGetCPUDefinitions, qemuMonitorGetCommands)
      (qemuMonitorGetEvents, qemuMonitorGetKVMState)
      (qemuMonitorGetObjectTypes, qemuMonitorGetObjectProps)
      (qemuMonitorGetTargetArch): Use better error category.
      149fa591
    • E
      qemu: nicer error message if live disk snapshot unsupported · 3bef4adf
      Eric Blake 提交于
      Without this patch, attempts to create a disk snapshot when qemu
      is too old results in a cryptic message:
      
      virsh # snapshot-create 23 --disk-only
      error: operation failed: Failed to take snapshot: unknown command: 'snapshot_blkdev'
      
      Now it reports:
      
      virsh # snapshot-create 23 --disk-only
      error: unsupported configuration: live disk snapshot not supported with this QEMU binary
      
      All versions of qemu that support live disk snapshot also support
      QMP (basically upstream qemu 1.1 and later, and backports to RHEL 6.2).
      
      * src/qemu/qemu_capabilities.h (QEMU_CAPS_DISK_SNAPSHOT): New
      capability.
      * src/qemu/qemu_capabilities.c (qemuCaps): Track it.
      (qemuCapsProbeQMPCommands): Set it.
      * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateDiskActive): Use
      it.
      * src/qemu/qemu_monitor.c (qemuMonitorDiskSnapshot): Simplify.
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONDiskSnapshot):
      Likewise.
      * src/qemu/qemu_monitor_text.h (qemuMonitorTextDiskSnapshot):
      Delete.
      * src/qemu/qemu_monitor_text.c (qemuMonitorTextDiskSnapshot):
      Likewise.
      3bef4adf
    • E
      rpc: fix build failure with older dbus · 2215befc
      Eric Blake 提交于
      RHEL 6.3 uses dbus-devel-1.2.24, which lacked support for the
      DBUS_TYPE_UNIX_FD define (contrast with Fedora 18 using 1.6.8).
      But since it is an older dbus, it also lacks support for shutdown
      inhibitions as provided by newer systemd.
      
      Compilation failure introduced in commit 31330926.
      
      * src/rpc/virnetserver.c (virNetServerAddShutdownInhibition):
      Compile out if dbus is too old.
      2215befc
    • J
      Fix memory leak introduced by commit 501bfad1 · cab0cfd5
      Jim Fehlig 提交于
      501bfad1 missed freeing priv->saveDir when opening the Xen unified
      driver failed.
      cab0cfd5
    • B
      implement managedsave in libvirt xen legacy driver · 501bfad1
      Bamvor Jian Zhang 提交于
      Implement the domainManagedSave, domainHasManagedSaveImage, and
      domainManagedSaveRemove functions in the libvirt legacy xen driver.
      
      domainHasManagedSaveImage check the managedsave image from filesystem
      everytime. This is different from qemu and libxl driver. In qemu or
      libxl driver, there is a hasManagesSave flag in virDomainObjPtr which
      is not used in xen legacy driver. This flag could not add into xen
      driver ptr either, because the driver ptr will be released at the end of
      every libvirt api call. Meanwhile, AFAIK, xen store all the flags in
      xen not in libvirt xen driver. There is no need to add this flag in xen.
      Signed-off-by: NBamvor Jian Zhang <bjzhang@suse.com>
      501bfad1
  7. 04 12月, 2012 3 次提交