1. 05 4月, 2013 3 次提交
    • P
      conf callback: Rearrange function parameters · ad0d10b2
      Peter Krempa 提交于
      Move the xmlopt and caps arguments to the end of the argument list.
      ad0d10b2
    • P
      conf: Add post XML parse callbacks and prepare for cleaning of virCaps · 43b99fc4
      Peter Krempa 提交于
      This patch adds instrumentation that will allow hypervisor drivers to
      fill and validate domain and device definitions after parsed by the XML
      parser.
      
      With this patch, after the XML is parsed, a callback to the driver is
      issued requesting to fill and validate driver specific details of the
      configuration. This allows to use sensible defaults and checks on a per
      driver basis at the time the XML is parsed.
      
      Two callback pointers are stored in the new virDomainXMLConf object:
      * virDomainDeviceDefPostParseCallback (devicesPostParseCallback)
        - called for a single device parsed and for every single device in a
          domain config. A virDomainDeviceDefPtr is passed along with the
          domain definition and virCaps.
      
      * virDomainDefPostParseCallback, (domainPostParseCallback)
        - A callback that is meant to process the domain config after it's
        parsed.  A virDomainDefPtr is passed along with virCaps.
      
      Both types of callbacks support arbitrary opaque data passed for the
      callback functions.
      
      Errors may be reported in those callbacks resulting in a XML parsing
      failure.
      43b99fc4
    • P
      maint: Rename xmlconf to xmlopt and virDomainXMLConfig to virDomainXMLOption · e84b1931
      Peter Krempa 提交于
      This patch is the result of running:
      
      for i in $(git ls-files | grep -v html | grep -v \.po$ ); do
        sed -i -e "s/virDomainXMLConf/virDomainXMLOption/g" -e "s/xmlconf/xmlopt/g" $i
      done
      
      and a few manual tweaks.
      e84b1931
  2. 13 3月, 2013 1 次提交
    • P
      virCaps: conf: start splitting out irrelevat data · 27cf98e2
      Peter Krempa 提交于
      The virCaps structure gathered a ton of irrelevant data over time that.
      The original reason is that it was propagated to the XML parser
      functions.
      
      This patch aims to create a new data structure virDomainXMLConf that
      will contain immutable data that are used by the XML parser. This will
      allow two things we need:
      
      1) Get rid of the stuff from virCaps
      
      2) Allow us to add callbacks to check and add driver specific stuff
      after domain XML is parsed.
      
      This first attempt removes pointers to private data allocation functions
      to this new structure and update all callers and function that require
      them.
      27cf98e2
  3. 08 2月, 2013 1 次提交
  4. 06 2月, 2013 1 次提交
    • D
      Merge virDomainObjListIsDuplicate into virDomainObjListAdd · eea87129
      Daniel P. Berrange 提交于
      The duplicate VM checking should be done atomically with
      virDomainObjListAdd, so shoud not be a separate function.
      Instead just use flags to indicate what kind of checks are
      required.
      
      This pair, used in virDomainCreateXML:
      
         if (virDomainObjListIsDuplicate(privconn->domains, def, 1) < 0)
           goto cleanup;
         if (!(dom = virDomainObjListAdd(privconn->domains,
                                         privconn->caps,
                                         def, false)))
           goto cleanup;
      
      Changes to
      
         if (!(dom = virDomainObjListAdd(privconn->domains,
                                         privconn->caps,
                                         def,
                                         VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
                                         NULL)))
           goto cleanup;
      
      This pair, used in virDomainRestoreFlags:
      
         if (virDomainObjListIsDuplicate(privconn->domains, def, 1) < 0)
           goto cleanup;
         if (!(dom = virDomainObjListAdd(privconn->domains,
                                         privconn->caps,
                                         def, true)))
           goto cleanup;
      
      Changes to
      
         if (!(dom = virDomainObjListAdd(privconn->domains,
                                         privconn->caps,
                                         def,
                                         VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
                                         VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
                                         NULL)))
           goto cleanup;
      
      This pair, used in virDomainDefineXML:
      
         if (virDomainObjListIsDuplicate(privconn->domains, def, 0) < 0)
           goto cleanup;
         if (!(dom = virDomainObjListAdd(privconn->domains,
                                         privconn->caps,
                                         def, false)))
           goto cleanup;
      
      Changes to
      
         if (!(dom = virDomainObjListAdd(privconn->domains,
                                         privconn->caps,
                                         def,
                                         0, NULL)))
           goto cleanup;
      eea87129
  5. 05 2月, 2013 2 次提交
  6. 16 1月, 2013 1 次提交
  7. 08 1月, 2013 1 次提交
  8. 05 1月, 2013 1 次提交
  9. 21 12月, 2012 6 次提交
  10. 19 12月, 2012 2 次提交
  11. 10 11月, 2012 1 次提交
    • V
      capabilities: defaultConsoleTargetType can depend on architecture · b1c88c14
      Viktor Mihajlovski 提交于
      For S390, the default console target type cannot be of type 'serial'.
      It is necessary to at least interpret the 'arch' attribute
      value of the os/type element to produce the correct default type.
      
      Therefore we need to extend the signature of defaultConsoleTargetType
      to account for architecture. As a consequence all the drivers
      supporting this capability function must be updated.
      
      Despite the amount of changed files, the only change in behavior is
      that for S390 the default console target type will be 'virtio'.
      
      N.B.: A more future-proof approach could be to to use hypervisor
      specific capabilities to determine the best possible console type.
      For instance one could add an opaque private data pointer to the
      virCaps structure (in case of QEMU to hold capsCache) which could
      then be passed to the defaultConsoleTargetType callback to determine
      the console target type.
      Seems to be however a bit overengineered for the use case...
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      b1c88c14
  12. 02 11月, 2012 1 次提交
  13. 21 9月, 2012 1 次提交
  14. 13 9月, 2012 1 次提交
    • E
      maint: fix missing spaces in message · 2387aa26
      Eric Blake 提交于
      I got an off-list report about a bad diagnostic:
      Target network card mac 52:54:00:49:07:ccdoes not match source 52:54:00:49:07:b8
      
      True to form, I've added a syntax check rule to prevent it
      from recurring, and found several other offenders.
      
      * cfg.mk (sc_require_whitespace_in_translation): New rule.
      * src/conf/domain_conf.c (virDomainNetDefCheckABIStability): Add
      space.
      * src/esx/esx_util.c (esxUtil_ParseUri): Likewise.
      * src/qemu/qemu_command.c (qemuCollectPCIAddress): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainSetMetadata)
      (qemuDomainGetMetadata): Likewise.
      * src/qemu/qemu_hotplug.c (qemuDomainChangeNetBridge): Likewise.
      * src/rpc/virnettlscontext.c
      (virNetTLSContextCheckCertDNWhitelist): Likewise.
      * src/vmware/vmware_driver.c (vmwareDomainResume): Likewise.
      * src/vbox/vbox_tmpl.c (vboxDomainGetXMLDesc, vboxAttachDrives):
      Avoid false negatives.
      * tools/virsh-domain.c (info_save_image_dumpxml): Reword.
      Based on a report by Luwen Su.
      2387aa26
  15. 14 8月, 2012 1 次提交
    • O
      Destroy virdomainlist.[ch] · bb705e25
      Osier Yang 提交于
      As the consensus in:
      https://www.redhat.com/archives/libvir-list/2012-July/msg01692.html,
      this patch is to destroy conf/virdomainlist.[ch], folding the
      helpers into conf/domain_conf.[ch].
      
      * src/Makefile.am:
        - Various indention fixes incidentally
        - Add macro DATATYPES_SOURCES (datatypes.[ch])
        - Link datatypes.[ch] for libvirt_lxc
      
      * src/conf/domain_conf.c:
        - Move all the stuffs from virdomainlist.c into it
        - Use virUnrefDomain and virUnrefDomainSnapshot instead of
          virDomainFree and virDomainSnapshotFree, which are defined
          in libvirt.c, and we don't want to link to it.
        - Remove "if" before "free" the object, as virObjectUnref
          is in the list "useless_free_options".
      
      * src/conf/domain_conf.h:
        - Move all the stuffs from virdomainlist.h into it
        - s/LIST_FILTER/LIST_DOMAINS_FILTER/
      
      * src/libxl/libxl_driver.c:
        - s/LIST_FILTER/LIST_DOMAINS_FILTER/
        - no (include "virdomainlist.h")
      
      * src/libxl/libxl_driver.c: Likewise
      
      * src/lxc/lxc_driver.c: Likewise
      
      * src/openvz/openvz_driver.c: Likewise
      
      * src/parallels/parallels_driver.c: Likewise
      
      * src/qemu/qemu_driver.c: Likewise
      
      * src/test/test_driver.c: Likewise
      
      * src/uml/uml_driver.c: Likewise
      
      * src/vbox/vbox_tmpl.c: Likewise
      
      * src/vmware/vmware_driver.c: Likewise
      
      * tools/virsh-domain-monitor.c: Likewise
      
      * tools/virsh.c: Likewise
      bb705e25
  16. 07 8月, 2012 1 次提交
  17. 23 7月, 2012 1 次提交
    • O
      Desert the FSF address in copyright · f9ce7dad
      Osier Yang 提交于
      Per the FSF address could be changed from time to time, and GNU
      recommends the following now: (http://www.gnu.org/licenses/gpl-howto.html)
      
        You should have received a copy of the GNU General Public License
        along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
      
      This patch removes the explicit FSF address, and uses above instead
      (of course, with inserting 'Lesser' before 'General').
      
      Except a bunch of files for security driver, all others are changed
      automatically, the copyright for securify files are not complete,
      that's why to do it manually:
      
        src/security/security_selinux.h
        src/security/security_driver.h
        src/security/security_selinux.c
        src/security/security_apparmor.h
        src/security/security_apparmor.c
        src/security/security_driver.c
      f9ce7dad
  18. 19 7月, 2012 1 次提交
  19. 04 7月, 2012 1 次提交
  20. 20 6月, 2012 1 次提交
    • P
      drivers: Implement virListAllDomains for drivers using virDomainObj · 33dc8cf0
      Peter Krempa 提交于
      This patch adds support for listing all domains into drivers that use
      the common virDomainObj implementation: libxl, lxc, openvz, qemu, test,
      uml, vmware.
      
      For drivers that don't support managed save images the guests are
      treated as if they had none, so filtering guests that do have such an
      image on this driver succeeds and produces 0 results.
      33dc8cf0
  21. 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
  22. 22 2月, 2012 1 次提交
  23. 24 1月, 2012 1 次提交
    • D
      Add new virDomainShutdownFlags API · 0b7ddf9e
      Daniel P. Berrange 提交于
      Add a new API virDomainShutdownFlags and define:
      
          VIR_DOMAIN_SHUTDOWN_DEFAULT        = 0,
          VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN = (1 << 0),
          VIR_DOMAIN_SHUTDOWN_GUEST_AGENT    = (1 << 1),
      
      Also define some flags for the reboot API
      
          VIR_DOMAIN_REBOOT_DEFAULT        = 0,
          VIR_DOMAIN_REBOOT_ACPI_POWER_BTN = (1 << 0),
          VIR_DOMAIN_REBOOT_GUEST_AGENT    = (1 << 1),
      
      Although these two APIs currently have the same flags, using
      separate enums allows them to expand separately in the future.
      
      Add stub impls of the new API for all existing drivers
      0b7ddf9e
  24. 24 11月, 2011 2 次提交
  25. 03 11月, 2011 1 次提交
    • D
      Fix default console type setting · 209c2880
      Daniel P. Berrange 提交于
      The default console type may vary based on the OS type. ie a Xen
      paravirt guests wants a 'xen' console, while a fullvirt guests
      wants a 'serial' console.
      
      A plain integer default console type in the capabilities does
      not suffice. Instead introduce a callback that is passed the
      OS type.
      
      * src/conf/capabilities.h: Use a callback for default console
        type
      * src/conf/domain_conf.c, src/conf/domain_conf.h: Use callback
        for default console type. Add missing LXC/OpenVZ console types.
      * src/esx/esx_driver.c, src/libxl/libxl_conf.c,
        src/lxc/lxc_conf.c, src/openvz/openvz_conf.c,
        src/phyp/phyp_driver.c, src/qemu/qemu_capabilities.c,
        src/uml/uml_conf.c, src/vbox/vbox_tmpl.c,
        src/vmware/vmware_conf.c, src/xen/xen_hypervisor.c,
        src/xenapi/xenapi_driver.c: Set default console type callback
      209c2880
  26. 19 8月, 2011 1 次提交
  27. 22 7月, 2011 2 次提交
    • M
      73838d33
    • E
      build: rename files.h to virfile.h · 8e22e089
      Eric Blake 提交于
      In preparation for a future patch adding new virFile APIs.
      
      * src/util/files.h, src/util/files.c: Move...
      * src/util/virfile.h, src/util/virfile.c: ...here, and rename
      functions to virFile prefix.  Macro names are intentionally
      left alone.
      * *.c: All '#include "files.h"' uses changed.
      * src/Makefile.am (UTIL_SOURCES): Reflect rename.
      * cfg.mk (exclude_file_name_regexp--sc_prohibit_close): Likewise.
      * src/libvirt_private.syms: Likewise.
      * docs/hacking.html.in: Likewise.
      * HACKING: Regenerate.
      8e22e089
  28. 20 7月, 2011 1 次提交
  29. 16 7月, 2011 1 次提交
    • E
      flags: use common dumpxml flags check · 461e0f1a
      Eric Blake 提交于
      The previous patches only cleaned up ATTRIBUTE_UNUSED flags cases;
      auditing the drivers found other places where flags was being used
      but not validated.  In particular, domainGetXMLDesc had issues with
      clients accepting a different set of flags than the common
      virDomainDefFormat helper function.
      
      * src/conf/domain_conf.c (virDomainDefFormat): Add common flag check.
      * src/uml/uml_driver.c (umlDomainAttachDeviceFlags)
      (umlDomainDetachDeviceFlags): Reject unknown
      flags.
      * src/vbox/vbox_tmpl.c (vboxDomainGetXMLDesc)
      (vboxDomainAttachDeviceFlags)
      (vboxDomainDetachDeviceFlags): Likewise.
      * src/qemu/qemu_driver.c (qemudDomainMemoryPeek): Likewise.
      (qemuDomainGetXMLDesc): Document common flag handling.
      * src/libxl/libxl_driver.c (libxlDomainGetXMLDesc): Likewise.
      * src/lxc/lxc_driver.c (lxcDomainGetXMLDesc): Likewise.
      * src/openvz/openvz_driver.c (openvzDomainGetXMLDesc): Likewise.
      * src/phyp/phyp_driver.c (phypDomainGetXMLDesc): Likewise.
      * src/test/test_driver.c (testDomainGetXMLDesc): Likewise.
      * src/vmware/vmware_driver.c (vmwareDomainGetXMLDesc): Likewise.
      * src/xenapi/xenapi_driver.c (xenapiDomainGetXMLDesc): Likewise.
      461e0f1a