1. 19 3月, 2016 1 次提交
  2. 16 3月, 2016 1 次提交
    • E
      virlog: Refactor virLogParseOutputs · 0b231195
      Erik Skultety 提交于
      The problem with the original virLogParseOutputs method was that the way it
      parsed the input, walking the string char by char and using absolute jumps
      depending on the virLogDestination type, was rather complicated to read.
      This patch utilizes virStringSplit method twice, first time to filter out any
      spaces and split the input to individual log outputs and then for each
      individual output to tokenize it by to the parts according to our
      PRIORITY:DESTINATION?(:DATA) format. Also, to STREQLEN for matching destination
      was replaced with virDestinationTypeFromString call.
      0b231195
  3. 11 3月, 2016 1 次提交
  4. 17 2月, 2016 5 次提交
  5. 11 2月, 2016 1 次提交
    • J
      qemu: Split the command parsing routines into own module · d860b2f5
      John Ferlan 提交于
      Extract out the qemuParseCommandLine{String|Pid} into their own
      separate module - taking with it all the various static functions.
      
      Causes a ripple effect with a few other modules to include the
      new qemu_parse_command.h.
      
      Narrowed down the list of #include's in the split out module to
      those that are necessary for build.
      d860b2f5
  6. 30 11月, 2015 3 次提交
    • 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
    • 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
    • E
      virt-admin: Introduce first working skeleton · 64095787
      Erik Skultety 提交于
      This patch introduces virt-admin client which is based on virsh client,
      but had to reimplement several methods to meet virt-admin specific needs
      or remove unnecessary virsh specific logic.
      64095787
  7. 26 11月, 2015 4 次提交
    • D
      logging: add client for virtlogd daemon · 37ed4224
      Daniel P. Berrange 提交于
      Add the virLogManager API which allows for communication with
      the virtlogd daemon to RPC program. This provides the client
      side API to open log files for guest domains.
      
      The virtlogd daemon is setup to auto-spawn on first use when
      running unprivileged. For privileged usage, systemd socket
      activation is used instead.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      37ed4224
    • D
      logging: introduce log handling protocol · 19e5db4a
      Daniel P. Berrange 提交于
      Define a new RPC protocol for the virtlogd daemon that provides
      for handling of logs. The initial RPC method defined allows a
      client to obtain a file handle to use for writing to a log
      file for a guest domain. The file handle passed back will not
      actually refer to the log file, but rather an anonymous pipe.
      The virtlogd daemon will forward I/O between them, ensuring
      file rotation happens when required.
      
      Initially the log setup is hardcoded to cap log files at
      128 KB, and keep 3 backups when rolling over, which gives
      a max usage of 512 KB per guest.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      19e5db4a
    • D
      Import stripped down virtlockd code as basis of virtlogd · 323a329b
      Daniel P. Berrange 提交于
      Copy the virtlockd codebase across to form the initial virlogd
      code. Simple search & replace of s/lock/log/ and gut the remote
      protocol & dispatcher. This gives us a daemon that starts up
      and listens for connections, but does nothing with them.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      323a329b
    • D
      util: add APIs for reading/writing from/to rotating files · 910e65d9
      Daniel P. Berrange 提交于
      Add virRotatingFileReader and virRotatingFileWriter objects
      which allow reading & writing from/to files with automation
      rotation to N backup files when a size limit is reached. This
      is useful for guest logging when a guaranteed finite size
      limit is required. Use of external tools like logrotate is
      inadequate since it leaves the possibility for guest to DOS
      the host in between invokations of logrotate.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      910e65d9
  8. 06 10月, 2015 2 次提交
  9. 26 8月, 2015 1 次提交
    • I
      lxc: Inherit namespace feature · c27553b6
      ik.nitk 提交于
      This patch adds feature for lxc containers to inherit namespaces.
      This is very similar to what lxc-tools or docker provides.  Look
      for "man lxc-start" and you will find that you can pass command
      args as [ --share-[net|ipc|uts] name|pid ]. Or check out docker
      networking option in which you can give --net=container:NAME_or_ID
      as an option for sharing +namespace.
      
      >From this patch you can add extra libvirt option to share
      namespace in following way.
      
       <lxc:namespace>
         <lxc:sharenet type='netns' value='red'/>
         <lxc:shareipc type='pid' value='12345'/>
         <lxc:shareuts type='name' value='container1'/>
       </lxc:namespace>
      
      The netns option is specific to sharenet. It can be used to
      inherit from existing network namespace.
      
      Co-authored: Daniel P. Berrange <berrange@redhat.com>
      c27553b6
  10. 14 8月, 2015 1 次提交
    • E
      tools: Introduce new client generic module vsh · 834c5720
      Erik Skultety 提交于
      In order to share as much virsh' logic as possible with upcomming
      virt-admin client we need to split virsh logic into virsh specific and
      client generic features.
      
      Since majority of virsh methods should be generic enough to be used by
      other clients, it's much easier to rename virsh specific data to virshX
      than doing this vice versa. It moved generic virsh commands (including info
      and opts structures) to generic module vsh.c.
      
      Besides renaming methods and structures, this patch also involves introduction
      of a client specific control structure being referenced as private data in the
      original control structure, introduction of a new global vsh Initializer,
      which currently doesn't do much, but there is a potential for added
      functionality in the future.
      Lastly it introduced client hooks which are especially necessary during
      client connecting phase.
      834c5720
  11. 05 8月, 2015 1 次提交
  12. 19 6月, 2015 1 次提交
  13. 17 6月, 2015 1 次提交
  14. 16 6月, 2015 5 次提交
    • M
      Revert "admin: Add virAdmHello function" · 2cc6c652
      Martin Kletzander 提交于
      This reverts commit 5792fabb.
      
      I mistakenly pushed it along with the Admin API series.
      2cc6c652
    • M
      admin: Add virAdmHello function · 5792fabb
      Martin Kletzander 提交于
      Just one of the simplest functions that returns string "Clients: X"
      where X is the number of connected clients to daemon's first
      subserver (the original one), so it can be tested using virsh, ipython,
      etc.
      
      The subserver is gathered by incrementing its reference
      counter (similarly to getting qemu capabilities), so there is no
      deadlock with admin subserver in this API.
      
      Here you can see how functions should be named in the client (virAdm*)
      and server (adm*).
      
      There is also a parameter @flags that must be 0, which helps testing
      proper error propagation into the client.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      5792fabb
    • M
      Add support for admin API in libvirt daemon · d5f4241b
      Martin Kletzander 提交于
      For this to pe properly separated from other protocols used by the
      server, there is second server added which allows access to the whole
      virNetDaemon to its clients.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      d5f4241b
    • M
      Add libvirt-admin library · 55e0c840
      Martin Kletzander 提交于
      Initial scratch of the admin library.  It has its own virAdmConnectPtr
      that inherits from virAbstractConnectPtr and thus trivially supports
      error reporting.
      
      There's pkg-config file added and spec-file adjusted as well.
      
      Since the library should be "minimalistic" and not depend on any other
      library, the list of files is especially crafted for it.  Most of them
      could've been put to it's own sub-libraries that would be LIBADD'd to
      libvirt_util, libvirt_net_rpc and libvirt_setuid_rpc_client to minimize
      the number of object files being built, but that's a refactoring that
      isn't the orginal aim of this commit.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      55e0c840
    • M
      Move daemon-related parts of virNetServer to virNetDaemon · fa142073
      Martin Kletzander 提交于
      This allows to have more servers in one daemon which helps isolating
      some resources.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      fa142073
  15. 29 4月, 2015 1 次提交
    • M
      qemuBlockJobSync*: introduce sync block job helpers · 89a5e25d
      Michael Chapman 提交于
      qemuBlockJobSyncBegin and qemuBlockJobSyncEnd delimit a region of code
      where block job events are processed "synchronously".
      qemuBlockJobSyncWait and qemuBlockJobSyncWaitWithTimeout wait for an
      event generated by a block job.
      
      The Wait* functions may be called multiple times while the synchronous
      block job is active. Any pending block job event will be processed by
      only when Wait* or End is called.  disk->blockJobStatus is reset by
      these functions, so if it is needed a pointer to a
      virConnectDomainEventBlockJobStatus variable should be passed as the
      last argument. It is safe to pass NULL if you do not care about the
      block job status.
      
      All functions assume the VM object is locked. The Wait* functions will
      unlock the object for as long as they are waiting. They will return -1
      and report an error if the domain exits before an event is received.
      
      Typical use is as follows:
      
        virQEMUDriverPtr driver;
        virDomainObjPtr vm; /* locked */
        virDomainDiskDefPtr disk;
        virConnectDomainEventBlockJobStatus status;
      
        qemuBlockJobSyncBegin(disk);
      
        ... start block job ...
      
        if (qemuBlockJobSyncWait(driver, vm, disk, &status) < 0) {
            /* domain died while waiting for event */
            ret = -1;
            goto error;
        }
      
        ... possibly start other block jobs
            or wait for further events ...
      
        qemuBlockJobSyncEnd(driver, vm, disk, NULL);
      
      To perform other tasks periodically while waiting for an event:
      
        virQEMUDriverPtr driver;
        virDomainObjPtr vm; /* locked */
        virDomainDiskDefPtr disk;
        virConnectDomainEventBlockJobStatus status;
        unsigned long long timeout = 500 * 1000ull; /* milliseconds */
      
        qemuBlockJobSyncBegin(disk);
      
        ... start block job ...
      
        do {
            ... do other task ...
      
            if (qemuBlockJobSyncWaitWithTimeout(driver, vm, disk,
                                                timeout, &status) < 0) {
                /* domain died while waiting for event */
                ret = -1;
                goto error;
            }
        } while (status == -1);
      
        qemuBlockJobSyncEnd(driver, vm, disk, NULL);
      Signed-off-by: NMichael Chapman <mike@very.puzzling.org>
      89a5e25d
  16. 25 3月, 2015 2 次提交
  17. 18 3月, 2015 1 次提交
  18. 21 2月, 2015 1 次提交
    • P
      conf: Move numatune_conf to numa_conf · fcee64e7
      Peter Krempa 提交于
      For a while now there are two places that gather information about NUMA
      related guest configuration. While the XML can't be changed we can at
      least store the data in one place in the definition.
      
      Rename the numatune_conf.[ch] files to numa_conf as later patches will
      move the rest of the definitions from the cpu definition to this one.
      fcee64e7
  19. 26 1月, 2015 1 次提交
    • D
      systemd: fix build without dbus · d13b586a
      Daniel P. Berrange 提交于
      The virDBusMethodCall method has a DBusError as one of its
      parameters. If the caller wants to pass a non-NULL value
      for this, it immediately makes the calling code require
      DBus at build time. This has led to breakage of non-DBus
      builds several times. It is desirable that only the virdbus.c
      file should need WITH_DBUS conditionals, so we must ideally
      remove the DBusError parameter from the method.
      
      We can't simply raise a libvirt error, since the whole point
      of this parameter is to give the callers a way to check if
      the error is one they want to ignore, without having the logs
      polluted with an error message. So, we add a virErrorPtr
      parameter which the caller can then either ignore or raise
      using the new virReportErrorObject method.
      
      This new method is distinct from virSetError in that it
      ensures the logging hooks are run.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d13b586a
  20. 16 1月, 2015 1 次提交
  21. 15 1月, 2015 1 次提交
    • D
      Add support for systemd-machined CreateMachineWithNetwork · 318df5a0
      Daniel P. Berrange 提交于
      systemd-machined introduced a new method CreateMachineWithNetwork
      that obsoletes CreateMachine. It expects to be given a list of
      VETH/TAP device indexes for the host side device(s) associated
      with a container/machine.
      
      This falls back to the old CreateMachine method when the new
      one is not supported.
      318df5a0
  22. 14 1月, 2015 1 次提交
    • J
      Introduce support for parsing/formatting Xen xl config format · 4689cdf7
      Jim Fehlig 提交于
      Introduce a parser/formatter for the xl config format.  Since the
      deprecation of xm/xend, the VM config file format has diverged as
      new features are added to libxl.  This patch adds support for parsing
      and formating the xl config format.  It supports the existing xm config
      format, plus adds support for spice graphics and xl disk config syntax.
      
      Disk config is specified a bit differently in xl as compared to xm.  In
      xl, disk config consists of comma-separated positional parameters and
      keyword/value pairs separated by commas. Positional parameters are
      specified as follows
      
         target, format, vdev, access
      
      Supported keys for key=value options are
      
        devtype, backendtype
      
      The positional paramters can also be specified in key/value form.  For
      example the following xl disk config are equivalent
      
          /dev/vg/guest-volume,,hda
          /dev/vg/guest-volume,raw,hda,rw
          format=raw, vdev=hda, access=rw, target=/dev/vg/guest-volume
      
      See $xen_sources/docs/misc/xl-disk-configuration.txt for more details.
      
      xl disk config is parsed with the help of xlu_disk_parse() from
      libxlutil, libxl's utility library.  Although the library exists
      in all Xen versions supported by the libxl virt driver, only
      recently has the corresponding header file been included.  A check
      for the header is done in configure.ac.  If not found, xlu_disk_parse()
      is declared externally.
      Signed-off-by: NKiarie Kahurani <davidkiarie4@gmail.com>
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      4689cdf7
  23. 13 1月, 2015 1 次提交
  24. 04 1月, 2015 1 次提交
    • K
      src/xenconfig: Xen-xl parser · 2c78051a
      Kiarie Kahurani 提交于
      Introduce a Xen xl parser
      
      This parser allows for users to convert the new xl disk format and
      spice graphics config to libvirt xml format and vice versa. Regarding
      the spice graphics config, the code is pretty much straight forward.
      For the disk {formating, parsing}, this parser takes care of the new
      xl format which include positional parameters and key/value parameters.
      In xl format disk config a <diskspec> consists of parameters separated by
      commas. If the parameters do not contain an '=' they are automatically
      assigned to certain options following the order below
      
         target, format, vdev, access
      
      The above are the only mandatory parameters in the <diskspec> but there
      are many more disk config options. These options can be specified as
      key=value pairs. This takes care of the rest of the options such as
      
        devtype, backend, backendtype, script, direct-io-safe,
      
      The positional paramters can also be specified in key/value form
      for example
      
          /dev/vg/guest-volume,,hda
          /dev/vg/guest-volume,raw,hda,rw
          format=raw, vdev=hda, access=rw, target=/dev/vg/guest-volume
      
      are interpleted to one config.
      
      In xm format, the above diskspec would be written as
      
      phy:/dev/vg/guest-volume,hda,w
      
      The disk parser is based on the same parser used successfully by
      the Xen project for several years now.  Ian Jackson authored the
      scanner, which is used by this commit with mimimal changes.  Only
      the PREFIX option is changed, to produce function and file names
      more consistent with libvirt's convention.
      Signed-off-by: NKiarie Kahurani <davidkiarie4@gmail.com>
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      2c78051a
  25. 04 12月, 2014 1 次提交