1. 07 4月, 2016 2 次提交
    • J
      secret: Introduce virSecretGetSecretString · 2844de6f
      John Ferlan 提交于
      Commit id 'fb2bd208' essentially copied the qemuGetSecretString
      creating an libxlGetSecretString.  Rather than have multiple copies
      of the same code, create src/secret/secret_util.{c,h} files and
      place the common function in there.
      
      Modify the the build in order to build the module as a library
      which is then pulled in by both the qemu and libxl drivers for
      usage from both qemu_command.c and libxl_conf.c
      2844de6f
    • J
      util: Introduce virRandomBytes · 6af73f53
      John Ferlan 提交于
      Using the existing virUUIDGenerateRandomBytes, move API to virrandom.c
      rename it to virRandomBytes and add it to libvirt_private.syms.
      
      This will be used as a fallback for generating a domain master key.
      6af73f53
  2. 30 3月, 2016 2 次提交
  3. 29 3月, 2016 1 次提交
  4. 21 3月, 2016 2 次提交
    • M
      util: Add virSocketAddrSetIPv[46]AddrNetOrder and use it · 573c41a2
      Martin Kletzander 提交于
      This allows setting the address in host and/or network order and makes
      the naming consistent.  Now you don't need to call [hn]to[nh]l()
      functions as that is taken care of by these functions.  Also, now
      the *NetOrder take the address in network order, the other functions in
      host order so the naming and usage is consistent.  Some places were
      having the address in network order and calling ntohl() just so the
      original function can call htonl() again.  This makes it nicer to read.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      573c41a2
    • C
      domain: Add virDomainDefAddImplicitDevices · 9a423d18
      Cole Robinson 提交于
      It's just a combination of AddImplicitControllers, and AddConsoleCompat.
      Every caller that wants ImplicitControllers also wants the ConsoleCompat
      AFAICT, so lump them together. We also need it for future patches.
      9a423d18
  5. 19 3月, 2016 3 次提交
  6. 09 3月, 2016 2 次提交
    • P
      conf: refactor checking for unsupported memory devices · 185d13b1
      Peter Krempa 提交于
      Introduce a helper to check supported device and domain config and move
      the memory hotplug checks to it.
      
      The advantage of this approach is that by default all new features are
      considered unsupported by all hypervisors unless specifically changed
      rather than the previous approach where every hypervisor would need to
      declare that a given feature is unsupported.
      185d13b1
    • P
      conf: Extract code filling data for virDomainGetVcpuPinInfo · e498e904
      Peter Krempa 提交于
      The implementation of the inner guts of the function is similar for all
      drivers, so we can add a helper and not have to reimplement it three
      times.
      e498e904
  7. 08 3月, 2016 1 次提交
    • J
      Introduce job completed event · f2893001
      Jiri Denemark 提交于
      The VIR_DOMAIN_EVENT_ID_JOB_COMPLETED event will be triggered once a job
      (such as migration) finishes and it will contain statistics for the job
      as one would get by calling virDomainGetJobStats. Thanks to this event
      it is now possible to get statistics of a completed migration of a
      transient domain on the source host.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      f2893001
  8. 03 3月, 2016 1 次提交
    • M
      Drop inline keyword from some functions. · be8b536a
      Michal Privoznik 提交于
      While trying to build with -Os I've encountered some build
      failures.
      
      util/vircommand.c: In function 'virCommandAddEnvFormat':
      util/vircommand.c:1257:1: error: inlining failed in call to 'virCommandAddEnv': call is unlikely and code size would grow [-Werror=inline]
       virCommandAddEnv(virCommandPtr cmd, char *env)
       ^
      util/vircommand.c:1308:5: error: called from here [-Werror=inline]
           virCommandAddEnv(cmd, env);
           ^
      This function is big enough for the compiler to be not inlined.
      This is the error message I'm seeing:
      
      Then virDomainNumatuneNodeSpecified is exported and called from
      other places. It shouldn't be inlined then.
      
      In file included from network/bridge_driver_platform.h:30:0,
                       from network/bridge_driver_platform.c:26:
      network/bridge_driver_linux.c: In function 'networkRemoveRoutingFirewallRules':
      ./conf/network_conf.h:350:1: error: inlining failed in call to 'virNetworkDefForwardIf.constprop': call is unlikely and code size would grow [-Werror=inline]
       virNetworkDefForwardIf(const virNetworkDef *def, size_t n)
       ^
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      be8b536a
  9. 01 3月, 2016 2 次提交
    • H
      qemu_cgroup: use virCgroupAddTask instead of virCgroupMoveTask · ff16bde1
      Henning Schild 提交于
      qemuProcessSetupEmulator runs at a point in time where there is only
      the qemu main thread. Use virCgroupAddTask to put just that one task
      into the emulator cgroup. That patch makes virCgroupMoveTask and
      virCgroupAddTaskStrController obsolete.
      Signed-off-by: NHenning Schild <henning.schild@siemens.com>
      ff16bde1
    • J
      util: Introduce API's for Polkit text authentication · 6fb96a7f
      John Ferlan 提交于
      Introduce virPolkitAgentCreate and virPolkitAgentDestroy
      
      virPolkitAgentCreate will run the polkit pkttyagent image as an asynchronous
      command in order to handle the local agent authentication via stdin/stdout.
      The code makes use of the pkttyagent --notify-fd mechanism to let it know
      when the agent is successfully registered.
      
      virPolkitAgentDestroy will close the command effectively reaping our
      child process
      6fb96a7f
  10. 17 2月, 2016 1 次提交
  11. 16 2月, 2016 1 次提交
  12. 11 2月, 2016 1 次提交
    • M
      dbus: Don't unref NULL messages · 862298a2
      Michal Privoznik 提交于
      Apparently we are not the only ones with dumb free functions
      because dbus_message_unref() does not accept NULL either. But if
      I were to vote, this one is even more evil. Instead of returning
      an error just like we do it immediately dereference any pointer
      passed and thus crash you app. Well done DBus!
      
        Program received signal SIGSEGV, Segmentation fault.
        [Switching to Thread 0x7f878ebda700 (LWP 31264)]
        0x00007f87be4016e5 in ?? () from /usr/lib64/libdbus-1.so.3
        (gdb) bt
        #0  0x00007f87be4016e5 in ?? () from /usr/lib64/libdbus-1.so.3
        #1  0x00007f87be3f004e in dbus_message_unref () from /usr/lib64/libdbus-1.so.3
        #2  0x00007f87bf6ecf95 in virSystemdGetMachineNameByPID (pid=9849) at util/virsystemd.c:228
        #3  0x00007f879761bd4d in qemuConnectCgroup (driver=0x7f87600a32a0, vm=0x7f87600c7550) at qemu/qemu_cgroup.c:909
        #4  0x00007f87976386b7 in qemuProcessReconnect (opaque=0x7f87600db840) at qemu/qemu_process.c:3386
        #5  0x00007f87bf6edfff in virThreadHelper (data=0x7f87600d5580) at util/virthread.c:206
        #6  0x00007f87bb602334 in start_thread (arg=0x7f878ebda700) at pthread_create.c:333
        #7  0x00007f87bb3481bd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
        (gdb) frame 2
        #2  0x00007f87bf6ecf95 in virSystemdGetMachineNameByPID (pid=9849) at util/virsystemd.c:228
        228         dbus_message_unref(reply);
        (gdb) p reply
        $1 = (DBusMessage *) 0x0
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      862298a2
  13. 08 2月, 2016 4 次提交
    • P
      conf: Fix how iothread scheduler info is stored · 6dfb4507
      Peter Krempa 提交于
      Similarly to previous commit change the way how iothread scheduler info
      is stored and clean up a lot of unnecessary code.
      6dfb4507
    • P
      conf: remove unused cpu pinning helpers and data structures · cc715e93
      Peter Krempa 提交于
      Now that the pinning info is stored elsewhere we can delete all the
      obsolete code.
      cc715e93
    • P
      conf: Move and optimize disk target duplicity checking · e84ab793
      Peter Krempa 提交于
      Move the logic from virDomainDiskDefDstDuplicates into
      virDomainDiskDefCheckDuplicateInfo so that we don't have to loop
      multiple times through the array of disks. Since the original function
      was called in qemuBuildDriveDevStr, it was actually called for every
      single disk which was quite wasteful.
      
      Additionally the target uniqueness check needed to be duplicated in
      the disk hotplug case, since the disk was inserted into the domain
      definition after the device string was formatted and thus
      virDomainDiskDefDstDuplicates didn't do anything in that case.
      e84ab793
    • P
      qemu: hotplug: Check duplicate disk serial/wwn on hotplug too · 4f1324aa
      Peter Krempa 提交于
      We do the check on VM start, but the user could still hotplug a disk
      with a conflicting serial or WWN. Reuse the checker function to fix the
      issue.
      4f1324aa
  14. 05 2月, 2016 2 次提交
  15. 04 2月, 2016 1 次提交
    • J
      conf: add net device prefix to capabilities · 819d1d94
      Joao Martins 提交于
      In the reverted commit d2e5538b, the libxl driver was changed to copy
      interface names autogenerated by libxl to the corresponding network def
      in the domain's virDomainDef object. The copied name is freed when the
      domain transitions to the shutoff state. But when migrating a domain,
      the autogenerated name is included in the XML sent to the destination
      host.  It is possible an interface with the same name already exists on
      the destination host, causing migration to fail.
      
      This patch defines a new capability for setting the network device
      prefix that will be used in the driver. Valid prefixes are
      VIR_NET_GENERATED_PREFIX or the one announced by the driver.
      Signed-off-by: NJoao Martins <joao.m.martins@oracle.com>
      819d1d94
  16. 03 2月, 2016 6 次提交
    • 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
    • N
      qemu: qemuDomainRename and virDomainObjListNumOfDomains ABBA deadlock fix · 1e93470d
      Nikolay Shirokovskiy 提交于
      A pretty nasty deadlock occurs while trying to rename a VM in parallel
      with virDomainObjListNumOfDomains.
      The short description of the problem is as follows:
      
      Thread #1:
      
      qemuDomainRename:
          ------> aquires domain lock by qemuDomObjFromDomain
             ---------> waits for domain list lock in any of the listed functions:
                - virDomainObjListFindByName
                - virDomainObjListRenameAddNew
                - virDomainObjListRenameRemove
      
      Thread #2:
      
      virDomainObjListNumOfDomains:
          ------> aquires domain list lock
             ---------> waits for domain lock in virDomainObjListCount
      
      Introduce generic virDomainObjListRename function for renaming domains.
      It aquires list lock in right order to avoid deadlock. Callback is used
      to make driver specific domain updates.
      Signed-off-by: NNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      1e93470d
    • M
      92757d4d
    • P
      conf: Add helper to retrieve bitmap of active vcpus for a definition · 9bf284da
      Peter Krempa 提交于
      In some cases it may be better to have a bitmap representing state of
      individual vcpus rather than iterating the definition. The new helper
      creates a bitmap representing the state from the domain definition.
      9bf284da
  17. 28 1月, 2016 1 次提交
  18. 27 1月, 2016 2 次提交
    • L
      util: keep/use a bitmap of in-use macvtap devices · 370608b4
      Laine Stump 提交于
      This patch creates two bitmaps, one for macvlan device names and one
      for macvtap. The bitmap position is used to indicate that libvirt is
      currently using a device with the name macvtap%d/macvlan%d, where %d
      is the position in the bitmap. When requested to create a new
      macvtap/macvlan device, libvirt will now look for the first clear bit
      in the appropriate bitmap and derive the device name from that rather
      than just starting at 0 and counting up until one works.
      
      When libvirtd is restarted, the qemu driver code that reattaches to
      active domains calls the appropriate function to "re-reserve" the
      device names as it is scanning the status of running domains.
      
      Note that it may seem strange that the retry counter now starts at
      8191 instead of 5. This is because we now don't do a "pre-check" for
      the existence of a device once we've reserved it in the bitmap - we
      move straight to creating it; although very unlikely, it's possible
      that someone has a running system where they have a large number of
      network devices *created outside libvirt* named "macvtap%d" or
      "macvlan%d" - such a setup would still allow creating more devices
      with the old code, while a low retry max in the new code would cause a
      failure. Since the objective of the retry max is just to prevent an
      infinite loop, and it's highly unlikely to do more than 1 iteration
      anyway, having a high max is a reasonable concession in order to
      prevent lots of new failures.
      370608b4
    • D
      lxc: don't try to hide parent cgroups inside container · dc576025
      Daniel P. Berrange 提交于
      On the host when we start a container, it will be
      placed in a cgroup path of
      
         /machine.slice/machine-lxc\x2ddemo.scope
      
      under /sys/fs/cgroup/*
      
      Inside the containers' namespace we need to setup
      /sys/fs/cgroup mounts, and currently will bind
      mount /machine.slice/machine-lxc\x2ddemo.scope on
      the host to appear as / in the container.
      
      While this may sound nice, it confuses applications
      dealing with cgroups, because /proc/$PID/cgroup
      now does not match the directory in /sys/fs/cgroup
      
      This particularly causes problems for systems and
      will make it create repeated path components in
      the cgroup for apps run in the container eg
      
        /machine.slice/machine-lxc\x2ddemo.scope/machine.slice/machine-lxc\x2ddemo.scope/user.slice/user-0.slice/session-61.scope
      
      This also causes any systemd service that uses
      sd-notify to fail to start, because when systemd
      receives the notification it won't be able to
      identify the corresponding unit it came from.
      In particular this break rabbitmq-server startup
      
      Future kernels will provide proper cgroup namespacing
      which will handle this problem, but until that time
      we should not try to play games with hiding parent
      cgroups.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      dc576025
  19. 25 1月, 2016 1 次提交
  20. 21 1月, 2016 1 次提交
  21. 12 1月, 2016 1 次提交
    • L
      qemu: define virDomainDevAddUSBController() · 8ebca27b
      Laine Stump 提交于
      This new function will add a single controller of the given model,
      except the case of ich9-usb-ehci1 (the master controller for a USB2
      controller set) in which case a set of related controllers will be
      added (EHCI1, UHCI1, UHCI2, UHCI3). These controllers will not be
      given PCI addresses, but should be otherwise ready to use.
      
      "-1" is allowed for controller model, and means "default for this
      machinetype". This matches the existing practice in
      qemuDomainDefPostParse(), which always adds the default controller
      with model = -1, and relies on the commandline builder to set a model
      (that is wrong, but will be fixed later).
      8ebca27b
  22. 21 12月, 2015 1 次提交
    • A
      pci: Introduce virPCIStubDriver enumeration · 6d9cdd2a
      Andrea Bolognani 提交于
      This replaces the virPCIKnownStubs string array that was used
      internally for stub driver validation.
      
      Advantages:
      
        * possible values are well-defined
        * typos in driver names will be detected at compile time
        * avoids having several copies of the same string around
        * no error checking required when setting / getting value
      
      The names used mirror those in the
      virDomainHostdevSubsysPCIBackendType enumeration.
      6d9cdd2a
  23. 17 12月, 2015 1 次提交