1. 16 8月, 2012 2 次提交
    • L
      util: add virNetDevVlanType · cfbdd005
      Laine Stump 提交于
      To allow for the possibility of vlan "trunks", which have more than
      one vlan tag associated with them, we need a vlan struct. Since it
      will be used by multiple files in src/util, src/conf, src/network, and
      src/qemu, it must be defined in src/util. Unfortunately there isn't
      currently a common file for simple netdev data definitions, so I
      created a new file.
      cfbdd005
    • L
      schema: fix some problems in network/interface schemas · e4a199a1
      Laine Stump 提交于
      <portgroup> allows a <bandwidth> element, but the schema didn't have
      this. Since this makes for multiple elements in portgroup, they must
      be interleaved.
      
      <interface type='bridge'> needs to allow <virtualport> elements
      for openvswitch, but the schema didn't allow this.
      e4a199a1
  2. 15 8月, 2012 38 次提交
    • L
      util: include memory.h even if WITH_VIRTUALPORT isn't defined · 5faff3d3
      Laine Stump 提交于
      This caused compilation of virnetdevvportprofile.c to fail on systems
      without IFLA support in netlink (these are netlink commands used to
      configure the VF's of SR-IOV network devices).
      5faff3d3
    • D
      Fix virJSONValueToString prototype for Mingw32 · f376d24e
      Daniel P. Berrange 提交于
      Fix build on platforms lacking YAJL library by adding missing
      'bool pretty' parameter to virJSONValueToString.
      f376d24e
    • D
      Update libvirtd --help output to match code · c7447ab1
      Doug Goldstein 提交于
      Updated the paths that libvirtd --help says are used when run as
      non-root to match what the code actually does.
      c7447ab1
    • D
      Update paths in man page to reflect libvirtd code · 7e2f6683
      Doug Goldstein 提交于
      Updated the paths in the man page to reflect what the code in libvirtd
      does. In addition broke out the FILES section into two subsections for
      files used when run as root and files used when run as non-root.
      Provided information about the defaults that libvirtd uses when running
      as non-root and when XDG_CONFIG_HOME and XDG_RUNTIME_DIR are not set in
      the environment.
      7e2f6683
    • D
      Replace unset REMOTE_PID_FILE with proper value · 910041ba
      Doug Goldstein 提交于
      REMOTE_PID_FILE is no longer used in the source or the build process but
      the man page still used it resulting in no file name being displayed.
      The same value that the libvirtd daemon code uses is now used in the man
      page.
      910041ba
    • D
      Fix man page file paths to real paths · 9cdd73a2
      Doug Goldstein 提交于
      Currently the man page has paths that start with @sysconfdir@,
      @localstatedir@ and @remote_pid_file@. The sed command attempts to
      replace these during the build but unfortunately pod2man gets to the
      files first and escapes the @ character resulting in the sed not
      working. This removes the @ character and makes the paths correct.
      9cdd73a2
    • D
      Refactor RPC client private data setup · 39b5e4d4
      Daniel P. Berrange 提交于
      Currently there is a hook function that is invoked when a
      new client connection comes in, which allows an app to
      setup private data. This setup will make it difficult to
      serialize client state during process re-exec(). Change to
      a model where the app registers a callback when creating
      the virNetServerPtr instance, which is used to allocate
      the client private data immediately during virNetClientPtr
      construction.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      39b5e4d4
    • D
      07143d84
    • D
      Allow sync IO and keepalives to be skipped in RPC client setup · 86f5457d
      Daniel P. Berrange 提交于
      Currently the virNetClientPtr constructor will always register
      the async IO event handler and the keepalive objects. In the
      case of the lock manager, there will be no event loop available
      nor keepalive support required. Split this setup out of the
      constructor and into separate methods.
      
      The remote driver will enable async IO and keepalives, while
      the LXC driver will only enable async IO
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      86f5457d
    • D
      Change interaction when accepting new RPC client connections · 95e49be5
      Daniel P. Berrange 提交于
      Currently the virNetServerServicePtr is responsible for
      creating the virNetServerClientPtr instance when accepting
      a new connection. Change this so that the virNetServerServicePtr
      merely gives virNetServerPtr a virNetSocketPtr instance. The
      virNetServerPtr can then create the virNetServerClientPtr
      as it desires
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      95e49be5
    • D
      Add APIs for virThreadPoolPtr to query some config params · 2241582c
      Daniel P. Berrange 提交于
      It is desirable to be able to query the config params of
      the thread pool, in order to save the server state. Add
      virThreadPoolGetMinWorkers, virThreadPoolGetMaxWorkers
      and virThreadPoolGetPriorityWorkers APIs.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      2241582c
    • D
      Allow control over JSON string pretty printing · ecf00158
      Daniel P. Berrange 提交于
      While the QEMU monitor/agent do not want JSON strings pretty
      printed, other parts of libvirt might. Instead of hardcoding
      QEMU's desired behaviour in virJSONValueToString(), add a
      boolean flag to control pretty printing
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      ecf00158
    • D
      Change function signature for creating new lock manager instances · 4ee86721
      Daniel P. Berrange 提交于
      To allow a virLockManagerPtr to be created directly from a
      driver table struct, replace the virLockManagerPluginPtr parameter
      with a virLockDriverPtr parameter.
      
      * src/locking/domain_lock.c, src/locking/lock_manager.c,
        src/locking/lock_manager.h: Replace plugin param with
        a driver in virLockManagerNew
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      4ee86721
    • D
      Remove unused qemuProcessAutoDestroyRun decl from header · 5f2f8d41
      Daniel P. Berrange 提交于
      The qemuProcessAutoDestroyRun function was removed in an earlier
      commit, but the header file declaration was not deleted
      5f2f8d41
    • D
      9700ca82
    • D
      parallels: cleanup parallelsOpen and fix error message · 9fbefc54
      Dmitry Guryanov 提交于
      Do some cleanup of parallelsOpen, STREQ_NULLABLE can replace
      a lot of checks.
      
      Also fix error message to be VIR_ERR_INTERNAL_ERROR, the same
      as in other drivers.
      Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
      9fbefc54
    • D
      parallels: change URI to parallels:///system · 4aaa5a72
      Dmitry Guryanov 提交于
      Let's change URI to parallels:///system. Parallels Server supports
      creating VMs from non-privileged accounts, but it's not main usage
      scenario and it may be forbidden in the future.
      
      Also containers, which will be supported by the driver, can be managed
      only by root, so /system path is more suitable for this driver.
      Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
      4aaa5a72
    • D
      Adding Sukadev Bhattiprolu · ede82a6c
      Daniel Veillard 提交于
      ede82a6c
    • S
      Update documentation for CPU quota/period support for LXC · 86272449
      Sukadev Bhattiprolu 提交于
      Following commit added suport the CPU quota/period to the LXC driver.
      Update the documentation to reflect that.
      
      	commit d9724a81
      	Author: Daniel P. Berrange <berrange@redhat.com>
      	Date:   Thu Nov 10 12:16:26 2011 +0000
      
      	Add support for CPU quota/period to LXC driver
      Signed-off-by: NSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      86272449
    • O
      virsh: Add helper to avoid the strcase check for virsh-*.c · be023c08
      Osier Yang 提交于
      * tools/virsh.c: New macro vshStrcasecmp
      * tools/virsh-domain-monitor.c: Use vshStrcasecmp instead of
                                      strcasecmp
      * tools/virsh-snapshot.c: Likewise
      * cfg.mk: Only avoid doing strcase checking for virsh.c
      be023c08
    • L
      conf: log error when encountering multiple filterrefs in interface · 1f7a291c
      Laine Stump 提交于
      Each interface has a single pointer to a filterref object. That
      filterref can itself point to multiple other filterrefs, but at the
      toplevel there is only one.
      
      The parser had previously just silently overwritten earlier filterrefs
      when a new one was encountered, so the interface was left with
      whichever was the last filterref in the xml, ignoring all the
      others. This patch logs an error when it sees more than one filterref.
      1f7a291c
    • L
      network: add connections counter to networks · 300bcdb6
      Laine Stump 提交于
      Just as each physical device used by a network has a connections
      counter, now each network has a connections counter which is
      incremented once for each guest interface that connects using this
      network.
      
      The count is output in the live network XML, like this:
      
         <network connections='20'>
         ...
         </network>
      
      It is read-only, and for informational purposes only - it isn't used
      internally anywhere by libvirt.
      300bcdb6
    • L
      network: change cleanup: to success/cleanup/error: in network*() functions · 4fee4e05
      Laine Stump 提交于
      A later patch will be adding a counter that will be
      incremented/decremented each time an guest interface starts/stops
      using a particular network. For this to work, all types of networks
      need to go through a common return sequence rather than returning
      early. To setup for this, a new success: label is added (when
      necessary), a new error: label is added which does any cleanup
      necessary only for error returns and then does goto cleanup, and early
      returns are changed to goto error if it's a failure, or goto success
      if it's successful. This way the intent of all the gotos is
      unambiguous, and a successful return path never encounters the
      "error:" label.
      4fee4e05
    • L
      conf: output forward device connections count in network XML · 92a83040
      Laine Stump 提交于
      It may be useful for management applications to know which physical
      network devices are in use by guests. This information is already
      available in the network objects, but wasn't output in the XML. This
      patch outputs it when the INACTIVE flag isn't set (and if it's non-0).
      92a83040
    • L
      conf: rename interface "usageCount" to "connections" · 643feae7
      Laine Stump 提交于
      I want to include this count in the xml output of networks, but
      calling it "connections" in the XML sounds better than "usageCount", and it
      would be better if the name in the XML matched the variable name.
      
      In a few places, usageCount was being initialized to 0, but this is
      unnecessary, because VIR_ALLOC_N zero-fills everything anyway.
      643feae7
    • L
      conf: use a unique data type for PF array in virDomainNetDef · 95ae4e7f
      Laine Stump 提交于
      This array was originally defined using the existing
      virNetworkForwardIfDef, but that struct has a UsageCount field that
      isn't used in the case of PFs. This patch just copies that struct and
      removes UsageCount. It ends up being a struct with a single field, but
      I left it as a struct in case we need to add other fields to it in the
      future.
      95ae4e7f
    • E
      random: link with -lm when needed · c606671a
      Eric Blake 提交于
      Use of ldexp() requires -lm on some platforms; use gnulib to determine
      this for our makefile.  Also, optimize virRandomInt() for the case
      of a power-of-two limit (actually rather common, given that Daniel
      has a pending patch to replace virRandomBits(10) with code that will
      default to virRandomInt(1024) on default SELinux settings).
      
      * .gnulib: Update to latest, for ldexp.
      * bootstrap.conf (gnulib_modules): Import ldexp.
      * src/Makefile.am (libvirt_util_la_CFLAGS): Link with -lm when
      needed.
      * src/util/virrandom.c (virRandomInt): Optimize powers of 2.
      c606671a
    • L
      network: merge relevant virtualports rather than choosing one · 6a3691b7
      Laine Stump 提交于
      One of the original ideas behind allowing a <virtualport> in an
      interface definition as well as in the <network> definition *and*one
      or more <portgroup>s within the network, was that guest-specific
      parameteres (like instanceid and interfaceid) could be given in the
      interface's virtualport, and more general things (portid, managerid,
      etc) could be given in the network and/or portgroup, with all the bits
      brought together at guest startup time and combined into a single
      virtualport to be used by the guest. This was somehow overlooked in
      the implementation, though - it simply picks the "most specific"
      virtualport, and uses the entire thing, with no attempt to merge in
      details from the others.
      
      This patch uses virNetDevVPortProfileMerge3() to combine the three
      possible virtualports into one, then uses
      virNetDevVPortProfileCheck*() to verify that the resulting virtualport
      type is appropriate for the type of network, and that all the required
      attributes for that type are present.
      
      An example of usage is this: assuming a <network> definitions on host
      ABC of:
      
        <network>
          <name>testA</name>
          ...
          <virtualport type='openvswitch'/>
          ...
          <portgroup name='engineering'>
            <virtualport>
              <parameters profileid='eng'/>
            </virtualport>
          </portgroup>
          <portgroup name='sales'>
            <virtualport>
              <parameters profileid='sales'/>
            </virtualport>
          </portgroup>
        </network>
      
      and the same <network> on host DEF of:
      
        <network>
          <name>testA</name>
          ...
          <virtualport type='802.1Qbg'>
            <parameters typeid="1193047" typeidversion="2"/>
          </virtualport>
          ...
          <portgroup name='engineering'>
            <virtualport>
              <parameters managerid="11"/>
            </virtualport>
          </portgroup>
          <portgroup name='sales'>
            <virtualport>
              <parameters managerid="55"/>
            </virtualport>
          </portgroup>
        </network>
      
      and a guest <interface> definition of:
      
        <interface type='network'>
          <source network='testA' portgroup='sales'/>
          <virtualport>
            <parameters instanceid="09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f"
                        interfaceid="09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f"\>
          </virtualport>
          ...
        </interface>
      
      If the guest was started on host ABC, the <virtualport> used would be:
      
        <virtualport type='openvswitch'>
          <parameters interfaceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'
                      profileid='sales'/>
        </virtualport>
      
      but if that guest was started on host DEF, the <virtualport> would be:
      
          <virtualport type='802.1Qbg'>
            <parameters instanceid="09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f"
                        typeid="1193047" typeidversion="2"
                        managerid="55"/>
          </virtualport>
      
      Additionally, if none of the involved <virtualport>s had a specified type
      (this includes cases where no virtualport is given at all),
      6a3691b7
    • L
      conf: support partially-specified <virtualport> in parser and formatter · 4af3cbaf
      Laine Stump 提交于
      Until now, all attributes in a <virtualport> parameter list that were
      acceptable for a particular type, were also required. There were no
      optional attributes.
      
      One of the aims of supporting <virtualport> in libvirt's virtual
      networks and portgroups is to allow specifying the group-wide
      parameters in the network's virtualport, and merge that with the
      interface's virtualport, which will have the instance-specific info
      (i.e. the interfaceid or instanceid).
      
      Additionally, the guest's interface XML shouldn't need to know what
      type of network connection will be used prior to runtime - it could be
      openvswitch, 802.1Qbh, 802.1Qbg, or none of the above - but should
      still be able to specify instance-specific info just in case it turns
      out to be applicable.
      
      Finally, up to now, the parser for virtualport has always generated a
      random instanceid/interfaceid when appropriate, making it impossible
      to leave it blank (which is what's required for virtualports within a
      network/portprofile definition).
      
      This patch modifies the parser and formatter of the <virtualport>
      element in the following ways:
      
      * because most of the attributes in a virNetDevVPortProfile are fixed
        size binary data with no reserved values, there is no way to embed a
        "this value wasn't specified" sentinel into the existing data. To
        solve this problem, the new *_specified fields in the
        virNetDevVPortProfile object that were added in a previous patch of
        this series are now set when the corresponding attribute is present
        during the parse.
      
      * allow parsing/formatting a <virtualport> that has no type set. In
        this case, all fields are settable, but all are also optional.
      
      * add a GENERATE_MISSING_DEFAULTS flag to the parser - if this flag is
        set and an instanceid/interfaceid is expected but not provided, a
        random one will be generated. This was previously the default
        behavior, but is now done only for virtualports inside an
        <interface> definition, not for those in <network> or <portgroup>.
      
      * add a REQUIRE_ALL_ATTRIBUTES flag to the parser - if this flag is
        set the parser will call the new
        virNetDevVPortProfileCheckComplete() functions at the end of the
        parser to check for any missing attributes (based on type), and
        return failure if anything is missing. This used to be default
        behavior. Now it is only used for the virtualport defined inside an
        interface's <actual> element (by the time you've figured out the
        contents of <actual>, you should have all the necessary data to fill
        in the entire virtualport)
      
      * add a REQUIRE_TYPE flag to the parser - if this flag is set, the
        parser will return an error if the virtualport has no type
        attribute. This also was previously the default behavior, but isn't
        needed in the case of the virtualport for a type='network' interface
        (i.e. the exact type isn't yet known), or the virtualport of a
        portgroup (i.e. the portgroup just has modifiers for the network's
        virtualport, which *does* require a type) - in those cases, the
        check will be done at domain startup, once the final virtualport is
        assembled (this is handled in the next patch).
      4af3cbaf
    • L
      conf: simplify Buffer Indentation in virDomainNetDefFormat · ff1efc09
      Laine Stump 提交于
      This function has several calls to increase the buffer indent by 6,
      then decrease it again, then increase, then decrease. Additionally,
      there were several printfs that had 6 spaces at the beginning of the
      line.
      
      virDomainActualNetDefFormat, which is called by virDomainNetDefFormat,
      had similar ugliness.
      
      This patch changes both functions to just increase the indent at the
      beginning, decrease it at (well, just before*) the end, and remove all
      of the occurences of 6/8 spaces at the beginning of lines.
      
      *The indent had to be reset before the end of the function because
      virDomainDeviceInfoFormat assumes a 0 indent and is called from many
      other places, and I didn't want to do an overhaul of every caller of
      that function. A separate patch to switch all of domain_conf.c would
      be a useful exercise, but my current goal is unrelated to that, so
      I'll leave it for another day.
      ff1efc09
    • L
      conf: make error returns from virDomainActualNetDefFormat consistent · 2841a0ad
      Laine Stump 提交于
      There was an error: label that simply did "return ret", but ret was
      defaulted to -1, and was never used other than setting it manually to
      0 just before a non-error return. Aside from this, some of the error
      return paths used "goto error" and others used "return ret".
      
      This patch removes ret and the error: label, and makes all error
      returns just consistently do "return -1".
      2841a0ad
    • L
      conf: move virtPortProfile out of unions in virDomainNetDef · 1d174428
      Laine Stump 提交于
      virtPortProfile is now used by 4 different types of network devices
      (NETWORK, BRIDGE, DIRECT, and HOSTDEV), and it's getting cumbersome to
      replicate so much code in 4 different places just because each type
      has the virtPortProfile in a slightly different place. This patch puts
      a single virtPortProfile in a common place (outside the type-specific
      union) in both virDomainNetDef and virDomainActualNetDef, and adjusts
      the parse and format code (and the few other places where it is used)
      accordingly.
      
      Note that when a <virtualport> element is found, the parse functions
      verify that the interface is of a type that supports one, otherwise an
      error is generated (CONFIG_UNSUPPORTED in the case of <interface>, and
      INTERNAL in the case of <actual>, since the contents of <actual> are
      always generated by libvirt itself).
      1d174428
    • L
      util: utility functions for virNetDevVPortProfile · 1c02ed14
      Laine Stump 提交于
      This patch adds three utility functions that operate on
      virNetDevVPortProfile objects.
      
      * virNetDevVPortProfileCheckComplete() - verifies that all attributes
          required for the type of the given virtport are specified.
      
      * virNetDevVPortProfileCheckNoExtras() - verifies that there are no
          attributes specified which are inappropriate for the type of the
          given virtport.
      
      * virNetDevVPortProfileMerge3() - merges 3 virtports into a single,
          newly allocated virtport. If any attributes are specified in
          more than one of the three sources, and do not exactly match,
          an error is logged and the function fails.
      
      These new functions depend on new fields in the virNetDevVPortProfile
      object that keep track of whether or not each attribute was
      specified. Since the higher level parse function doesn't yet set those
      fields, these functions are not actually usable yet (but that's okay,
      because they also aren't yet used - all of that functionality comes in
      a later patch.)
      
      Note that these three functions return 0 on success and -1 on
      failure. This may seem odd for the first two Check functions, since
      they could also easily return true/false, but since they actually log
      an error when the requested condition isn't met (and should result in
      a failure of the calling function), I thought 0/-1 was more
      appropriate.
      1c02ed14
    • L
      util: add openvswitch case to virNetDevVPortProfileEqual · 8450d7b2
      Laine Stump 提交于
      This function was overlooked when openvswitch support was
      added. Fortunately it's only use for update-device, which is
      relatively new and seldom-used.
      8450d7b2
    • L
      util: eliminate union in virNetDevVPortProfile · 21ea73e8
      Laine Stump 提交于
      virNetDevVPortProfile has (had) a type field that can be set to one of
      several values, and a union of several structs, one for each
      type. When a domain's interface object is of type "network", the
      domain config may not know beforehand which type of virtualport is
      going to be provided in the actual device handed down from the network
      driver at runtime, but may want to set some values in the virtualport
      that may or may not be used, depending on the type. To support this
      usage, this patch replaces the union of structs with toplevel fields
      in the struct, making it possible for all of the fields to be set at
      the same time.
      21ea73e8
    • L
      util: make return value of virUUIDFormat and virMacAddrFormat useful · 85d9c17d
      Laine Stump 提交于
      Both of these functions returned void, but it's convenient for them to
      return a const char* of the char* that is passed in. This was you can
      call the function and use the result in the same expression/arg.
      85d9c17d
    • E
      build: fix link error with appArmor · 37f3cd41
      Eric Blake 提交于
      Commit bb705e25 missed that the appArmor helper file also needs to
      resolve the new symbols dragged in by domain_conf.c.
      
      * src/Makefile.am (SECURITY_DRIVER_APPARMOR_HELPER_SOURCES): Pull
      in datatypes.c.
      37f3cd41
    • E
      maint: drop a leftover comment line · a40f9e9a
      Eric Blake 提交于
      * tests/viratomictest.c: Fix copy-and-paste bug.
      a40f9e9a