1. 31 12月, 2011 1 次提交
  2. 30 12月, 2011 7 次提交
    • D
      Fix build on s390(x) and other stange arches · c4ac050f
      Daniel Veillard 提交于
      The blocks to extract node information on a per-arch
      basis wasn't well balanced leading to a compilation
      failure if not on one of the handled arches (PCs and PPCs)
      c4ac050f
    • E
      seclabel: honor device override in selinux · 904e05a2
      Eric Blake 提交于
      This wires up the XML changes in the previous patch to let SELinux
      labeling honor user overrides, as well as affecting the live XML
      configuration in one case where the user didn't specify anything
      in the offline XML.
      
      I noticed that the logs contained messages like this:
      
      2011-12-05 23:32:40.382+0000: 26569: warning : SELinuxRestoreSecurityFileLabel:533 : cannot lookup default selinux label for /nfs/libvirt/images/dom.img
      
      for all my domain images living on NFS.  But if we would just remember
      that on domain creation that we were unable to set a SELinux label (due to
      NFSv3 lacking labels, or NFSv4 not being configured to expose attributes),
      then we could avoid wasting the time trying to clear the label on
      domain shutdown.  This in turn is one less point of NFS failure,
      especially since there have been documented cases of virDomainDestroy
      hanging during an attempted operation on a failed NFS connection.
      
      * src/security/security_selinux.c (SELinuxSetFilecon): Move guts...
      (SELinuxSetFileconHelper): ...to new function.
      (SELinuxSetFileconOptional): New function.
      (SELinuxSetSecurityFileLabel): Honor override label, and remember
      if labeling failed.
      (SELinuxRestoreSecurityImageLabelInt): Skip relabeling based on
      override.
      904e05a2
    • E
      seclabel: allow a seclabel override on a disk src · b4343293
      Eric Blake 提交于
      Implement the parsing and formatting of the XML addition of
      the previous commit.  The new XML doesn't affect qemu command
      line, so we can now test round-trip XML->memory->XML handling.
      
      I chose to reuse the existing structure, even though per-device
      override doesn't use all of those fields, rather than create a
      new structure, in order to reuse more code.
      
      * src/conf/domain_conf.h (_virDomainDiskDef): Add seclabel member.
      * src/conf/domain_conf.c (virDomainDiskDefFree): Free it.
      (virSecurityLabelDefFree): New function.
      (virDomainDiskDefFormat): Print it.
      (virSecurityLabelDefFormat): Reduce output if model not present.
      (virDomainDiskDefParseXML): Alter signature, and parse seclabel.
      (virSecurityLabelDefParseXML): Split...
      (virSecurityLabelDefParseXMLHelper): ...into new helper.
      (virDomainDeviceDefParse, virDomainDefParseXML): Update callers.
      * tests/qemuxml2argvdata/qemuxml2argv-seclabel-dynamic-override.args:
      New file.
      * tests/qemuxml2xmltest.c (mymain): Enhance test.
      * tests/qemuxml2argvtest.c (mymain): Likewise.
      b4343293
    • E
      seclabel: extend XML to allow per-disk label overrides · 6cb4acce
      Eric Blake 提交于
      When doing security relabeling, there are cases where a per-file
      override might be appropriate.  For example, with a static label
      and relabeling, it might be appropriate to skip relabeling on a
      particular disk, where the backing file lives on NFS that lacks
      the ability to track labeling.  Or with dynamic labeling, it might
      be appropriate to use a custom (non-dynamic) label for a disk
      specifically intended to be shared across domains.
      
      The new XML resembles the top-level <seclabel>, but with fewer
      options (basically relabel='no', or <label>text</label>):
      
      <domain ...>
        ...
        <devices>
          <disk type='file' device='disk'>
            <source file='/path/to/image1'>
              <seclabel relabel='no'/> <!-- override for just this disk -->
            </source>
            ...
          </disk>
          <disk type='file' device='disk'>
            <source file='/path/to/image1'>
              <seclabel relabel='yes'> <!-- override for just this disk -->
                <label>system_u:object_r:shared_content_t:s0</label>
              </seclabel>
            </source>
            ...
          </disk>
          ...
        </devices>
        <seclabel type='dynamic' model='selinux'>
          <baselabel>text</baselabel> <!-- used for all devices without override -->
        </seclabel>
      </domain>
      
      This patch only introduces the XML and documentation; future patches
      will actually parse and make use of it.  The intent is that we can
      further extend things as needed, adding a per-device <seclabel> in
      more places (such as the source of a console device), and possibly
      allowing a <baselabel> instead of <label> for labeling where we want
      to reuse the cNNN,cNNN pair of a dynamically labeled domain but a
      different base label.
      
      First suggested by Daniel P. Berrange here:
      https://www.redhat.com/archives/libvir-list/2011-December/msg00258.html
      
      * docs/schemas/domaincommon.rng (devSeclabel): New define.
      (disk): Use it.
      * docs/formatdomain.html.in (elementsDisks, seclabel): Document
      the new XML.
      * tests/qemuxml2argvdata/qemuxml2argv-seclabel-dynamic-override.xml:
      New test, to validate RNG.
      6cb4acce
    • E
      seclabel: move seclabel stuff earlier · e8383794
      Eric Blake 提交于
      Pure code motion; no semantic change.
      
      * src/conf/domain_conf.h (virDomainSeclabelType)
      (virSecurityLabelDefPtr): Declare earlier.
      * src/conf/domain_conf.c (virSecurityLabelDefClear)
      (virSecurityLabelDefParseXML): Move earlier.
      (virDomainDefParseXML): Move seclabel parsing earlier.
      e8383794
    • E
      seclabel: refactor existing domain_conf usage · 336df796
      Eric Blake 提交于
      A future patch will parse and output <seclabel> in more than one
      location in a <domain> xml; make it easier to reuse code.
      
      * src/conf/domain_conf.c (virSecurityLabelDefFree): Rename...
      (virSecurityLabelDefClear): ...and make static.
      (virSecurityLabelDefParseXML): Alter signature.
      (virDomainDefParseXML, virDomainDefFree): Adjust callers.
      (virDomainDefFormatInternal): Split output...
      (virSecurityLabelDefFormat): ...into new helper.
      336df796
    • E
      schema: rewrite seclabel rng to match code · 116d6af9
      Eric Blake 提交于
      The RNG for <seclabel> was too strict - if it was present, then it
      had to have sub-elements, even if those didn't make sense for the
      given attributes.  Also, we didn't have any tests of <seclabel>
      parsing or XML output.
      
      In this patch, I added more parsing tests than output tests (since
      the output populates and/or reorders fields not present in certain
      inputs).  Making the RNG reliable is a precursor to using <seclabel>
      variants in more places in the XML in later patches.
      
      See also:
      http://berrange.com/posts/2011/09/29/two-small-improvements-to-svirt-guest-configuration-flexibility-with-kvmlibvirt/
      
      * docs/schemas/domaincommon.rng (seclabel): Tighten rules.
      * tests/qemuxml2argvtest.c (mymain): New tests.
      * tests/qemuxml2xmltest.c (mymain): Likewise.
      * tests/qemuxml2argvdata/qemuxml2argv-seclabel-*.*: New files.
      116d6af9
  3. 29 12月, 2011 9 次提交
  4. 28 12月, 2011 3 次提交
    • E
      qemu: fix inf-loop in blkio parameters · 1a3f6608
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=770520
      
      We had two nested loops both trying to use 'i' as the iteration
      variable, which can result in an infinite loop when the inner
      loop interferes with the outer loop.  Introduced in commit 93ab5859.
      
      * src/qemu/qemu_driver.c (qemuDomainSetBlkioParameters): Don't
      reuse iteration variable across two loops.
      1a3f6608
    • L
      virsh: move version command to host group · 96b3716c
      Lai Jiangshan 提交于
      Trivial patch, move version command to host commands group.
      
      It has no any related with any domain.
      
      It may connect to the daemon, so the flag is 0 but not VSH_CMD_FLAG_NOCONNECT.
      96b3716c
    • E
      daemon: clean up daemonization · e957b670
      Eric Blake 提交于
      Valgrind detected a pipe fd leak before the parent exits on success,
      introduced in commit 4296cea2; by itself, the leak is not bad, since
      we immediately called _exit(), but we might as well be clean to make
      valgrind analysis easier.  Meanwhile, if the daemon grandchild detects
      an error, the parent failed to flush the error message before exiting.
      Also, we had the possibility of both parent and child returning to the
      caller, such that the user could see duplicated reports of failure
      from the two return paths.  And we might as well be robust to the
      (unlikely) situation of being started with stdin closed.
      
      * daemon/libvirtd.c (daemonForkIntoBackground): Use exit if an
      error message was generated, avoid fd leaks for valgrind's sake,
      avoid returning to caller in both parent and child, and don't
      close a just-dup'd stdin.
      Based on a report by Alex Jia.
      
      * How to reproduce?
        % service libvirtd stop
        % valgrind -v --track-fds=yes /usr/sbin/libvirtd --daemon
      
      * Actual valgrind result:
      
      ==16804== FILE DESCRIPTORS: 7 open at exit.
      ==16804== Open file descriptor 7:
      ==16804==    at 0x321FAD8B87: pipe (in /lib64/libc-2.12.so)
      ==16804==    by 0x41F34D: daemonForkIntoBackground (libvirtd.c:186)
      ==16804==    by 0x4207A0: main (libvirtd.c:1420)
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e957b670
  5. 26 12月, 2011 2 次提交
  6. 25 12月, 2011 1 次提交
  7. 24 12月, 2011 1 次提交
    • E
      docs: remove stray / · d145fe3b
      Eric Blake 提交于
      Commit e5a84d74 added a new attribute in the wrong location;
      commit c8b9fa74 fixed the missing / at the end but not the extra
      / in the middle.
      
      * docs/formatdomain.html.in (elementsDisks): Fix another typo.
      d145fe3b
  8. 23 12月, 2011 3 次提交
  9. 22 12月, 2011 6 次提交
  10. 21 12月, 2011 7 次提交