1. 25 2月, 2016 2 次提交
    • O
      Fix bug of attaching redirdev device · c92547c3
      Osier Yang 提交于
      RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1298070
      
      The corresponding chardev must be attached first, otherwise the
      the qemu command line won't be complete (missing the host part),
      c92547c3
    • J
      libxl: implement virDomainInterfaceStats · 77fdd82e
      Joao Martins 提交于
      Introduce support for domainInterfaceStats API call for querying
      network interface statistics. Consequently it also enables the use of
      `virsh domifstat <dom> <interface name>` command plus seeing the
      interfaces names instead of "-" when doing `virsh domiflist <dom>`.
      
      After successful guest creation we fill the network interfaces names
      based on domain, device id and append suffix if it's emulated in the
      following form: vif<domid>.<devid>[-emu].  We extract the network
      interfaces info from the libxl_domain_config object in
      libxlDomainCreateIfaceNames() to generate ifname. On domain cleanup we
      also clear ifname, in case it was set by libvirt (i.e. being prefixed
      with "vif"). We also skip these two steps in case the name of the
      interface was manually inserted by the administrator. Since the
      introduction of netprefix (commit a040ba9e), ifnames with a registered
      prefix will be freed on virDomain{Obj,Def}Format*, thus eliminating
      the migration issues observed with the reverted commit d2e5538b whereas
      source and destination would have the same ifname.
      
      For getting the interface statistics we resort to virNetInterfaceStats
      and let libvirt handle the platform specific nits. Note that the
      latter is not yet supported in FreeBSD.
      Signed-off-by: NJoao Martins <joao.m.martins@oracle.com>
      77fdd82e
  2. 24 2月, 2016 3 次提交
    • C
      libxl: small fix in parsing network · 5c79c445
      Chunyan Liu 提交于
      Signed-off-by: NChunyan Liu <cyliu@suse.com>
      5c79c445
    • E
      rbd: fix 32-bit build · 5a5c2837
      Eric Blake 提交于
      %zu is not always synonymous with uint64_t; on 32-bit machines,
      size_t is only 32 bits.  Prefer "%lld"/'unsigned long long' when
      the variable is under our control, and "%"PRIu64 when we are
      stuck with 'uint64_t' from RBD.
      
      Fixes errors such as:
      
      ../../src/storage/storage_backend_rbd.c: In function 'virStorageBackendRBDVolWipe':
      ../../src/storage/storage_backend_rbd.c:1281:15: error: format '%zu' expects argument of type 'size_t', but argument 8 has type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
           VIR_DEBUG("Need to wipe %zu bytes from RBD image %s/%s",
                     ^
      ../../src/util/virlog.h:90:73: note: in definition of macro 'VIR_DEBUG_INT'
           virLogMessage(src, VIR_LOG_DEBUG, filename, linenr, funcname, NULL, __VA_ARGS__)
                                                                               ^
      ../../src/storage/storage_backend_rbd.c:1281:5: note: in expansion of macro 'VIR_DEBUG'
           VIR_DEBUG("Need to wipe %zu bytes from RBD image %s/%s",
           ^
      Signed-off-by: NEric Blake <eblake@redhat.com>
      5a5c2837
    • J
      libxl: fix bogus indentation from commit fb2bd208 · c23bbfad
      Jim Fehlig 提交于
      c23bbfad
  3. 23 2月, 2016 7 次提交
    • M
      qemuBuildCommandLine: Change the condition for -nographics · 01c31852
      Michal Privoznik 提交于
      There's this check when building command line that whenever
      domain has no graphics card configured we put -nographics onto
      qemu command line. The check is 'if (!def->graphics)'. This
      makes coverity think that def->graphics can be NULL, which is
      true. But later in the code every access to def->graphics is
      guarded by check for def->ngraphics, so no crash occurs. But this
      is something that coverity fails to deduct.
      In order to shut coverity up lets change the condition to
      'if (!def->ngraphics)'.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      01c31852
    • M
      xen: Check return value of virStringReplace · e0392f5a
      Michal Privoznik 提交于
      After 6604a3dd in which new helper function has been
      introduced, the code calls virStringReplace and dereference the
      result immediately. The string function can, however, return NULL
      so this would SIGSEGV right away. Check for the return value of
      the string function.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      e0392f5a
    • M
      vbox: Avoid signed and unsigned comparison · a0e5faaf
      Michal Privoznik 提交于
      After 457ff97f there are two defects in our code. In both of
      them we use a signed variable to hold up a number of snapshots
      that domain has. We use a helper function to count the number.
      However, the helper function may fail in which case it returns
      a negative one and control jumps to cleanup label where an
      unsigned variable is used to iterate over array of snapshots. The
      loop condition thus compare signed and unsigned variables which
      in this specific case ends up badly for us.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      a0e5faaf
    • J
      libxl: add support for rbd qdisk · fb2bd208
      Jim Fehlig 提交于
      xl/libxl already supports qemu's network-based block backends
      such as nbd and rbd. libvirt has supported configuring such
      <disk>s for long time too. This patch adds support for rbd
      disks in the libxl driver by generating a rbd device URL from
      the virDomainDiskDef object. The URL is passed to libxl via the
      pdev_path field of libxl_device_disk struct. libxl then passes
      the URL to qemu for cosumption by the rbd backend.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      fb2bd208
    • J
      xenconfig: support xl<->xml conversion of rbd disk devices · 6604a3dd
      Jim Fehlig 提交于
      The target= setting in xl disk configuration can be used to encode
      meta info that is meaningful to a backend. Leverage this fact to
      support qdisk network disk types such as rbd. E.g. <disk> config
      such as
      
         <disk type='network' device='disk'>
           <driver name='qemu' type='raw'/>
           <source protocol='rbd' name='pool/image'>
             <host name='mon1.example.org' port='6321'/>
             <host name='mon2.example.org' port='6322'/>
             <host name='mon3.example.org' port='6322'/>
           </source>
           <target dev='hdb' bus='ide'/>
           <address type='drive' controller='0' bus='0' target='0' unit='1'/>
         </disk>
      
      can be converted to the following xl config (and vice versa)
      
        disk = [ "format=raw,vdev=hdb,access=rw,backendtype=qdisk,
                  target=rbd:pool/image:auth_supported=none:mon_host=mon1.example.org\\:6321\\;mon2.example.org\\:6322\\;mon3.example.org\\:6322"
               ]
      
      Note that in xl disk config, a literal backslash in target= must
      be escaped with a backslash. Conversion of <auth> config is not
      handled in this patch, but can be done in a follow-up patch.
      
      Also add a test for the conversions.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      6604a3dd
    • J
      xenconfig: produce key=value disk config syntax in xl formatter · a44f1f85
      Jim Fehlig 提交于
      The most formal form of xl disk configuration uses key=value
      syntax to define each configuration item, e.g.
      
      format=raw, vdev=xvda, access=rw, backendtype=phy, target=disksrc
      
      Change the xl disk formatter to produce this syntax, which allows
      target= to contain meta info needed to setup a network-based
      disksrc (e.g. rbd, nbd, iscsi). For details on xl disk config
      format, see  $xen-src/docs/misc/xl-disk-configuration.txt
      
      Update the disk config in the tests to use the formal syntax.
      But add tests to ensure disks specified with the positional
      parameter syntax are correctly converted to <disk> XML.
      Signed-off-by: NJim Fehlig <jfehlig@suse.com>
      a44f1f85
    • A
      hostdev: Minor style adjustments · dad0ae1c
      Andrea Bolognani 提交于
      Mostly labels names and whitespace.
      
      No functional changes.
      dad0ae1c
  4. 22 2月, 2016 5 次提交
  5. 20 2月, 2016 2 次提交
  6. 19 2月, 2016 21 次提交
    • P
      qemu: iothreadpin: Always set affinity when pinning iothread · 29eeb814
      Peter Krempa 提交于
      Similarly to VM startup always set the legacy affinity. Additionally we
      don't need to report an explicit error since virProcessSetAffinity
      reports them themselves.
      29eeb814
    • P
      qemu: emulatorpin: Always set affinity when pinning emulator thread · 2242503e
      Peter Krempa 提交于
      Similarly to VM startup always set the legacy affinity. Additionally we
      don't need to report an explicit error since virProcessSetAffinity
      reports them themselves.
      2242503e
    • C
      qemu: parse: drop redundant AddImplicitControllers · e6ad2b69
      Cole Robinson 提交于
      PostParse handles it for us now.
      
      This causes some test suite churn; qemu's custom PostParse could is
      now invoked before the generic AddImplicitControllers, so PCI
      controllers end up sequentially in the XML before the generically
      added IDE controllers. So it's just some XML reordering
      e6ad2b69
    • C
      qemu: parse: rename qemuCaps->caps · 378a9dc6
      Cole Robinson 提交于
      Everywhere else in qemu driver code 'qemuCaps' is a virQEMUCapsPtr,
      and virCapsPtr is generally named just 'caps'. Rename the offenders
      378a9dc6
    • C
      domain: add implicit controllers from post parse · 4066c734
      Cole Robinson 提交于
      Seems like the natural fit, since we are already adding other XML bits
      in the PostParse routine.
      
      Previously AddImplicitControllers was only called at the end of XML
      parsing, meaning code that builds a DomainDef by hand had to manually
      call it. Now those PostParse callers get it for free.
      
      There's some test churn here; xen xm and sexpr test suite bits weren't
      calling this before, but now they are, so you'll see new IDE controllers.
      I don't think this will cause problems in practice, since the code already
      needs to handle these implicit controllers like in the case when a user
      defines their own XML.
      4066c734
    • J
      Check for active domain in virDomainObjWait · 5591ca50
      Jiri Denemark 提交于
      virDomainObjWait is designed to be called in a loop. Make sure we break
      the loop in case the domain dies to avoid waiting for an event which
      will never happen.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      5591ca50
    • J
      qemu: Avoid calling qemuProcessStop without a job · 81f50cb9
      Jiri Denemark 提交于
      Calling qemuProcessStop without a job opens a way to race conditions
      with qemuDomainObjExitMonitor called in another thread. A real world
      example of such a race condition:
      
        - migration thread (A) calls qemuMigrationWaitForSpice
        - another thread (B) starts processing qemuDomainAbortJob API
        - thread B signals thread A via qemuDomainObjAbortAsyncJob
        - thread B enters monitor (qemuDomainObjEnterMonitor)
        - thread B calls qemuMonitorSend
        - thread A awakens and calls qemuProcessStop
        - thread A calls qemuMonitorClose and sets priv->mon to NULL
        - thread B calls qemuDomainObjExitMonitor with priv->mon == NULL
        => monitor stays ref'ed and locked
      
      Depending on how lucky we are, the race may result in a memory leak or
      it can even deadlock libvirtd's event loop if it tries to lock the
      monitor to process an event received before qemuMonitorClose was called.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      81f50cb9
    • J
      6f08cbb8
    • J
      qemu: Process monitor EOF in a job · 8c9ff996
      Jiri Denemark 提交于
      Stopping a domain without a job risks a race condition with another
      thread which started a job a which does not expect anyone else to be
      messing around with the same domain object.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      8c9ff996
    • J
      qemu: Start an async job for processGuestPanicEvent · 1894112b
      Jiri Denemark 提交于
      Only a small portion of processGuestPanicEvent was enclosed within a
      job, let's make sure we use the job for all operations to avoid race
      conditions.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      1894112b
    • J
      qemu: Start job in qemuDomainDestroyFlags early · 26edd68c
      Jiri Denemark 提交于
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      26edd68c
    • J
      qemu: Introduce qemuProcessBeginStopJob · 4d0c535a
      Jiri Denemark 提交于
      When destroying a domain we need to make sure we will be able to start a
      job no matter what other operations are running or even stuck in a job.
      This is done by killing the domain before starting the destroy job.
      
      Let's introduce qemuProcessBeginStopJob which combines killing a domain
      and starting a job in a single API which can be called everywhere we
      need a job to stop a domain.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      4d0c535a
    • J
      qemu: Pass async job to qemuProcessInit · b7a948be
      Jiri Denemark 提交于
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      b7a948be
    • J
      qemu: End nested jobs properly · bf657dff
      Jiri Denemark 提交于
      Ending a nested job is no different from ending any other (non-async)
      job, after all the code in qemuDomainBeginJobInternal does not handle
      them differently either. Thus we should call qemuDomainObjEndJob to stop
      nested jobs.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      bf657dff
    • J
      qemu: Export qemuDomainObjBeginNestedJob · 17c4312c
      Jiri Denemark 提交于
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      17c4312c
    • P
      qemu: qemuDomainGetStatsVcpu: Fix output for possible sparse vCPU settings · 783584b5
      Peter Krempa 提交于
      qemuDomainHelperGetVcpus would correctly return an array of
      virVcpuInfoPtr structs for online vcpus even for sparse topologies, but
      the loop that fills the returned typed parameters would number the vcpus
      incorrectly. Fortunately sparse topologies aren't supported yet.
      783584b5
    • P
      qemu: vcpupin: Always set affinity even when cgroups are supported · 9958422d
      Peter Krempa 提交于
      VM startup and CPU hotplug always set the affinity regardless of cgroups
      support. Use the same approach for the pinning API.
      9958422d
    • P
      qemu: vcpupin: Don't overwrite errors from functions setting pinning · 47174130
      Peter Krempa 提交于
      Both errors from the cgroups code and from the affinity code would be
      overwritten by the API. Report the more specific error.
      47174130
    • P
      util: Use virBitmapIsBitSet in freebsd impl of virProcessSetAffinity · 9268b9ad
      Peter Krempa 提交于
      Use the helper that does not return errors to fix spuriously looking
      dead return of -1.
      9268b9ad
    • E
      admin: Fix memory leak in remoteAdminConnectClose · e9e85655
      Erik Skultety 提交于
      When virt-admin is run with valgrind, this kind of output can be obtained:
      
      HEAP SUMMARY:
        in use at exit: 134,589 bytes in 1,031 blocks
        total heap usage: 2,667 allocs, 1,636 frees, 496,755 bytes allocated
      
      88 bytes in 1 blocks are definitely lost in loss record 82 of 128
       at 0x4C2A9C7: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
       by 0x52F6D1F: virAllocVar (viralloc.c:560)
       by 0x5350268: virObjectNew (virobject.c:193)
       by 0x53503E0: virObjectLockableNew (virobject.c:219)
       by 0x4E3BBCB: virAdmConnectNew (datatypes.c:832)
       by 0x4E38495: virAdmConnectOpen (libvirt-admin.c:209)
       by 0x10C541: vshAdmConnect (virt-admin.c:107)
       by 0x10C7B2: vshAdmReconnect (virt-admin.c:163)
       by 0x10CC7C: cmdConnect (virt-admin.c:298)
       by 0x110838: vshCommandRun (vsh.c:1224)
       by 0x10DFD8: main (virt-admin.c:862)
      
       LEAK SUMMARY:
          definitely lost: 88 bytes in 1 blocks
          indirectly lost: 0 bytes in 0 blocks
          possibly lost: 0 bytes in 0 blocks
          still reachable: 134,501 bytes in 1,030 blocks
          suppressed: 0 bytes in 0 blocks
      
      This is because virNetClientSetCloseCallback was being reinitialized
      incorrectly. By resetting the callbacks in a proper way, the leak is fixed.
      e9e85655
    • M
      esx: Avoid using vSphere SessionIsActive function · 647ac97a
      Matthias Bolte 提交于
      A login session with the vSphere API might expire after some idle time.
      The esxVI_EnsureSession function uses the SessionIsActive function to
      check if the current session has expired and a relogin needs to be done.
      
      But the SessionIsActive function needs the Sessions.ValidateSession
      privilege that is considered as an admin level privilege.
      
      Only vCenter actually provides the SessionIsActive function. This results
      in requiring an admin level privilege even for read-only operations on
      a vCenter server.
      
      ESX and VMware Server don't provide the SessionIsActive function and
      the code already works around that. Use the same workaround for vCenter
      again.
      
      This basically reverts commit 5699034b.
      647ac97a