1. 08 10月, 2014 4 次提交
    • M
      security_selinux: Don't relabel /dev/net/tun · ebc05263
      Michal Privoznik 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1147057
      
      The code for relabelling the TAP FD is there due to a race. When
      libvirt creates a /dev/tapN device it's labeled as
      'system_u:object_r:device_t:s0' by default. Later, when
      udev/systemd reacts to this device, it's relabelled to the
      expected label 'system_u:object_r:tun_tap_device_t:s0'. Hence, we
      have a code that relabels the device, to cut the race down. For
      more info see ae368ebf.
      
      But the problem is, the relabel function is called on all TUN/TAP
      devices. Yes, on /dev/net/tun too. This is however a special kind
      of device - other processes uses it too. We shouldn't touch it's
      label then.
      
      Ideally, there would an API in SELinux that would label just the
      passed FD and not the underlying path. That way, we wouldn't need
      to care as we would be not labeling /dev/net/tun but the FD
      passed to the domain. Unfortunately, there's no such API so we
      have to workaround until then.
      Tested-by: NRichard W.M. Jones <rjones@redhat.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      ebc05263
    • J
      Fix build with older libcurl · eb396051
      Ján Tomko 提交于
      Add ATTRIBUTE_UNUSED marker to the unused timeout_ms option
      in esxVI_MultiCURL_TimerCallback.
      
      Introduced by commit 125007d3.
      eb396051
    • M
      esx: Implement virDomainScreenshot using libcurl stream driver · a0f19e2f
      Matthias Bolte 提交于
      This implementation uses the https://esx-server/screen?id=<id> way to get
      a screenshot of a running domain. Compared to the CreateScreenshot_Task
      way this works since ESX 2.5 while CreateScreenshot_Task was added in
      version 4.0.
      
      The newly added libcurl stream driver is used to directly provide the
      downloaded data without saving it to a temporary file first.
      a0f19e2f
    • M
      esx: Add libcurl based stream driver · 125007d3
      Matthias Bolte 提交于
      This allows to implement libvirt functions that use streams, such as
      virDoaminScreenshot, without the need to store the downloaded data in
      a temporary file first. The stream driver directly interacts with
      libcurl to send and receive data.
      
      The driver uses the libcurl multi interface that allows to do a transfer
      in multiple curl_multi_perform() calls. The easy interface would do the
      whole transfer in a single curl_easy_perform() call. This doesn't work
      with the libvirt stream API that is driven by multiple calls to the
      virStreamSend() and virStreamRecv() functions.
      
      The curl_multi_wait() function is used to do blocking operations. But it
      was added in libcurl 7.28.0. For older versions it is emulated using the
      socket callback of the multi interface.
      
      The current driver only supports blocking operations. There is already
      some code in place for non-blocking mode but it is not complete.
      125007d3
  2. 07 10月, 2014 5 次提交
    • L
      qemu: change macvtap device MAC address in response to NIC_RX_FILTER_CHANGED · db6b738d
      Laine Stump 提交于
      This patch fills in the functionality of
      processNicRxFilterChangedEvent().  It now checks if it is appropriate
      to respond to the NIC_RX_FILTER_CHANGED event (based on device type
      and configuration) and takes appropriate action. Currently it checks
      if the guest interface has been configured with
      trustGuestRxFilters='yes', and if the host side device is macvtap. If
      so, and the MAC address on the guest has changed, the MAC address of
      the macvtap device is changed to match.
      
      The result of this is that networking from the guest will continue to
      work if the mac address of a macvtap-connected network device is
      changed from within the guest, as long as trustGuestRxFilters='yes'
      (previously changing the MAC address in the guest would break
      networking).
      db6b738d
    • L
      qemu: setup infrastructure to handle NIC_RX_FILTER_CHANGED event · b6bdda45
      Laine Stump 提交于
      NIC_RX_FILTER_CHANGED is sent by qemu any time a NIC driver in the
      guest modified the NIC's RX Filter (for example, if the MAC address of
      the NIC is changed by the guest).
      
      This patch doesn't do anything useful with that event; it just sets up
      all the plumbing to get news of the event into a worker thread with
      all proper locking/reference counting, and provide an easy place to
      add in desired functionality.
      
      See src/qemu/EVENTHANDLERS.txt for information/instructions on adding
      a libvirt-internal handler for a qemu event (using
      NIC_RX_FILTER_CHANGED as an example).
      b6bdda45
    • L
      qemu: add short document on qemu event handlers · ac4f8be4
      Laine Stump 提交于
      This text was in the commit log for the patch that added the event
      handler for NIC_RX_FILTER_CHANGED, and John Ferlan expressed a desire
      that the information not be "lost", so I've put it into a file in the
      qemu directory, hoping that it might catch the attention of future
      writers of handlers for qemu events.
      ac4f8be4
    • L
      qemu: qemuMonitorQueryRxFilter - retrieve guest netdev rx-filter · ab989962
      Laine Stump 提交于
      This function can be called at any time to get the current status of a
      guest's network device rx-filter. In particular it is useful to call
      after libvirt recieves a NIC_RX_FILTER_CHANGED event - this event only
      tells you that something has changed in the rx-filter, the details are
      retrieved with the query-rx-filter monitor command (only available in
      the json monitor). The command sent to the qemu monitor looks like this:
      
        {"execute":"query-rx-filter", "arguments": {"name":"net2"} }'
      
      and the results will look something like this:
      
      {
          "return": [
              {
                  "promiscuous": false,
                  "name": "net2",
                  "main-mac": "52:54:00:98:2d:e3",
                  "unicast": "normal",
                  "vlan": "normal",
                  "vlan-table": [
                      42,
                      0
                  ],
                  "unicast-table": [
      
                  ],
                  "multicast": "normal",
                  "multicast-overflow": false,
                  "unicast-overflow": false,
                  "multicast-table": [
                      "33:33:ff:98:2d:e3",
                      "01:80:c2:00:00:21",
                      "01:00:5e:00:00:fb",
                      "33:33:ff:98:2d:e2",
                      "01:00:5e:00:00:01",
                      "33:33:00:00:00:01"
                  ],
                  "broadcast-allowed": false
              }
          ],
          "id": "libvirt-14"
      }
      
      This is all parsed from JSON into a virNetDevRxFilter object for
      easier consumption. (unicast-table is usually empty, but is also an
      array of mac addresses similar to multicast-table).
      
      (NB: LIBNL_CFLAGS was added to tests/Makefile.am because virnetdev.h
      now includes util/virnetlink.h, which includes netlink/msg.h when
      appropriate. Without LIBNL_CFLAGS, gcc can't find that file (if
      libnl/netlink isn't available, LIBNL_CFLAGS will be empty and
      virnetlink.h won't try to include netlink/msg.h anyway).)
      ab989962
    • L
      util: define virNetDevRxFilter and basic utility functions · aa7c595a
      Laine Stump 提交于
      This same structure will be used to retrieve RX filter info for
      interfaces on the host via netlink messages, and RX filter info for
      interfaces on the guest via the qemu "query-rx-filter" command.
      aa7c595a
  3. 06 10月, 2014 8 次提交
    • L
      network: set interface actual trustGuestRxFilters from network/portgroup · cfddf59c
      Laine Stump 提交于
      As is done with other items such as vlan, virtualport, and bandwidth,
      set the actual trustGuestRxFilters value to be used by a domain
      interface according to a merge of the same attribute in the interface,
      portgroup, and network in use. the interface setting always takes
      precedence (if specified), followed by portgroup, and finally the
      setting in the network is used if it's not specified in the interface
      or portgroup.
      cfddf59c
    • L
      conf: add trustGuestRxFilters attribute to network and domain interface · 07450cd4
      Laine Stump 提交于
      This new attribute will control whether or not libvirt will pay
      attention to guest notifications about changes to network device mac
      addresses and receive filters. The default for this is 'no' (for
      security reasons). If it is set to 'yes' *and* the specified device
      model and connection support it (currently only macvtap+virtio) then
      libvirt will watch for NIC_RX_FILTER_CHANGED events, and when it
      receives one, it will issue a query-rx-filter command, retrieve the
      result, and modify the host-side macvtap interface's mac address and
      unicast/multicast filters accordingly.
      
      The functionality behind this attribute will be in a later patch. This
      patch merely adds the attribute to the top-level of a domain's
      <interface> as well as to <network> and <portgroup>, and adds
      documentation and schema/xml2xml tests. Rather than adding even more
      test files, I've just added the net attribute in various applicable
      places of existing test files.
      07450cd4
    • J
      qemu: Remove possible NULL deref in debug output · b7890a8c
      John Ferlan 提交于
      Check for !dev->info.alias was done after a VIR_DEBUG() statement
      that already tried to print - just flip sequence
      b7890a8c
    • J
      qemu: Remove need for virConnectPtr in hotunplug detach host, net · 99186c41
      John Ferlan 提交于
      Prior patch removed the need for the virConnectPtr in the unplug
      detach host path which caused ripple effect to remove in multiple
      callers.  The previous patch just left things as ATTRIBUTE_UNUSED -
      this patch will remove the variable.
      99186c41
    • J
      qemu: Fix hot unplug of SCSI_HOST device · d2774e54
      John Ferlan 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1141732
      
      Introduced by commit id '8f76ad99' the logic to detach a scsi_host
      device (SCSI or iSCSI) fails when attempting to remove the 'drive'
      because as I found in my investigation - the DelDevice takes care of
      that for us.
      
      The investigation turned up commits to adjust the logic for the
      qemuMonitorDelDevice and qemuMonitorDriveDel processing for interfaces
      (commit id '81f76598'), disk bus=VIRTIO,SCSI,USB (commit id '0635785b'),
      and chr devices (commit id '55b21f9b'), but nothing with the host devices.
      
      This commit uses the model for the previous set of changes and applies
      it to the hostdev path. The call to qemuDomainDetachHostSCSIDevice will
      return to qemuDomainDetachThisHostDevice handling either the audit of
      the failure or the wait for the removal and then call into
      qemuDomainRemoveHostDevice for the event, removal from the domain hostdev
      list, and audit of the removal similar to other paths.
      
      NOTE: For now the 'conn' param to +qemuDomainDetachHostSCSIDevice is left
      as ATTRIBUTE_UNUSED.  Removing requires a cascade of other changes to be
      left for a future patch.
      d2774e54
    • E
      maint: update .mailmap · 9d31c048
      Eric Blake 提交于
      Consolidate several commits made by James:
      https://www.redhat.com/archives/libvir-list/2014-September/msg01156.htmlSigned-off-by: NEric Blake <eblake@redhat.com>
      9d31c048
    • J
      Include .libs in libdir in source tree pkg-config files · 16ca3226
      Ján Tomko 提交于
      This lets me build against an uninstalled source tree without
      libtool.
      16ca3226
    • C
      docs: fix a typo in drvlxc · 906eefb2
      Chen Hanxiao 提交于
      s/the/The
      Signed-off-by: NChen Hanxiao <chenhanxiao@cn.fujitsu.com>
      906eefb2
  4. 04 10月, 2014 7 次提交
    • M
      minor shmem clean-ups · 34f51477
      Martin Kletzander 提交于
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      34f51477
    • M
      util: Prepare URI formatting for libxml2 >= 2.9.2 · 8f17d0ea
      Martin Kletzander 提交于
      Since commit 8eb55d782a2b9afacc7938694891cc6fad7b42a5 libxml2 removes
      two slashes from the URI when there is no server part.  This is fixed
      with beb7281055dbf0ed4d041022a67c6c5cfd126f25, but only if the calling
      application calls xmlSaveUri() on URI that xmlURIParse() parsed.  And
      that is not the case in virURIFormat().  virURIFormat() accepts
      virURIPtr that can be created without parsing it and we do that when we
      format network storage paths for gluster for example.  Even though
      virStorageSourceParseBackingURI() uses virURIParse(), it throws that data
      structure right away.
      
      Since we want to format URIs as URIs and not absolute URIs or opaque
      URIs (see RFC 3986), we can specify that with a special hack thanks to
      commit beb7281055dbf0ed4d041022a67c6c5cfd126f25, by setting port to -1.
      
      This fixes qemuxml2argvtest test where the disk-drive-network-gluster
      case was failing.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      8f17d0ea
    • M
      vbox: remove unused code that causes build failures · 0186885d
      Martin Kletzander 提交于
      Since 87dea4fc vboxGetDrivers() is not
      used for getting the vbox network driver.  The only call the code does
      is using NULL as the @networkDriver_ret param , but the code still used
      vbox[0-9][0-9]NetworkDriver that didn't exist anymore.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      0186885d
    • M
      qemu: Build command line for ivshmem device · b90a9a63
      Martin Kletzander 提交于
      This patch implements support for the ivshmem device in QEMU.
      Signed-off-by: NMaxime Leroy <maxime.leroy@6wind.com>
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      b90a9a63
    • M
      qemu: add capability probing for ivshmem device · e3d478eb
      Maxime Leroy 提交于
      Ivshmem is supported by QEMU since 0.13 release.
      Signed-off-by: NMaxime Leroy <maxime.leroy@6wind.com>
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      e3d478eb
    • M
      docs, conf, schema: add support for shmem device · 540a84ec
      Martin Kletzander 提交于
      This patch adds parsing/formatting code as well as documentation for
      shared memory devices.  This will currently be only accessible in QEMU
      using it's ivshmem device, but is designed as generic as possible to
      allow future expansion for other hypervisors.
      
      In the devices section in the domain XML users may specify:
      
      - For shmem device using a server:
      
       <shmem name='shmem0'>
         <server path='/tmp/socket-ivshmem0'/>
         <size unit='M'>32</size>
         <msi vectors='32' ioeventfd='on'/>
       </shmem>
      
      - For ivshmem device not using an ivshmem server:
      
       <shmem name='shmem1'>
         <size unit='M'>32</size>
       </shmem>
      
      Most of the configuration is made optional so it also allows
      specifications like:
      
       <shmem name='shmem1/>
       <shmem name='shmem2'>
         <server/>
       </shmem>
      Signed-off-by: NMaxime Leroy <maxime.leroy@6wind.com>
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      540a84ec
    • E
      qemu: support nospace reason in io error event · e9392e48
      Eric Blake 提交于
      Aeons ago (commit 34dcbbb4, v0.8.2), we added a new libvirt event
      (VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON) in order to tell the user WHY
      the guest halted.  This is because at least VDSM wants to react
      differently to ENOSPC events (resize the lvm partition to be larger,
      and resume the guest as if nothing had happened) from all other events
      (I/O is hosed, throw up our hands and flag things as broken).  At the
      time this was done, downstream RHEL qemu added a vendor extension
      '__com.redhat_reason', which would be exactly one of these strings:
      "enospc", "eperm", "eio", and "eother".  In our stupidity, we exposed
      those exact strings to clients, rather than an enum, and we also
      return "" if we did not have access to a reason (which was the case
      for upstream qemu).
      
      Fast forward to now: upstream qemu commit c7c2ff0c (will be qemu 2.2)
      FINALLY adds a 'nospace' boolean, after discussion with multiple
      projects determined that VDSM really doesn't care about distinction
      between any other error types.  So this patch converts 'nospace' into
      the string "enospc" for compatibility with RHEL clients that were
      already used to the downstream extension, while leaving the reason
      blank for all other cases (no change from the status quo).
      
      See also https://bugzilla.redhat.com/show_bug.cgi?id=1119784
      
      * src/qemu/qemu_monitor_json.c (qewmuMonitorJSONHandleIOError):
      Parse reason field from modern qemu.
      * include/libvirt/libvirt.h.in
      (virConnectDomainEventIOErrorReasonCallback): Document it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e9392e48
  5. 03 10月, 2014 16 次提交