1. 04 5月, 2018 1 次提交
  2. 12 4月, 2018 2 次提交
  3. 22 2月, 2018 1 次提交
  4. 16 10月, 2017 3 次提交
    • L
      hyperv: Map Limit to max_memory and VirtualQuantity to cur_balloon · a765e309
      Ladi Prosek 提交于
      Hyper-V uses its own specific memory management so no mapping is going to
      be perfect. However, it is more correct to map Limit to max_memory (it
      really is the upper limit of what the VM may potentially use) and keep
      cur_balloon equal to total_memory.
      
      The typical value returned from Hyper-V in Limit is 1 TiB, which is not
      really going to work if interpreted as "startup memory" to be ballooned
      away later.
      Signed-off-by: NLadi Prosek <lprosek@redhat.com>
      a765e309
    • L
      hyperv: Escape WQL queries · 5ae2d9c2
      Ladi Prosek 提交于
      The code was vulnerable to SQL injection. Likely not a security issue due to
      WMI SQL and other constraints but still lame. For example:
      
        virsh # dominfo \"
        error: failed to get domain '"'
        error: internal error: SOAP fault during enumeration: code 's:Sender', subcode
        'n:CannotProcessFilter', reason 'The data source could not process the filter.
        The filter might be missing or it might be invalid. Change the filter and try
        the request again.  ', detail 'The WS-Management service cannot process the
        request. The WQL query is invalid. '
      
      This commit fixes the Hyper-V driver by escaping all WMI SQL string parameters.
      
      The same command with the fix:
      
        virsh # dominfo \"
        error: failed to get domain '"'
        error: Domain not found: No domain with name "
      Signed-off-by: NLadi Prosek <lprosek@redhat.com>
      5ae2d9c2
    • L
      hyperv: Fix hypervInitConnection error reporting · bb8c2a76
      Ladi Prosek 提交于
      "%s is not a Hyper-V server" is not a correct generalization of all possible
      error conditions of hypervEnumAndPull. For example:
      
        $ virsh --connect hyperv://localhost/?transport=http
        Enter username for localhost [administrator]:
        Enter administrator's password for localhost: <enters incorrect password>
        error: failed to connect to the hypervisor
        error: internal error: localhost is not a Hyper-V server
      
      This commit removes the general virReportError from hypervInitConnection and
      also the "Invalid query" virReportError from hypervSerializeEprParam, which
      does not correctly describe the error either (virBufferCheckError has
      already set a meaningful error message at that point).
      
      The same scenario with the fix:
      
        $ virsh --connect hyperv://localhost/?transport=http
        Enter username for localhost [administrator]:
        Enter administrator's password for localhost: <enters incorrect password>
        error: failed to connect to the hypervisor
        error: internal error: Transport error during enumeration: User, password or
        similar was not accepted (26)
      Signed-off-by: NLadi Prosek <lprosek@redhat.com>
      bb8c2a76
  5. 08 7月, 2017 2 次提交
    • S
      hyperv: Add support for virDomainSetMemory · 48c537f3
      Sri Ramanujam 提交于
      Introduces support for virDomainSetMemory. This also serves an an
      example for how to use the new method invocation API with a more
      complicated method, this time including an EPR and embedded param.
      48c537f3
    • S
      hyperv: support virDomainSendKey · 8efd5b64
      Sri Ramanujam 提交于
      This commit adds support for virDomainSendKey. It also serves as an
      example of how to use the new method invocation APIs with a single
      "simple" type parameter.
      8efd5b64
  6. 19 4月, 2017 1 次提交
    • D
      hyperv: recognize array property as distinct type. · bb9fca7b
      Dawid Zamirski 提交于
      When hyperv code generator for WMI classes identifies common
      properties, it needs to take into account array type as a distinct
      type, i.e string != string[]. This is the case where v1 of the
      Msvm_VirtualSystemSettingData has Notes property as string whereas v2
      uses Notes[], therefore they have to be treated as different fields and
      cannot be placed in the "common" struct.
      bb9fca7b
  7. 08 4月, 2017 1 次提交
    • D
      hyperv: add support for Hyper-V 2012 and newer · 3372f8fb
      Dawid Zamirski 提交于
      This patch reworks the Hyper-V driver structs and the code generator
      to provide seamless support for both Hyper-V 2008 and 2012 or newer.
      This does not implement any new libvirt APIs, it just adapts existing
      2008-only driver to also handle 2012 and newer by sharing as much
      driver code as possible (currently it's all of it :-)). This is needed
      to set the foundation before we can move forward with implementing the
      rest of the driver APIs.
      
      With the 2012 release, Microsoft introduced "v2" version of Msvm_* WMI
      classes. Those are largely the same as "v1" (used in 2008) but have some
      new properties as well as need different wsman request URIs. To
      accomodate those differences, most of work went into the code generator
      so that it's "aware" of possibility of multiple versions of the same WMI
      class and produce C code accordingly.
      
      To accomplish this the following changes were made:
      
       * the abstract hypervObject struct's data member was changed to a union
         that has "common", "v1" and "v2" members. Those are structs that
         represent WMI classes that we get back from wsman response. The
         "common" struct has members that are present in both "v1" and "v2"
         which the driver API callbacks can use to read the data from in
         version-independent manner (if version-specific member needs to be
         accessed the driver can check priv->wmiVersion and read from "v1" or
         "v2" as needed). Those structs are guaranteed to be  memory aligned
         by the code generator (see the align_property_members implementation
         that takes care of that)
       * the generator produces *_WmiInfo for each WMI class "family" that
         holds an array of hypervWmiClassInfoPtr each providing information
         as to which request URI to use for each "version" of given WMI class
         as well as XmlSerializerInfo struct needed to unserilize WS-MAN
         responsed into the data structs. The driver uses those to make proper
         WS-MAN request depending on which version it's connected to.
       * the generator no longer produces "helper" functions such as
         hypervGetMsvmComputerSystemList as those were originally just simple
         wrappers around hypervEnumAndPull, instead those were hand-written
         now (to keep driver changes minimal). The reason is that we'll have
         more code coming implementing missing libvirt APIs and surely code
         patterns will emerge that would warrant more useful "utility" functions
         like that.
       * a hypervInitConnection was added to the driver which "detects"
         Hyper-V version by testing simple wsman request using v2 then falling
         back to v1, obviously if both fail, the we're erroring out.
      
      To express how the above translates in code:
      
      void
      hypervImplementSomeLibvirtApi(virConnectPtr conn, ...)
      {
          hypervPrivate *priv = conn->privateData;
          virBuffer query = VIR_BUFFER_INITIALIZER;
          hypervWqlQuery wqlQuery = HYPERV_WQL_QUERY_INITIALIZER;
          Msvm_ComputerSystem *list = NULL; /* typed hypervObject instance */
      
          /* the WmiInfo struct has the data needed for wsman request and
           * response handling for both v1 and v2 */
          wqlQuery.info = Msvm_ComputerSystem_WmiInfo;
          wqlQuery.query = &query;
      
          virBufferAddLit(&query, "select * from Msvm_ComputerSystem");
      
          if (hypervEnumAndPull(priv, &wqlQuery, (hypervObject **) &list) < 0) {
              goto cleanup;
          }
      
          if (list == NULL) {
              /* none found */
              goto cleanup;
          }
      
          /* works with v1 and v2 */
          char *vmName = list->data.common->Name;
      
          /* access property that is in v2 only */
          if (priv->wmiVersion == HYPERV_WMI_VERSION_V2)
              char *foo = list->data.v2->V2Property;
          else
              char *foo = list->data.v1->V1Property;
      
       cleanup:
          hypervFreeObject(priv, (hypervObject *)list);
      }
      3372f8fb
  8. 11 7月, 2016 1 次提交
    • P
      conf: Add private data for virDomainVcpuDef · 5fe0b6b0
      Peter Krempa 提交于
      Allow to store driver specific data on a per-vcpu basis.
      
      Move of the virDomainDef*Vcpus* functions was necessary as
      virDomainXMLOptionPtr was declared below this block and I didn't want to
      split the function headers.
      5fe0b6b0
  9. 08 6月, 2016 1 次提交
  10. 04 2月, 2016 1 次提交
  11. 09 12月, 2015 2 次提交
  12. 30 11月, 2015 1 次提交
    • M
      conf: Split virDomainObjList into a separate file · 90f3c0d7
      Michal Privoznik 提交于
      Our domain_conf.* files are big enough. Not only they contain XML
      parsing code, but they served as a storage of all functions whose
      name is virDomain prefixed. This is just wrong as it gathers not
      related functions (and modules) into one big file which is then
      harder to maintain. Split virDomainObjList module into a separate
      file called virdomainobjlist.[ch].
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      90f3c0d7
  13. 24 11月, 2015 1 次提交
  14. 22 9月, 2015 1 次提交
  15. 21 4月, 2015 1 次提交
  16. 16 3月, 2015 1 次提交
    • P
      conf: Replace access to def->mem.max_balloon with accessor functions · 4f9907cd
      Peter Krempa 提交于
      As there are two possible approaches to define a domain's memory size -
      one used with legacy, non-NUMA VMs configured in the <memory> element
      and per-node based approach on NUMA machines - the user needs to make
      sure that both are specified correctly in the NUMA case.
      
      To avoid this burden on the user I'd like to replace the NUMA case with
      automatic totaling of the memory size. To achieve this I need to replace
      direct access to the virDomainMemtune's 'max_balloon' field with
      two separate getters depending on the desired size.
      
      The two sizes are needed as:
      1) Startup memory size doesn't include memory modules in some
      hypervisors.
      2) After startup these count as the usable memory size.
      
      Note that the comments for the functions are future aware and document
      state that will be present after a few later patches.
      4f9907cd
  17. 27 1月, 2015 1 次提交
    • D
      Removing probing of secondary drivers · 55ea7be7
      Daniel P. Berrange 提交于
      For stateless, client side drivers, it is never correct to
      probe for secondary drivers. It is only ever appropriate to
      use the secondary driver that is associated with the
      hypervisor in question. As a result the ESX & HyperV drivers
      have both been forced to do hacks where they register no-op
      drivers for the ones they don't implement.
      
      For stateful, server side drivers, we always just want to
      use the same built-in shared driver. The exception is
      virtualbox which is really a stateless driver and so wants
      to use its own server side secondary drivers. To deal with
      this virtualbox has to be built as 3 separate loadable
      modules to allow registration to work in the right order.
      
      This can all be simplified by introducing a new struct
      recording the precise set of secondary drivers each
      hypervisor driver wants
      
      struct _virConnectDriver {
          virHypervisorDriverPtr hypervisorDriver;
          virInterfaceDriverPtr interfaceDriver;
          virNetworkDriverPtr networkDriver;
          virNodeDeviceDriverPtr nodeDeviceDriver;
          virNWFilterDriverPtr nwfilterDriver;
          virSecretDriverPtr secretDriver;
          virStorageDriverPtr storageDriver;
      };
      
      Instead of registering the hypervisor driver, we now
      just register a virConnectDriver instead. This allows
      us to remove all probing of secondary drivers. Once we
      have chosen the primary driver, we immediately know the
      correct secondary drivers to use.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      55ea7be7
  18. 14 1月, 2015 1 次提交
    • D
      Give virDomainDef parser & formatter their own flags · 0ecd6851
      Daniel P. Berrange 提交于
      The virDomainDefParse* and virDomainDefFormat* methods both
      accept the VIR_DOMAIN_XML_* flags defined in the public API,
      along with a set of other VIR_DOMAIN_XML_INTERNAL_* flags
      defined in domain_conf.c.
      
      This is seriously confusing & error prone for a number of
      reasons:
      
       - VIR_DOMAIN_XML_SECURE, VIR_DOMAIN_XML_MIGRATABLE and
         VIR_DOMAIN_XML_UPDATE_CPU are only relevant for the
         formatting operation
       - Some of the VIR_DOMAIN_XML_INTERNAL_* flags only apply
         to parse or to format, but not both.
      
      This patch cleanly separates out the flags. There are two
      distint VIR_DOMAIN_DEF_PARSE_* and VIR_DOMAIN_DEF_FORMAT_*
      flags that are used by the corresponding methods. The
      VIR_DOMAIN_XML_* flags received via public API calls must
      be converted to the VIR_DOMAIN_DEF_FORMAT_* flags where
      needed.
      
      The various calls to virDomainDefParse which hardcoded the
      use of the VIR_DOMAIN_XML_INACTIVE flag change to use the
      VIR_DOMAIN_DEF_PARSE_INACTIVE flag.
      0ecd6851
  19. 03 12月, 2014 1 次提交
    • J
      Replace virDomainFree with virObjectUnref · 8fb3aee2
      John Ferlan 提交于
      Since virDomainFree will call virObjectUnref anyway, let's just use that
      directly so as to avoid the possibility that we inadvertently clear out
      a pending error message when using the public API.
      8fb3aee2
  20. 15 11月, 2014 1 次提交
  21. 23 10月, 2014 1 次提交
  22. 25 3月, 2014 1 次提交
  23. 18 3月, 2014 2 次提交
  24. 11 7月, 2013 1 次提交
  25. 10 7月, 2013 1 次提交
  26. 09 5月, 2013 1 次提交
  27. 02 5月, 2013 1 次提交
    • M
      virutil: Move string related functions to virstring.c · 7c9a2d88
      Michal Privoznik 提交于
      The source code base needs to be adapted as well. Some files
      include virutil.h just for the string related functions (here,
      the include is substituted to match the new file), some include
      virutil.h without any need (here, the include is removed), and
      some require both.
      7c9a2d88
  28. 24 4月, 2013 2 次提交
  29. 02 2月, 2013 1 次提交
  30. 21 12月, 2012 4 次提交