1. 29 10月, 2014 35 次提交
    • J
      storage_conf: Resolve libvirtd crash matching scsi_host · 3f99d64d
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1146837
      
      Resolve a crash in libvirtd resulting from commit id 'a4bd62ad' (1.0.6)
      which added parentaddr and unique_id to allow unique identification of
      a scsi_host, but assumed that all the pool entries and the incoming
      definition would be similarly defined. If the existing pool uses the
      'name' attribute and an incoming pool is using the parentaddr/unique_id,
      then the code will attempt to compare the existing name string against
      the incoming name string which doesn't exist (is NULL) and results in
      a core (STREQ).
      
      Conversely, if the existing pool used the parentaddr/unique_id and the
      to be defined pool used the name, then the comparison would be against
      the parentaddr, but since the incoming pool doesn't have one - that would
      leave the comparison against a parentaddr of all 0's and a unique_id of 0,
      which will always comparison to fail. This means someone could define the
      same source adapter for two pools
      
      In order to resolve this, adjust the code to get the 'host#' to be used
      by the storage scsi backend in order to check/start the pool and make sure
      the incoming definition doesn't match any of the existing pool defs.
      3f99d64d
    • J
      virutil: Introduce virGetSCSIHostNameByParentaddr · beff5d4e
      John Ferlan 提交于
      Create the function from the code in getAdapterName() in order to return
      the "host#" name for the provided parentaddr values.
      beff5d4e
    • J
      virutil: Introduce virGetSCSIHostNumber · 55f43959
      John Ferlan 提交于
      Create/use virGetSCSIHostNumber to replace the static getHostNumber
      
      Removed the "if (result &&" since result is now required to be non NULL
      on input.
      55f43959
    • J
      qemu-attach: Assign device aliases · e3a52afc
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1141621
      
      As part of attach processing, assign the device aliases by calling
      qemuAssignDeviceAliases during qemuDomainQemuAttach once all the devices
      are found after the qemuParseCommandLinePid processing.
      
      This will alleviate a symptom that caused a libvirtd crash during an
      attempted device detach.
      e3a52afc
    • J
      hotplug: Check for alias in net detach · 96af61dd
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1141621
      
      If the QEMU_CAPS_DEVICE is set, then ensure the host device alias has
      been properly set before making the calls to detach the device
      96af61dd
    • J
      hotplug: Check for alias in chrdev detach · 4d8a4165
      John Ferlan 提交于
      If the QEMU_CAPS_DEVICE is set, then ensure the chr device alias has
      been properly set before making the calls to detach the device
      4d8a4165
    • J
      hotplug: Check for alias in hostdev detach · 9de26f27
      John Ferlan 提交于
      If the QEMU_CAPS_DEVICE is set, then ensure the host device alias has
      been properly set before making the calls to detach the device
      9de26f27
    • J
      hotplug: Check for alias in disk detach · 5d02a9a0
      John Ferlan 提交于
      If the QEMU_CAPS_DEVICE is set, then ensure the disk device alias has
      been properly set in prior to making the calls to detach the device.
      5d02a9a0
    • J
      hotplug: Check for alias in controller detach · 65be7572
      John Ferlan 提交于
      In qemuDomainDetachControllerDevice if the info.alias already exists
      a call to qemuAssignDeviceControllerAlias would overwrite the existing
      so avoid this possibility.
      65be7572
    • J
      virsh: Adjust the text in man page regarding qemu-attach · c4056d2b
      John Ferlan 提交于
      Slight adjustment to the qemu-attach man page to note device hotplug
      and hot unplug may not work and that the environment should be considered
      read-only
      c4056d2b
    • J
      remote: fix jump depends on uninitialised value · 28b7601d
      Jincheng Miao 提交于
      Currently remote driver only initializes partial fields of
      remote_connect_get_all_domain_stats_args. But xdr_array()
      will check the uninitialised field 'doms_val'.
      For safty reason, memset all fields of args is better.
      
      Fix the following error from valgrind, like:
      ==30515== 1 errors in context 1 of 3:
      ==30515== Conditional jump or move depends on uninitialised value(s)
      ==30515==    at 0x85E9402: xdr_array (xdr_array.c:88)
      ==30515==    by 0x4FD8FC9: xdr_remote_connect_get_all_domain_stats_args (remote_protocol.c:6473)
      ==30515==    by 0x4FE72F2: virNetMessageEncodePayload (virnetmessage.c:350)
      ==30515==    by 0x4FDD21C: virNetClientProgramCall (virnetclientprogram.c:326)
      ==30515==    by 0x4FB4D01: callFull.isra.2 (remote_driver.c:6667)
      ==30515==    by 0x4FCBD45: call (remote_driver.c:6689)
      ==30515==    by 0x4FCBD45: remoteConnectGetAllDomainStats (remote_driver.c:7793)
      ==30515==    by 0x4FA0E75: virConnectGetAllDomainStats (libvirt.c:21678)
      ==30515==    by 0x147FD1: cmdDomstats (virsh-domain-monitor.c:2148)
      ==30515==    by 0x13006B: vshCommandRun (virsh.c:1915)
      ==30515==    by 0x12A9E1: main (virsh.c:3699)
      Signed-off-by: NJincheng Miao <jmiao@redhat.com>
      28b7601d
    • T
      vbox: Remove unused things in vbox_tmpl.c · 2f055b00
      Taowei Luo 提交于
      After rewriting the whole driver, Only version specified code is
      remained in vbox_tmpl.c. So, this patch removes those unused macros
      header files in vbox_tmpl.c.
      2f055b00
    • T
      vbox: New storage driver · 5892944f
      Taowei Luo 提交于
      This patch provides the new stroage driver for vbox. The work
      is similar with patch 87dea4fc and the next b4022de3.
      5892944f
    • T
      vbox: Rewrite vboxStorageVolGetPath · 013aa081
      Taowei Luo 提交于
      013aa081
    • T
      vbox: Rewrite vboxStorageVolGetXMLDesc · 4df7b206
      Taowei Luo 提交于
      4df7b206
    • T
      vbox: Rewrite vboxStorageVolGetInfo · 80f35e6e
      Taowei Luo 提交于
      80f35e6e
    • T
      vbox: Rewrite vboxStorageVolDelete · 1c2c3906
      Taowei Luo 提交于
      The API on IHardDiskAttachment is merged into IMediumAttachment.
      So, we don't need it anymore.
      1c2c3906
    • T
      vbox: Make IMediumAttachment work with vbox2.2 and 3.0 · 3d33e388
      Taowei Luo 提交于
      The GetMedium will always return a IHardDisk object them.
      In 2.2 and 3.0, it is what GetHardDisk exactly do. In 3.1 and later,
      The IMedium is same as IHardDisk.
      3d33e388
    • T
      vbox: Rewrite vboxStorageVolCreateXML · 0cd409cd
      Taowei Luo 提交于
      If the <path> in target element is not given, libvirt will put the
      new volume in ~/.VirtualBox by default.
      0cd409cd
    • T
      vbox: Make CreateHardDisk support all vbox versions · 382e655d
      Taowei Luo 提交于
      The CreateHardDiskMedium only support create HardDisk for medium
      type, and it only works when vbox version >= 3.1. This patch make
      the function workable with all vbox versions and rename it as
      CreateHardDisk.
      
      In vbox 2.2 and 3.0 this function will create a IHardDisk object.
      In vbox later than 3.0, this function will create a IMedium object.
      382e655d
    • T
      vbox: Rewrite vboxStorageVolLookupByPath · fc41e003
      Taowei Luo 提交于
      fc41e003
    • T
      vbox: Make FindMedium support old vbox versions · 1599319c
      Taowei Luo 提交于
      In old version, function FindMedium in UIVirtualBox doesn't work
      for vbox2.2 and 3.0. We assume it will not be used when vbox in
      these versions.
      
      But when rewriting vboxStorageVolLookupByPath, we found it was
      compatibe to use FindMedium to get a IHardDisk object, even in
      vbox old versions. To achieve this, first make FindMedium call
      FindHardDisk when VBOX_API_VERSION < 4000000.
      Then change the argument type **IMedium to **IHardDisk. (As the
      rules in heriachy, we can't transfer a IHardDisk to match
      IMedium in output)
      
      In vbox 2.2 and 3.0, the caller must be aware that they will get
      a IHardDisk object in return.
      1599319c
    • T
      vbox: Rewrite vboxStorageVolLookupByKey · f67ae174
      Taowei Luo 提交于
      f67ae174
    • T
      vbox: Rewrite vboxStorageVolLookupByName · 8a8fa504
      Taowei Luo 提交于
      8a8fa504
    • T
      vbox: Rewrite vboxStoragePoolListVolumes · c3c8cd4f
      Taowei Luo 提交于
      c3c8cd4f
    • T
      vbox: Rewrite vboxStoragePoolNumOfVolumes · ce381d37
      Taowei Luo 提交于
      We use typedef IMedium IHardDisk to make IHardDisk hierachy from
      IMedium (Actually it did on vbox 2.2 and 3.0's C++ API).
      So when calling
          VBOX_MEDIUM_FUNC_ARG*(IHardDisk, func, args)
      we can directly replace it to
          gVBoxAPI.UIMedium.func(IHardDisk, args)
      
      When dealing with this two types, we get some rules from it's
      hierachy relationship.
      
      When using IHardDisk and IMedium as input, we can't transfer a
      IMedium to IHardDisk. Like:
          gVBoxAPI.UIHardDisk.func(IHardDisk *hardDisk, args)
          Here, we can't put a *IMedium as a argument.
      
      When using IHardDisk and IMedium as output, we can't transfer a
      IHardDisk to IMedium. Like:
          gVBoxAPI.UIMachine.GetMedium(IMedium **out)
          Here, we can't put a **IHardDisk as a argument. If this case
          do happen, we either change the API to GetHardDisk or write a
          new one.
      ce381d37
    • T
      vbox: Rewrite vbox-independent functions · 459886d4
      Taowei Luo 提交于
      This patch rewrites the following functions
          *vboxStorageOpen
          *vboxStorageClose
          *vboxConnectNumOfStoragePools
          *vboxConnectListStoragePools
          *vboxStoragePoolLookupByName
      
      These functions do not call any vbox API, so I directly move it
      from vbox_tmpl.c to vbox_storage.c
      
      A small improvement is made on vboxConnectListStoragePools.
      The if condition nnames == 1 is modified to nnames > 0. So if the
      caller put more than one slot to get active storage pools, the new
      function will return exactly one, while the old one would only
      return 0.
      459886d4
    • T
      vbox: move common codes to vbox_common.h · 7d5b9419
      Taowei Luo 提交于
      There are lots of macro declarations in vbox_common.c,
      vbox_network.c, and the coming vbox_storage.c which simply the API
      calling. Since they are totally the same. We shouldn't keep three
      copies of that, so they are moved to vbox_common.h.
      
      Note: The macros are quite different from those in vbox_tmpl.c,
            because they are using different API.
      7d5b9419
    • T
      vbox: Remove VBOX_OBJECT_CHECK macro · a6b1cde3
      Taowei Luo 提交于
      We should follow the rules that CHECK macro only do checking works.
      But this VBOX_OBJECT_CHECK and VBOX_OBJECT_HOST_CHECK declared some
      varibles at the same time, which broke the rule. So the patch
      removed this macros and dispatched it in source code.
      
      The storage driver is still not rewriten at this point. So, I
      remains the VBOX_OBJECT_CHECK macro in vbox_tmpl.c. But this will
      finally be removed in patch 'vbox: Remove unused things in vbox_tmpl.c'
      a6b1cde3
    • T
      vbox: Fix copyright mistake · c5cc26e6
      Taowei Luo 提交于
      I made a mistake on copyright in patch 7f0f415b.
      
      If I copied codes from one file to another, I should copy the
      copyright announcement as well. So this patch makes up the
      copyright which I should have added in the previous patch.
      c5cc26e6
    • S
      virsh: Improve the job type reported of virsh cmd blockcommit · d8415b54
      Shanzhi Yu 提交于
      When starting an active block commit job in virsh, it will report
      "Block Commit started", but for more precise message it could
      report "Active Block Commit started".
      Signed-off-by: NShanzhi Yu <shyu@redhat.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      d8415b54
    • C
      Renamed internal __mon_yday into mon_yday to avoid conflicts · 90712bb5
      Cédric Bosdonnat 提交于
      libc has another constant with the same name, which leads to
      redefinition error when building against static libvirt
      90712bb5
    • M
      qemu_agent: Produce more readable error messages · b7fe5a65
      Michal Privoznik 提交于
      Not every error message from qemu-ga has to have the 'class' field
      filled out. For instance, I've seen this error message lately:
      
        qemuAgentCheckError:1047 : unable to execute QEMU agent command \
        {"execute":"guest-set-time"}: \
        {"error":{"desc":"Invalid parameter type, expected: integer"}}
      
      However, this got translated into rather generic error message:
      
        internal error: unable to execute QEMU agent command
        'guest-set-time': unknown QEMU command error
      
      So we've dropped better error message in favor of a generic one.
      This is due to our code which expects 'class' which is not
      present here.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      b7fe5a65
    • T
      qemu: change macvtap multicast list in response to NIC_RX_FILTER_CHANGED · d70cc1fa
      Tony Krowiak 提交于
      This patch adds functionality to processNicRxFilterChangedEvent().
      The old and new multicast lists are compared and the filters in
      the macvtap are programmed to match the guest's filters.
      Signed-off-by: NTony Krowiak <akrowiak@linux.vnet.ibm.com>
      d70cc1fa
    • T
      util: Functions to update host network device's multicast filter · cc0e8c24
      Tony Krowiak 提交于
      This patch provides the utility functions to needed to synchronize the
      changes made to a guest domain network device's multicast filter
      with the corresponding macvtap device's filter on the host:
      
      * Get/add/remove multicast MAC addresses
      * Get the macvtap device's RX filter list
      Signed-off-by: NTony Krowiak <akrowiak@linux.vnet.ibm.com>
      Signed-off-by: NLaine Stump <laine@laine.org>
      cc0e8c24
  2. 28 10月, 2014 1 次提交
    • E
      qemu: forbid snapshot-delete --children-only on external snapshot · 2086a990
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=956506 documents that
      given a domain where an internal snapshot parent has an external
      snapshot child, we lacked a safety check when trying to use the
      --children-only option to snapshot-delete:
      
      $ virsh start dom
      $ virsh snapshot-create-as dom internal
      $ virsh snapshot-create-as dom external --disk-only
      $ virsh snapshot-delete dom external
      error: Failed to delete snapshot external
      error: unsupported configuration: deletion of 1 external disk snapshots not supported yet
      $ virsh snapshot-delete dom internal --children
      error: Failed to delete snapshot internal
      error: unsupported configuration: deletion of 1 external disk snapshots not supported yet
      $ virsh snapshot-delete dom internal --children-only
      Domain snapshot internal children deleted
      
      While I'd still like to see patches that actually do proper external
      snapshot deletion, we should at least fix the inconsistency in the
      meantime.  With this patch:
      
      $ virsh snapshot-delete dom internal --children-only
      error: Failed to delete snapshot internal
      error: unsupported configuration: deletion of 1 external disk snapshots not supported yet
      
      * src/qemu/qemu_driver.c (qemuDomainSnapshotDelete): Fix condition.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      2086a990
  3. 27 10月, 2014 1 次提交
    • L
      util: eliminate "use after free" in callers of virNetDevLinkDump · f9f9699f
      Laine Stump 提交于
      virNetDevLinkDump() gets a message from netlink into "resp", then
      calls nlmsg_parse() to fill the table "tb" with pointers into resp. It
      then returns tb to its caller, but not before freeing the buffer at
      resp. That means that all the callers of virNetDevLinkDump() are
      examining memory that has already been freed. This can be verified by
      filling the buffer at resp with garbage prior to freeing it (or, I
      suppose, just running libvirtd under valgrind) then performing some
      operation that calls virNetDevLinkDump().
      
      The code has been like this ever since virNetDevLinkDump() was written
      - the original author didn't notice it, and neither did later
      additional users of the function. It has only been pure luck (or maybe
      a lack of heavy load, and/or maybe an allocation algorithm in malloc()
      that delays re-use of just-freed memory) that has kept this from
      causing errors, for example when configuring a PCI passthrough or
      macvtap passthrough network interface.
      
      The solution taken in this patch is the simplest - just return resp to
      the caller along with tb, then have the caller free it after they are
      finished using the data (pointers) in tb. I alternately could have
      made a cleaner interface by creating a new struct that put tb and resp
      together along with a vir*Free() function for it, but this function is
      only used in a couple places, and I'm not sure there will be
      additional new uses of virNetDevLinkDump(), so the value of adding a
      new type, extra APIs, etc. is dubious.
      f9f9699f
  4. 25 10月, 2014 3 次提交