1. 03 2月, 2016 3 次提交
    • E
      util: Export remoteSerializeTypedParameters internally via util · 8cd1d546
      Erik Skultety 提交于
      Same as for deserializer, this method might get handy for admin one day.
      The major reason for this patch is to stay consistent with idea, i.e.
      when deserializer can be shared, why not serializer as well. The only
      problem to be solved was that the daemon side serializer uses a code
      snippet which handles sparse arrays returned by some APIs as well as
      removes any string parameters that can't be returned to older clients.
      This patch makes of the new virTypedParameterRemote datatype introduced
      by one of the pvious patches.
      8cd1d546
    • E
      util: Export remoteFreeTypedParameters internally via util · 9afc115f
      Erik Skultety 提交于
      Since the method is static to remote_driver, it can't even be used by our
      daemon. Other than that, it would be useful to be able to use it with admin as
      well. This patch uses the new virTypedParameterRemote datatype introduced in
      one of previous patches.
      9afc115f
    • E
      util: Export remoteDeserializeTypedParameters internally via util · 0472cef6
      Erik Skultety 提交于
      Currently, the deserializer is hardcoded into remote_driver which makes
      it impossible for admin to use it. One way to achieve a shared implementation
      (besides moving the code to another module) would be pass @ret_params_val as a
      void pointer as opposed to the remote_typed_param pointer and add a new extra
      argument specifying which of those two protocols is being used and typecast
      the pointer at the function entry. An example from remote_protocol:
      
      struct remote_typed_param_value {
              int type;
              union {
                      int i;
                      u_int ui;
                      int64_t l;
                      uint64_t ul;
                      double d;
                      int b;
                      remote_nonnull_string s;
              } remote_typed_param_value_u;
      };
      typedef struct remote_typed_param_value remote_typed_param_value;
      
      struct remote_typed_param {
              remote_nonnull_string field;
              remote_typed_param_value value;
      };
      
      That would leave us with a bunch of if-then-elses that needed to be used across
      the method. This patch takes the other approach using the new datatype
      introduced in one of earlier commits.
      0472cef6
  2. 29 1月, 2016 1 次提交
  3. 21 12月, 2015 1 次提交
    • E
      Revert "admin: Rename virAdmConnect to virAdmDaemon" · 3245e178
      Erik Skultety 提交于
      Commmit df8192aa introduced admin related rename and some minor
      (caused by automated approach, aka sed) and some more severe isues along with
      it. First reason to revert is the inconsistency with libvirt library.
      Although we deal with the daemon directly rather than with a specific
      hypervisor, we still do have a connection. That being said, contributors might
      get under the impression that AdmDaemonNew would spawn/start a new daemon
      (since it's admin API, why not...), or AdmDaemonClose would do the exact
      opposite or they might expect DaemonIsAlive report overall status of the daemon
      which definitely isn't the case.
      The second reason to revert this patch is renaming virt-admin client. The
      client tool does not necessarily have to reflect the names of the API's it's
      using in his internals. An example would be 's/vshAdmConnect/vshAdmDaemon'
      where noone can be certain of what the latter function really does. The former
      is quite expressive about some connection magic it performs, but the latter does
      not say anything, especially when vshAdmReconnect and vshAdmDisconnect were
      left untouched.
      3245e178
  4. 01 12月, 2015 1 次提交
    • M
      admin: Rename virAdmConnect to virAdmDaemon · df8192aa
      Martin Kletzander 提交于
      virAdmConnect was named after virConnect, but after some discussions,
      most of the APIs called will be working with remote daemon and starting
      them virAdmDaemon will make more sense.  Only possibly controversal name
      is CloseCallback (de)registration, and connecting to the daemon (which
      will still be Open/Close), but even this makes sense if one thinks about
      the daemon being opened and closed, e.g. as file, etc.
      
      This way all the APIs working with the daemon will start with
      virAdmDaemon prefix, they will accept virAdmDaemonPtr as first parameter
      and that will better suit with other namings as well (virDomain*,
      virAdmServer*, etc.).
      
      Because in virt-admin, the connection name does not refer to a struct
      that would have a connect in its name, also adjust 'connname' in
      clients.  And because it is not used anywhere in the vsh code, move it
      from there into each client.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      df8192aa
  5. 30 11月, 2015 1 次提交
    • E
      admin: Introduce virAdmConnectGetLibVersion · a474371f
      Erik Skultety 提交于
      Introduce a new API to get libvirt version. It is worth noting, that
      libvirt-admin and libvirt share the same version number. Unfortunately,
      our existing API isn't generic enough to be used with virAdmConnectPtr
      as well. Also this patch wires up this API to the virt-admin client
      as a generic cmdVersion command.
      a474371f
  6. 16 6月, 2015 1 次提交
  7. 14 5月, 2015 1 次提交
  8. 26 3月, 2015 1 次提交
  9. 25 3月, 2015 1 次提交
  10. 12 3月, 2015 1 次提交
  11. 06 3月, 2015 1 次提交
  12. 03 12月, 2014 1 次提交
  13. 24 11月, 2014 1 次提交
  14. 07 11月, 2014 1 次提交
  15. 26 8月, 2014 1 次提交
    • E
      maint: drop spurious semicolons · 28de556d
      Eric Blake 提交于
      I noticed a line 'int nparams = 0;;' in remote_dispatch.h, and
      tracked down where it was generated.  While at it, I found a
      couple of other double semicolons.  Additionally, I noticed that
      commit df0b57a9 left a stale reference to the file name
      remote_dispatch_bodies.h.
      
      * src/conf/numatune_conf.c (virDomainNumatuneNodeParseXML): Drop
      empty statement.
      * tests/virdbustest.c (testMessageStruct, testMessageSimple):
      Likewise.
      * src/rpc/gendispatch.pl (remote_dispatch_bodies.h): Likewise, and
      update stale comments.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      28de556d
  16. 24 6月, 2014 1 次提交
    • N
      net-dhcp-leases: Implement the remote protocol · 990c3b65
      Nehal J Wani 提交于
      Implement RPC calls for virNetworkGetDHCPLeases, virNetworkGetDHCPLeasesForMAC
      
      daemon/remote.c
         * Define remoteSerializeNetworkDHCPLeases,
                  remoteDispatchNetworkGetDHCPLeases
         * Define remoteDispatchNetworkGetDHCPLeasesForMAC
         * Define helper function remoteSerializeDHCPLease
      
      src/remote/remote_driver.c
         * Define remoteNetworkGetDHCPLeases
         * Define remoteNetworkGetDHCPLeasesForMAC
         * Define helper function remoteSerializeDHCPLease
      
      src/remote/remote_protocol.x
         * New RPC procedure: REMOTE_PROC_NETWORK_GET_DHCP_LEASES
         * Define structs remote_network_dhcp_leases, remote_network_get_dhcp_leases_args,
                          remote_network_get_dhcp_leases_ret
         * New RPC procedure: REMOTE_PROC_NETWORK_GET_DHCP_LEASES_FOR_MAC
         * Define structs remote_network_dhcp_leases_for_mac, remote_network_get_dhcp_leases_for_mac_args,
                          remote_network_get_dhcp_leases_for_mac_ret
      
      src/remote_protocol-structs
         * New structs added
      
      src/rpc/gendispatch.pl
         * Add exception (s/Dhcp/DHCP) for auto-generating names of the remote functions
           in daemon/remote_dispatch.h
      990c3b65
  17. 07 5月, 2014 1 次提交
  18. 21 3月, 2014 1 次提交
    • E
      qemu: wire up RPC for qemu monitor events · e7708a1c
      Eric Blake 提交于
      These are the first async events in the qemu protocol, so this
      patch looks rather big compared to most RPC additions.  However,
      a large majority of this patch is just mechanical copy-and-paste
      from recently-added network events.  It didn't help that this
      is also the first virConnect rather than virDomain prefix
      associated with a qemu-specific API.
      
      * src/remote/qemu_protocol.x (qemu_*_domain_monitor_event_*): New
      structs and RPC messages.
      * src/rpc/gendispatch.pl: Adjust naming conventions.
      * daemon/libvirtd.h (daemonClientPrivate): Track qemu events.
      * daemon/remote.c (remoteClientFreeFunc): Likewise.
      (remoteRelayDomainQemuMonitorEvent)
      (qemuDispatchConnectDomainMonitorEventRegister)
      (qemuDispatchConnectDomainMonitorEventDeregister): New functions.
      * src/remote/remote_driver.c (qemuEvents): Handle qemu events.
      (doRemoteOpen): Register for events.
      (remoteNetworkBuildEventLifecycle)
      (remoteConnectDomainQemuMonitorEventRegister)
      (remoteConnectDomainQemuMonitorEventDeregister): New functions.
      * src/qemu_protocol-structs: Regenerate.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e7708a1c
  19. 10 8月, 2013 1 次提交
  20. 08 8月, 2013 1 次提交
    • D
      Add info about access control checks into API reference · 664ab280
      Daniel P. Berrange 提交于
      So that app developers / admins know what access control checks
      are performed for each API, this patch extends the API docs
      generator to include details of the ACLs for each.
      
      The gendispatch.pl script is extended so that it generates
      a simple XML describing ACL rules, eg.
      
        <aclinfo>
          ...
          <api name='virConnectNumOfDomains'>
            <check object='connect' perm='search_domains'/>
            <filter object='domain' perm='getattr'/>
          </api>
          <api name='virDomainAttachDeviceFlags'>
            <check object='domain' perm='write'/>
            <check object='domain' perm='save' flags='!VIR_DOMAIN_AFFECT_CONFIG|VIR_DOMAIN_AFFECT_LIVE'/>
            <check object='domain' perm='save' flags='VIR_DOMAIN_AFFECT_CONFIG'/>
          </api>
          ...
        </aclinfo>
      
      The newapi.xsl template loads the XML files containing the ACL
      rules and generates a short block of HTML for each API describing
      the parameter checks and return value filters (if any).
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      664ab280
  21. 11 7月, 2013 1 次提交
  22. 10 7月, 2013 1 次提交
  23. 03 7月, 2013 1 次提交
  24. 24 6月, 2013 2 次提交
    • D
      Auto-generate helpers for checking access control rules · 68602622
      Daniel P. Berrange 提交于
      Extend the 'gendispatch.pl' script to be able to generate
      three new types of file.
      
      - 'aclheader' - defines signatures of helper APIs for
        doing authorization checks. There is one helper API
        for each API requiring an auth check. Any @acl
        annotations result in a method being generated with
        a suffix of 'EnsureACL'. If the ACL check requires
        examination of flags, an extra 'flags' param will be
        present. Some examples
      
        extern int virConnectBaselineCPUEnsureACL(void);
        extern int virConnectDomainEventDeregisterEnsureACL(virDomainDefPtr domain);
        extern int virDomainAttachDeviceFlagsEnsureACL(virDomainDefPtr domain, unsigned int flags);
      
        Any @aclfilter annotations resuilt in a method being
        generated with a suffix of 'CheckACL'.
      
        extern int virConnectListAllDomainsCheckACL(virDomainDefPtr domain);
      
        These are used for filtering individual objects from APIs
        which return a list of objects
      
      - 'aclbody' - defines the actual implementation of the
        methods described above. This calls into the access
        manager APIs. A complex example:
      
          /* Returns: -1 on error (denied==error), 0 on allowed */
          int virDomainAttachDeviceFlagsEnsureACL(virConnectPtr conn,
                                                  virDomainDefPtr domain,
                                                  unsigned int flags)
          {
              virAccessManagerPtr mgr;
              int rv;
      
              if (!(mgr = virAccessManagerGetDefault()))
                  return -1;
      
              if ((rv = virAccessManagerCheckDomain(mgr,
                                                    conn->driver->name,
                                                    domain,
                                                    VIR_ACCESS_PERM_DOMAIN_WRITE)) <= 0) {
                  virObjectUnref(mgr);
                  if (rv == 0)
                      virReportError(VIR_ERR_ACCESS_DENIED, NULL);
                  return -1;
              }
              if (((flags & (VIR_DOMAIN_AFFECT_CONFIG|VIR_DOMAIN_AFFECT_LIVE)) == 0) &&
                  (rv = virAccessManagerCheckDomain(mgr,
                                                    conn->driver->name,
                                                    domain,
                                                    VIR_ACCESS_PERM_DOMAIN_SAVE)) <= 0) {
                  virObjectUnref(mgr);
                  if (rv == 0)
                      virReportError(VIR_ERR_ACCESS_DENIED, NULL);
                  return -1;
              }
              if (((flags & (VIR_DOMAIN_AFFECT_CONFIG)) == (VIR_DOMAIN_AFFECT_CONFIG)) &&
                  (rv = virAccessManagerCheckDomain(mgr,
                                                    conn->driver->name,
                                                    domain,
                                                    VIR_ACCESS_PERM_DOMAIN_SAVE)) <= 0) {
                  virObjectUnref(mgr);
                  if (rv == 0)
                      virReportError(VIR_ERR_ACCESS_DENIED, NULL);
                  return -1;
              }
              virObjectUnref(mgr);
              return 0;
          }
      
      - 'aclsyms' - generates a linker script to export the
         APIs to drivers. Some examples
      
        virConnectBaselineCPUEnsureACL;
        virConnectCompareCPUEnsureACL;
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      68602622
    • D
      Add ACL annotations to all RPC messages · e341435e
      Daniel P. Berrange 提交于
      Introduce annotations to all RPC messages to declare what
      access control checks are required. There are two new
      annotations defined:
      
       @acl: <object>:<permission>
       @acl: <object>:<permission>:<flagname>
      
        Declare the access control requirements for the API. May be repeated
        multiple times, if multiple rules are required.
      
          <object> is one of 'connect', 'domain', 'network', 'storagepool',
                   'interface', 'nodedev', 'secret'.
          <permission> is one of the permissions in access/viraccessperm.h
          <flagname> indicates the rule only applies if the named flag
          is set in the API call
      
       @aclfilter: <object>:<permission>
      
        Declare an access control filter that will be applied to a list
        of objects being returned by an API. This allows the returned
        list to be filtered to only show those the user has permissions
        against
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      e341435e
  25. 23 5月, 2013 1 次提交
  26. 21 5月, 2013 1 次提交
    • E
      maint: use LGPL correctly · d7f53c7b
      Eric Blake 提交于
      Several files called out COPYING or COPYING.LIB instead of using
      the normal boilerplate.  It's especially important that we don't
      call out COPYING from an LGPL file, since COPYING is traditionally
      used for the GPL.  A few files were lacking copyright altogether.
      
      * src/rpc/gendispatch.pl: Add missing copyright.
      * Makefile.nonreentrant: Likewise.
      * src/check-symfile.pl: Likewise.
      * src/check-symsorting.pl: Likewise.
      * src/driver.h: Likewise.
      * src/internal.h: Likewise.
      * tools/libvirt-guests.sh.in: Likewise.
      * tools/virt-pki-validate.in: Mention copyright in comment, not just code.
      * tools/virt-sanlock-cleanup.in: Likewise.
      * src/rpc/genprotocol.pl: Spell out license terms.
      * src/xen/xend_internal.h: Likewise.
      * src/xen/xend_internal.c: Likewise.
      * Makefile.am: Likewise.
      * daemon/Makefile.am: Likewise.
      * docs/Makefile.am: Likewise.
      * docs/schemas/Makefile.am: Likewise.
      * examples/apparmor/Makefile.am: Likewise.
      * examples/domain-events/events-c/Makefile.am: Likewise.
      * examples/dominfo/Makefile.am: Likewise.
      * examples/domsuspend/Makefile.am: Likewise.
      * examples/hellolibvirt/Makefile.am: Likewise.
      * examples/openauth/Makefile.am: Likewise.
      * examples/python/Makefile.am: Likewise.
      * examples/systemtap/Makefile.am: Likewise.
      * examples/xml/nwfilter/Makefile.am: Likewise.
      * gnulib/lib/Makefile.am: Likewise.
      * gnulib/tests/Makefile.am: Likewise.
      * include/Makefile.am: Likewise.
      * include/libvirt/Makefile.am: Likewise.
      * python/Makefile.am: Likewise.
      * python/tests/Makefile.am: Likewise.
      * src/Makefile.am: Likewise.
      * tests/Makefile.am: Likewise.
      * tools/Makefile.am: Likewise.
      * configure.ac: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d7f53c7b
  27. 03 5月, 2013 1 次提交
  28. 24 4月, 2013 4 次提交
  29. 23 4月, 2013 1 次提交
  30. 23 2月, 2013 1 次提交
  31. 12 2月, 2013 1 次提交
    • O
      remote: Wire up the remote protocol · 39758e75
      Osier Yang 提交于
      Like virNodeDeviceCreateXML, virNodeDeviceLookupSCSIHostByWWN
      has to be treated specially when generating the RPC codes. Also
      new rules are added in fixup_name to keep the name SCSIHostByWWN.
      39758e75
  32. 18 1月, 2013 1 次提交
  33. 28 11月, 2012 1 次提交
  34. 18 9月, 2012 1 次提交
    • E
      blockjob: add blockcommit support to rpc · 85edb0c8
      Eric Blake 提交于
      Relatively straightforward.  Our decision to make block job
      speed a long keeps haunting us on new API.
      
      * src/remote/remote_protocol.x (remote_domain_block_commit_args):
      New struct.
      * src/remote/remote_driver.c (remote_driver): Enable it.
      * src/remote_protocol-structs: Regenerate.
      * src/rpc/gendispatch.pl (long_legacy): Exempt another bandwidth.
      85edb0c8