1. 07 3月, 2012 1 次提交
  2. 06 3月, 2012 12 次提交
    • L
      conf: change virDomainNetRemove from static to global · ac9ca01c
      Laine Stump 提交于
      This exact code is duplicated in qemuDomainDetachNetDevice().
      ac9ca01c
    • L
      qemu: support type='hostdev' network devices at domain start · 8639a420
      Laine Stump 提交于
      This patch makes sure that each network device ("interface") of
      type='hostdev' appears on both the hostdevs list and the nets list of
      the virDomainDef, and it modifies the qemu driver startup code so that
      these devices will be presented to qemu on the commandline as hostdevs
      rather than as network devices.
      
      It does not add support for hotplug of these type of devices, or code
      to honor the <mac address> or <virtualport> given in the config (both
      of those will be done in separate patches).
      
      Once each device is placed on both lists, much of what this patch does
      is modify places in the code that traverse all the device lists so
      that these hybrid devices are only acted on once - either along with
      the other hostdevs, or along with the other network interfaces. (In
      many cases, only one of the lists is traversed / a specific operation
      is performed on only one type of device. In those instances, the code
      can remain unchanged.)
      
      There is one special case - when building the commandline, interfaces
      are allowed to proceed all the way through
      networkAllocateActualDevice() before deciding to skip the rest of
      netdev-specific processing - this is so that (once we have support for
      networks with pools of hostdev devices) we can get the actual device
      allocated, then rely on the loop processing all hostdevs to generate
      the correct commandline.
      
      (NB: <interface type='hostdev'> is only supported for PCI network
      devices that are SR-IOV Virtual Functions (VF). Standard PCI[e] and
      USB devices, and even the Physical Functions (PF) of SR-IOV devices
      can only be assigned to a guest using the more basic <hostdev> device
      entry. This limitation is mostly due to the fact that non-SR-IOV
      ethernet devices tend to lose mac address configuration whenever the
      card is reset, which happens when a card is assigned to a guest;
      SR-IOV VFs fortunately don't suffer the same problem.)
      8639a420
    • L
      conf: parse/format type='hostdev' network interfaces · 3b1c191f
      Laine Stump 提交于
      This is the new interface type that sets up an SR-IOV PCI network
      device to be assigned to the guest with PCI passthrough after
      initializing some network device-specific things from the config
      (e.g. MAC address, virtualport profile parameters). Here is an example
      of the syntax:
      
        <interface type='hostdev' managed='yes'>
          <source>
            <address type='pci' domain='0' bus='0' slot='4' function='3'/>
          </source>
          <mac address='00:11:22:33:44:55'/>
          <address type='pci' domain='0' bus='0' slot='7' function='0'/>
        </interface>
      
      This would assign the PCI card from bus 0 slot 4 function 3 on the
      host, to bus 0 slot 7 function 0 on the guest, but would first set the
      MAC address of the card to 00:11:22:33:44:55.
      
      NB: The parser and formatter don't care if the PCI card being
      specified is a standard single function network adapter, or a virtual
      function (VF) of an SR-IOV capable network adapter, but the upcoming
      code that implements the back end of this config will work *only* with
      SR-IOV VFs. This is because modifying the mac address of a standard
      network adapter prior to assigning it to a guest is pointless - part
      of the device reset that occurs during that process will reset the MAC
      address to the value programmed into the card's firmware.
      
      Although it's not supported by any of libvirt's hypervisor drivers,
      usb network hostdevs are also supported in the parser and formatter
      for completeness and consistency. <source> syntax is identical to that
      for plain <hostdev> devices, except that the <address> element should
      have "type='usb'" added if bus/device are specified:
      
        <interface type='hostdev'>
          <source>
            <address type='usb' bus='0' device='4'/>
          </source>
          <mac address='00:11:22:33:44:55'/>
        </interface>
      
      If the vendor/product form of usb specification is used, type='usb'
      is implied:
      
        <interface type='hostdev'>
          <source>
            <vendor id='0x0012'/>
            <product id='0x24dd'/>
          </source>
          <mac address='00:11:22:33:44:55'/>
        </interface>
      
      Again, the upcoming patch to fill in the backend of this functionality
      will log an error and fail with "Unsupported Config" if you actually
      try to assign a USB network adapter to a guest using <interface
      type='hostdev'> - just use a standard <hostdev> entry in that case
      (and also for single-port PCI adapters).
      3b1c191f
    • L
      conf: hostdev utility functions · cc5b1fe5
      Laine Stump 提交于
      Three new functions useful in other files:
      
      virDomainHostdevInsert:
      
      Add a new hostdev at the end of the array. This would more sensibly be
      called virDomainHostdevAppend, but the existing functions for other
      types of devices are called Insert.
      
      virDomainHostdevRemove:
      
      Eliminates one entry from the hostdevs array, but doesn't free it;
      patterned after the code at the end of the two
      qemuDomainDetachHostXXXDevice functions (and also other pre-existing
      virDomainXXXRemove functions for other device types).
      
      virDomainHostdevFind:
      
      This function is patterned from the search loops at the top of
      qemuDomainDetachHostPciDevice and qemuDomainDetachHostUsbDevice, and
      will be used to re-factor those (and other detach-related) functions.
      cc5b1fe5
    • L
      conf: put subsys part of virDomainHostdevDef into its own struct · 3175df88
      Laine Stump 提交于
      To shorten some new code that accesses the many fields within the
      subsys struct of a hostdev, create a separate toplevel, typedefed
      virDomainHostdevSubsys struct so that we can define temporary pointers
      to the subsys part.
      3175df88
    • L
      conf: give each hostdevdef a parent pointer · b973f920
      Laine Stump 提交于
      The parent can be any type of device. It defaults to type=none, and a
      NULL pointer. The intent is that if a hostdevdef is contained in the
      def for a higher level device (e.g. virDomainNetDef), hostdev->parent
      will point to the higher level device, and type will be set to that
      type of device. This way, during attach and detach of the device,
      parent can be checked, and appropriate callouts made to do higher
      level device initialization (e.g. setting MAC address).
      
      Also, although these hostdevs with parents will be added to a domain's
      hostdevs list, they will be treated slightly differently when
      traversing the list, e.g. virDomainHostdefDefFree for a hostdev that
      has a parent doesn't need to be called (and will be a NOP); it will
      simply be removed from the list (since the parent device object is in
      its own type-specific list, and will be freed from there).
      b973f920
    • L
      conf: HostdevDef parse/format helper functions · 5560170d
      Laine Stump 提交于
      In an upcoming patch, virDomainNetDef will acquire a
      virDomainHostdevDef, and the <interface> XML will take on some of the
      elements of a <hostdev>. To avoid duplicating the code for parsing and
      formatting the <source> element (which will be nearly identical in
      these two cases), this patch factors those parts out of the
      HostdevDef's parse and format functions, and puts them into separate
      helper functions that are now called by the HostdevDef
      parser/formatter, and will soon be called by the NetDef
      parser/formatter.
      
      One change in behavior - previously virDomainHostdevDefParseXML() had
      diverged from current common coding practice by logging an error and
      failing if it found any subelements of <hostdev> other than those it
      understood (standard libvirt practice is to ignore/discard unknown
      elements and attributes during parse). The new helper function ignores
      unknown elements, and thus so does the new
      virDomainHostdevDefParseXML.
      5560170d
    • L
      conf: make hostdev info a separate object · 29293930
      Laine Stump 提交于
      In order to allow for a virDomainHostdevDef that uses the
      virDomainDeviceInfo of a "higher level" device (such as a
      virDomainNetDef), this patch changes the virDomainDeviceInfo in the
      HostdevDef into a virDomainDeviceInfoPtr. Rather than adding checks
      all over the code to check for a null info, we just guarantee that it
      is always valid. The new function virDomainHostdevDefAlloc() allocates
      a virDomainDeviceInfo and plugs it in, and virDomainHostdevDefFree()
      makes sure it is freed.
      
      There were 4 places allocating virDomainHostdevDefs, all of them
      parsers of one sort or another, and those have all had their
      VIR_ALLOC(hostdev) changed to virDomainHostdevDefAlloc(). Other than
      that, and the new functions, all the rest of the changes are just
      mechanical removals of "&" or changing "." to "->".
      29293930
    • L
      conf: add device pointer to args of virDomainDeviceInfoIterate callback · 2f925c65
      Laine Stump 提交于
      There will be cases where the iterator callback will need to know the
      type of the device whose info is being operated on, and possibly even
      need to use some of the device's config. This patch adds a
      virDomainDeviceDefPtr to the args of every callback, and fills it in
      appropriately as the devices are iterated through.
      2f925c65
    • L
      conf: reorder static functions in domain_conf.c · fdad9c34
      Laine Stump 提交于
      No code change, movement only.  This is necessary to eliminate forward
      references.
      fdad9c34
    • L
      conf: relocate virDomainDeviceDef and virDomainHostdevDef · 4ec60dfb
      Laine Stump 提交于
      This patch is only code movement + adding some forward definitions of
      typedefs.
      
      virDomainHostdevDef (not just a pointer to it, but an actual object)
      will be needed in virDomainNetDef and virDomainActualNetDef, so it
      must be relocated earlier in the file.
      
      Likewise, virDomainDeviceDef will be needed in virDomainHostdevDef, so
      it must be moved up even earlier. This, in turn, creates a forward
      reference problem, but fortunately only with pointers to other device
      types, so their typedefs can be moved up in the file, eliminating the
      problem.
      4ec60dfb
    • L
      conf: add missing device types to virDomainDevice(Type|Def) · 9890b318
      Laine Stump 提交于
      Not all device types were represented in virDomainDeviceType, so some
      types of devices couldn't be represented in a virDomainDeviceDef
      (which requires a different type of pointer in the union for each
      different kind of device).
      
      Since serial, parallel, channel, and console devices are all
      virDomainChrDef, and the virDomainDeviceType is never used to produce
      a string from the type (and only used in the other direction
      internally to code, never to produce XML), I only added one "CHR"
      type, which is associated with "virDomainChrDefPtr chr" in the union.
      9890b318
  3. 02 3月, 2012 1 次提交
    • E
      build: use correct type for pid and similar types · 3e2c3d8f
      Eric Blake 提交于
      No thanks to 64-bit windows, with 64-bit pid_t, we have to avoid
      constructs like 'int pid'.  Our API in libvirt-qemu cannot be
      changed without breaking ABI; but then again, libvirt-qemu can
      only be used on systems that support UNIX sockets, which rules
      out Windows (even if qemu could be compiled there) - so for all
      points on the call chain that interact with this API decision,
      we require a different variable name to make it clear that we
      audited the use for safety.
      
      Adding a syntax-check rule only solves half the battle; anywhere
      that uses printf on a pid_t still needs to be converted, but that
      will be a separate patch.
      
      * cfg.mk (sc_correct_id_types): New syntax check.
      * src/libvirt-qemu.c (virDomainQemuAttach): Document why we didn't
      use pid_t for pid, and validate for overflow.
      * include/libvirt/libvirt-qemu.h (virDomainQemuAttach): Tweak name
      for syntax check.
      * src/vmware/vmware_conf.c (vmwareExtractPid): Likewise.
      * src/driver.h (virDrvDomainQemuAttach): Likewise.
      * tools/virsh.c (cmdQemuAttach): Likewise.
      * src/remote/qemu_protocol.x (qemu_domain_attach_args): Likewise.
      * src/qemu_protocol-structs (qemu_domain_attach_args): Likewise.
      * src/util/cgroup.c (virCgroupPidCode, virCgroupKillInternal):
      Likewise.
      * src/qemu/qemu_command.c(qemuParseProcFileStrings): Likewise.
      (qemuParseCommandLinePid): Use pid_t for pid.
      * daemon/libvirtd.c (daemonForkIntoBackground): Likewise.
      * src/conf/domain_conf.h (_virDomainObj): Likewise.
      * src/probes.d (rpc_socket_new): Likewise.
      * src/qemu/qemu_command.h (qemuParseCommandLinePid): Likewise.
      * src/qemu/qemu_driver.c (qemudGetProcessInfo, qemuDomainAttach):
      Likewise.
      * src/qemu/qemu_process.c (qemuProcessAttach): Likewise.
      * src/qemu/qemu_process.h (qemuProcessAttach): Likewise.
      * src/uml/uml_driver.c (umlGetProcessInfo): Likewise.
      * src/util/virnetdev.h (virNetDevSetNamespace): Likewise.
      * src/util/virnetdev.c (virNetDevSetNamespace): Likewise.
      * tests/testutils.c (virtTestCaptureProgramOutput): Likewise.
      * src/conf/storage_conf.h (_virStoragePerms): Use mode_t, uid_t,
      and gid_t rather than int.
      * src/security/security_dac.c (virSecurityDACSetOwnership): Likewise.
      * src/conf/storage_conf.c (virStorageDefParsePerms): Avoid
      compiler warning.
      3e2c3d8f
  4. 28 2月, 2012 4 次提交
  5. 27 2月, 2012 1 次提交
    • P
      util: Add helpers for safe domain console operations · 3f4238d7
      Peter Krempa 提交于
      This patch adds a set of functions used in creating console streams for
      domains using PTYs and ensures mutually exclusive access to the PTYs.
      
      If mutually exclusive access is not used, two clients may open the same
      console, which results in corruption on both clients as both of them
      race to read data from the PTY.
      
      Two approaches are used to ensure this:
      1) Internal data structure holding open PTYs.
              This is used internally and enables the user to forcibly
              terminate another console connection eg. when somebody leaves
              the console open on another host.
      
      2) UUCP style lock files:
              This uses UUCP lock files according to the  FHS
              ( http://www.pathname.com/fhs/pub/fhs-2.3.html#VARLOCKLOCKFILES )
              to check if other programs (like minicom) are not using the pty
              device of the console.
      
              This feature is disabled by default and may be enabled using
              configure parameter
              --with-console-lock-files=/path/to/lock/file/directory
              or --with-console-lock-files=auto (which tries to infer the
              location from OS used (currently only linux).
      
              On usual linux systems, normal users may not write to the
              /var/lock directory containing the locks. This poses problems
              while in session mode. If the current user has no access to the
              lockfile directory, check for presence of the file is still
              done, but no lock file is created. This does NOT result in an
              error.
      3f4238d7
  6. 21 2月, 2012 1 次提交
    • C
      caps: Improve error if passed an unknown arch · e1ecba46
      Cole Robinson 提交于
      Previously we would have:
      
      "os type 'hvm' & arch 'idontexist' combination is not supported"
      
      Now we get
      
      "No guest options available for arch 'idontexist'"
      
      or if options available but guest OS type not applicable:
      
      "No os type 'xen' available for arch 'x86_64'"
      e1ecba46
  7. 16 2月, 2012 3 次提交
    • E
      snapshot: fix snapshot deletion use-after-free · 4c1c3611
      Eric Blake 提交于
      Bug introduced in commit 35abced2.  On an inactive domain,
      $ virsh snapshot-create-as dom snap
      $ virsh snapshot-create dom
      $ virsh snapshot-create dom
      $ virsh snapshot-delete --children dom snap
      could crash libvirtd, due to a use-after-free that results
      when the callback freed the current element in the iteration.
      
      * src/conf/domain_conf.c (virDomainSnapshotForEachChild)
      (virDomainSnapshotActOnDescendant): Allow iteration to delete
      current child.
      4c1c3611
    • A
      network: support Open vSwitch · df810046
      Ansis Atteka 提交于
      This patch allows libvirt to add interfaces to already
      existing Open vSwitch bridges. The following syntax in
      domain XML file can be used:
      
          <interface type='bridge'>
            <mac address='52:54:00:d0:3f:f2'/>
            <source bridge='ovsbr'/>
            <virtualport type='openvswitch'>
              <parameters interfaceid='921a80cd-e6de-5a2e-db9c-ab27f15a6e1d'/>
            </virtualport>
            <address type='pci' domain='0x0000' bus='0x00'
                                slot='0x03' function='0x0'/>
          </interface>
      
      or if libvirt should auto-generate the interfaceid use
      following syntax:
      
          <interface type='bridge'>
            <mac address='52:54:00:d0:3f:f2'/>
            <source bridge='ovsbr'/>
            <virtualport type='openvswitch'>
            </virtualport>
            <address type='pci' domain='0x0000' bus='0x00'
                                slot='0x03' function='0x0'/>
          </interface>
      
      It is also possible to pass an optional profileid. To do that
      use following syntax:
      
         <interface type='bridge'>
           <source bridge='ovsbr'/>
           <mac address='00:55:1a:65:a2:8d'/>
           <virtualport type='openvswitch'>
             <parameters interfaceid='921a80cd-e6de-5a2e-db9c-ab27f15a6e1d'
                         profileid='test-profile'/>
           </virtualport>
         </interface>
      
      To create Open vSwitch bridge install Open vSwitch and
      run the following command:
      
          ovs-vsctl add-br ovsbr
      df810046
    • L
      conf: rename virDomainNetGetActualDirectVirtPortProfile · 9368465f
      Laine Stump 提交于
      An upcoming patch will add a <virtualport> element to interfaces of
      type='bridge', so it makes sense to give this function a more generic
      name.
      9368465f
  8. 13 2月, 2012 2 次提交
  9. 10 2月, 2012 3 次提交
    • O
      npiv: Auto-generate WWN if it's not specified · 7c90026d
      Osier Yang 提交于
      The auto-generated WWN comply with the new addressing schema of WWN:
      
      <quote>
      the first nibble is either hex 5 or 6 followed by a 3-byte vendor
      identifier and 36 bits for a vendor-specified serial number.
      </quote>
      
      We choose hex 5 for the first nibble. And for the 3-bytes vendor ID,
      we uses the OUI according to underlying hypervisor type, (invoking
      virConnectGetType to get the virt type). e.g. If virConnectGetType
      returns "QEMU", we use Qumranet's OUI (00:1A:4A), if returns
      ESX|VMWARE, we use VMWARE's OUI (00:05:69). Currently it only
      supports qemu|xen|libxl|xenapi|hyperv|esx|vmware drivers. The last
      36 bits are auto-generated.
      7c90026d
    • M
      Remove single quotes from audit records · 8ac1f8f4
      Marcelo Cerri 提交于
      Some audit records generated by libvirt contain fields enclosed by single
      quotes. Since those fields are inside the msg field, which is enclosed by
      single quotes, these records generated by libvirt are not correctly parsed by
      libauparse.
      8ac1f8f4
    • M
      domain: add implicit USB controller · 42043afc
      Marc-André Lureau 提交于
      Some tools, such as virt-manager, prefers having the default USB
      controller explicit in the XML document. This patch makes sure there
      is one. With this patch, it is now possible to switch from USB1 to
      USB2 from the release 0.9.1 of virt-manager.
      
      Fix tests to pass with this change.
      42043afc
  10. 09 2月, 2012 1 次提交
  11. 08 2月, 2012 1 次提交
    • J
      seclabel: Do not output relabel attribute for type 'none' · f6957617
      Jiri Denemark 提交于
      Security label type 'none' requires relabel to be set to 'no' so there's
      no reason to output this extra attribute.  Moreover, since relabel is
      internally stored in a negative from (norelabel), the default value for
      relabel would be 'yes' in case there is no <seclabel> element in domain
      configuration.  In case VIR_DOMAIN_SECLABEL_DEFAULT turns into
      VIR_DOMAIN_SECLABEL_NONE, we would incorrectly output relabel='yes' for
      seclabel type 'none'.
      f6957617
  12. 07 2月, 2012 1 次提交
    • E
      seclabel: make code and RNG match · c052d8a8
      Eric Blake 提交于
      Commit b170eb99 introduced a bug: domains that had an explicit
      <seclabel type='none'/> when started would not be reparsed if
      libvirtd restarted.  It turns out that our testsuite was not
      exercising this because it never tried anything but inactive
      parsing.  Additionally, the live XML for such a domain failed
      to re-validate.  Applying just the tests/ portion of this patch
      will expose the bugs that are fixed by the other two files.
      
      * docs/schemas/domaincommon.rng (seclabel): Allow relabel under
      type='none'.
      * src/conf/domain_conf.c (virSecurityLabelDefParseXML): Per RNG,
      presence of <seclabel> with no type implies dynamic.  Don't
      require sub-elements for type='none'.
      * tests/qemuxml2xmltest.c (mymain): Add test.
      * tests/qemuxml2argvtest.c (mymain): Likewise.
      * tests/qemuxml2argvdata/qemuxml2argv-seclabel-none.xml: Add file.
      * tests/qemuxml2argvdata/qemuxml2argv-seclabel-none.args: Add file.
      Reported by Ansis Atteka.
      c052d8a8
  13. 04 2月, 2012 3 次提交
    • L
      qemu: eliminate "Ignoring open failure" when using root-squash NFS · c18a88ac
      Laine Stump 提交于
      This eliminates the warning message reported in:
      
       https://bugzilla.redhat.com/show_bug.cgi?id=624447
      
      It was caused by a failure to open an image file that is not
      accessible by root (the uid libvirtd is running as) because it's on a
      root-squash NFS share, owned by a different user, with permissions of
      660 (or maybe 600).
      
      The solution is to use virFileOpenAs() rather than open(). The
      codepath that generates the error is during qemuSetupDiskCGroup(), but
      the actual open() is in a lower-level generic function called from
      many places (virDomainDiskDefForeachPath), so some other pieces of the
      code were touched just to add dummy (or possibly useful) uid and gid
      arguments.
      
      Eliminating this warning message has the nice side effect that the
      requested operation may even succeed (which in this case isn't
      necessary, but shouldn't hurt anything either).
      c18a88ac
    • P
      virterror.c: Fix several spelling mistakes · 99d24ab2
      Philipp Hahn 提交于
      compat{a->i}bility
      erron{->e}ous
      nec{c->}essary.
      Either "the" or "a".
      Signed-off-by: NPhilipp Hahn <hahn@univention.de>
      99d24ab2
    • E
      build: prohibit raw malloc and free · a7cfd709
      Eric Blake 提交于
      Our HACKING discourages use of malloc and free, for at least
      a couple of years now.  But we weren't enforcing it, until now :)
      
      For now, I've exempted python and tests, and will clean those up
      in subsequent patches.  Examples should be permanently exempt,
      since anyone copying our examples won't have use of our
      internal-only memory.h via libvirt_util.la.
      
      * cfg.mk (sc_prohibit_raw_allocation): New rule.
      (exclude_file_name_regexp--sc_prohibit_raw_allocation): and
      exemptions.
      * src/cpu/cpu.c (cpuDataFree): Avoid false positive.
      * src/conf/network_conf.c (virNetworkDNSSrvDefParseXML): Fix
      offenders.
      * src/libxl/libxl_conf.c (libxlMakeDomBuildInfo, libxlMakeVfb)
      (libxlMakeDeviceModelInfo): Likewise.
      * src/rpc/virnetmessage.c (virNetMessageSaveError): Likewise.
      * tools/virsh.c (_vshMalloc, _vshCalloc): Likewise.
      a7cfd709
  14. 03 2月, 2012 4 次提交
    • A
      conf: Plug memory on virDomainDiskDefParseXML · d166cf76
      Alex Jia 提交于
      Detected by valgrind. Leak is introduced in commit 397e6a70.
      
      * src/conf/domain_conf.c(virDomainDiskDefParseXML): fix memory leak.
      
      How to reproduce?
      % make -C tests check TESTS=qemuxml2argvtest
      % cd tests && valgrind -v --leak-check=full ./qemuxml2argvtest
      
      * Actual result:
      
      ==16352== 4 bytes in 1 blocks are definitely lost in loss record 12 of 147
      ==16352==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
      ==16352==    by 0x39D90A67DD: xmlStrndup (xmlstring.c:45)
      ==16352==    by 0x4E83D5: virDomainDiskDefParseXML (domain_conf.c:2894)
      ==16352==    by 0x4F542D: virDomainDefParseXML (domain_conf.c:7626)
      ==16352==    by 0x4F8683: virDomainDefParseNode (domain_conf.c:8390)
      ==16352==    by 0x4F904E: virDomainDefParse (domain_conf.c:8340)
      ==16352==    by 0x41C626: testCompareXMLToArgvHelper (qemuxml2argvtest.c:105)
      ==16352==    by 0x41DED1: virtTestRun (testutils.c:142)
      ==16352==    by 0x418172: mymain (qemuxml2argvtest.c:486)
      ==16352==    by 0x41D5C7: virtTestMain (testutils.c:697)
      ==16352==    by 0x39CF01ECDC: (below main) (in /lib64/libc-2.12.so)
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      d166cf76
    • D
      Add two new security label types · b170eb99
      Daniel P. Berrange 提交于
      Curently security labels can be of type 'dynamic' or 'static'.
      If no security label is given, then 'dynamic' is assumed. The
      current code takes advantage of this default, and avoids even
      saving <seclabel> elements with type='dynamic' to disk. This
      means if you temporarily change security driver, the guests
      can all still start.
      
      With the introduction of sVirt to LXC though, there needs to be
      a new default of 'none' to allow unconfined LXC containers.
      
      This patch introduces two new security label types
      
       - default:  the host configuration decides whether to run the
                   guest with type 'none' or 'dynamic' at guest start
       - none:     the guest will run unconfined by security policy
      
      The 'none' label type will obviously be undesirable for some
      deployments, so a new qemu.conf option allows a host admin to
      mandate confined guests. It is also possible to turn off default
      confinement
      
        security_default_confined = 1|0  (default == 1)
        security_require_confined = 1|0  (default == 0)
      
      * src/conf/domain_conf.c, src/conf/domain_conf.h: Add new
        seclabel types
      * src/security/security_manager.c, src/security/security_manager.h:
        Set default sec label types
      * src/security/security_selinux.c: Handle 'none' seclabel type
      * src/qemu/qemu.conf, src/qemu/qemu_conf.c, src/qemu/qemu_conf.h,
        src/qemu/libvirtd_qemu.aug: New security config options
      * src/qemu/qemu_driver.c: Tell security driver about default
        config
      b170eb99
    • D
      Re-add domain device seclabel parsing / formatting · 87c39f0e
      Daniel P. Berrange 提交于
      This re-introduces parsing & formatting for per device seclabels.
      There is a new virDomainDeviceSeclabelPtr struct and corresponding
      APIs for parsing/formatting.
      87c39f0e
    • D
      Revert changes to sec label parsing · ae6135bf
      Daniel P. Berrange 提交于
      Revert parsing changes:
      
        commit 302fe95f
        Author: Eric Blake <eblake@redhat.com>
        Date:   Wed Jan 4 16:01:24 2012 -0700
      
          seclabel: fix regression in libvirtd restart
      
        commit b4343293
        Author: Eric Blake <eblake@redhat.com>
        Date:   Thu Dec 22 17:47:50 2011 -0700
      
          seclabel: allow a seclabel override on a disk src
      
      These two commits changed the sec label parsing code so that
      the same code dealt with both the VM level sec label, and the
      per device label. Unfortunately, as we add more options to the
      VM level sec label, the logic required to use the same parsing
      code for the per device label becomes unintelligible.
      
      * src/conf/domain_conf.c: Remove support for parsing per
        device sec labels
      ae6135bf
  15. 02 2月, 2012 1 次提交
    • P
      xml: Add element <title> to allow short description of domains · b79ba838
      Peter Krempa 提交于
      This patch adds a new element <title> to the domain XML. This attribute
      can hold a short title defined by the user to ease the identification of
      domains. The title may not contain newlines and should be reasonably short.
      
       *docs/formatdomain.html.in
       *docs/schemas/domaincommon.rng
              - add schema grammar for the new element and documentation
        *src/conf/domain_conf.c
        *src/conf/domain_conf.h
              - add field to hold the new attribute
              - add code to parse and create XML with the new attribute
      b79ba838
  16. 01 2月, 2012 1 次提交
    • T
      conf: add rawio attribute to disk element of domain XML · 397e6a70
      Taku Izumi 提交于
       This patch adds a new attribute "rawio" to the "disk" element
       of domain XML. Valid values of "rawio" attribute are "yes"
       and "no".
       rawio='yes' indicates the disk is desirous of CAP_SYS_RAWIO.
      
       If you specify the following XML:
      
       <disk type='block' device='lun' rawio='yes'>
        ...
       </disk>
      
       the domain will be granted CAP_SYS_RAWIO.
       (of course, the domain have to be executed with root privilege)
      
      NOTE:
         - "rawio" attribute is only valid when device='lun'
         - At the moment, any other disks you won't use rawio can use rawio.
      Signed-off-by: NTaku Izumi <izumi.taku@jp.fujitsu.com>
      397e6a70