1. 17 9月, 2012 4 次提交
    • O
      list: Implement listAllNodeDevices · c68cd62a
      Osier Yang 提交于
      This simply implements listAllNodeDevices using helper virNodeDeviceList
      
      src/node_device/node_device_driver.h:
        * Declare nodeListAllNodeDevices.
      
      src/node_device/node_device_driver.c:
        * Implement nodeListAllNodeDevices.
      
      src/node_device/node_device_hal.c:
        * Hook listAllNodeDevices to nodeListAllNodeDevices.
      
      src/node_device/node_device_udev.c
        * Hook listAllNodeDevices to nodeListAllNodeDevices.
      c68cd62a
    • O
      list: Add helpers for listing node devices · 324bf8bf
      Osier Yang 提交于
      src/conf/node_device_conf.h:
        * New macro VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_CAP
        * Declare virNodeDeviceList
      
      src/conf/node_device_conf.c:
        * New helpers virNodeDeviceCapMatch, virNodeDeviceMatch.
          virNodeDeviceCapMatch looks up the list of all the caps the device
          support, to see if the device support the cap type.
        * Implement virNodeDeviceList
      
      src/libvirt_private.syms:
        * Export virNodeDeviceList
        * Export virNodeDevCapTypeFromString
      324bf8bf
    • O
      list: Implement RPC calls for virConnectListAllNodeDevices · 4230b6c1
      Osier Yang 提交于
      The RPC generator doesn't support returning list of object yet, this patch
      does the work manually.
      
        * daemon/remote.c:
          Implemente the server side handler remoteDispatchConnectListAllNodeDevices.
      
        * src/remote/remote_driver.c:
          Add remote driver handler remoteConnectListAllNodeDevices.
      
        * src/remote/remote_protocol.x:
          New RPC procedure REMOTE_PROC_CONNECT_LIST_ALL_INTERFACES and
      4230b6c1
    • O
      list: Define new API virConnectListAllNodeDevices · c6a3be5d
      Osier Yang 提交于
      This is to list the node device objects, supports to filter the results
      by capability types.
      
      include/libvirt/libvirt.h.in: Declare enum virConnectListAllNodeDeviceFlags
                                    and virConnectListAllNodeDevices.
      python/generator.py: Skip auto-generating
      src/driver.h: (virDrvConnectListAllNodeDevices)
      src/libvirt.c: Implement the public API
      src/libvirt_public.syms: Export the symbol to public
      c6a3be5d
  2. 15 9月, 2012 3 次提交
  3. 14 9月, 2012 10 次提交
    • J
      qemu: fix uninitialized variable in qemuParseCommandLine · b4418464
      Ján Tomko 提交于
      Newly added if branch for kvm_pv_eoi did not set the ret variable.
      b4418464
    • D
      Introduce a API for creating QEMU capabilities for a binary · 6b07dff0
      Daniel P. Berrange 提交于
      Introduce a qemuCapsNewForBinary() API which creates a new
      QEMU capabilities object, populated with data relating to
      a specific QEMU binary. The qemuCaps object is also given
      a timestamp, which makes it possible to detect when the
      cached capabilities for a binary are out of date
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      6b07dff0
    • D
      Remove upfront check for hmp - just try it cope with failure · 97a1f076
      Daniel P. Berrange 提交于
      Don't bother checking for the existance of the HMP passthrough
      command. Just try to execute it, and propagate the failure.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      97a1f076
    • D
      Don't overwrite errors raised by qemuMonitorHMPCommand · 5505cf96
      Daniel P. Berrange 提交于
      The qemuMonitorHMPCommand() API and things it calls will report
      a wide variety of errors. The QEMU text monitor should not be
      overwriting these errors
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      5505cf96
    • M
      qemu: Add support for EOI with APIC · fbf9aa12
      Martin Kletzander 提交于
      This patch adds full support for EOI setting for domains. Because this
      is CPU feature (flag), the model needs to be added even when it's not
      specified. Fortunately this problem was already solved with kvmclock,
      so this patch simply abuses that.
      
      And due to the size of the patch (17 lines) I dared to include the tests.
      fbf9aa12
    • M
      Add support for EOI with APIC · 4a8b7cba
      Martin Kletzander 提交于
      New options is added to support EOI (End of Interrupt) exposure for
      guests. As it makes sense only when APIC is enabled, I added this into
      the <apic> element in <features> because this should be tri-state
      option (cannot be handled as standalone feature).
      4a8b7cba
    • M
      security: Fix libvirtd crash possibility · b7ff9e69
      Martin Kletzander 提交于
      Fix for CVE-2012-4423.
      
      When generating RPC protocol messages, it's strictly needed to have a
      continuous line of numbers or RPC messages. However in case anyone
      tries backporting some functionality and will skip a number, there is
      a possibility to make the daemon segfault with newer virsh (version of
      the library, rpc call, etc.) even unintentionally.
      
      The problem is that the skipped numbers will get func filled with
      NULLs, but there is no check whether these are set before the daemon
      tries to run them. This patch very simply enhances one check and fixes
      that.
      b7ff9e69
    • G
      snapshot: fix rollback failure in transaction mode · ac89a611
      Guannan Ren 提交于
      BZ:https://bugzilla.redhat.com/show_bug.cgi?id=843372
      when qemu supports the 'transaction' monitor command,
      and libvirt's --reuse-ext flag was not specified, libvirt created
      a stub file with zero size in first place. After the failure of
      QEMU transaction command performing qcow2 snapshots on more than
      one drives, the stub file is left behind with non-empty
      by the QEMU transaction command.
      In order to unlink the file, the patch removes the file size checking.
      
      Steps to reproduce the issue:
      Steps:
       1, Create a qemu instance with two drive images of qcow2 type (root user)
          /usr/libexec/qemu-kvm -m 1024 -smp 1 -name "rhel6u1" \
            -drive file=/var/lib/libvirt/images/firstqcow2,if=none,id=drive-virtio-disk0,format=qcow2,cache=none
            -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
            -drive file=/var/lib/libvirt/images/secondqcow2,if=none,id=drive-virtio-disk1,format=qcow2,cache=none \
            -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x7,drive=drive-virtio-disk1,id=virtio-disk1 -qmp stdio
      
       2, Initialize qemu qmp
          {"execute":"qmp_capabilities"}
      
       3, Remove the second drive image file
          rm -f /var/lib/libvirt/images/secondqcow2
      
       4, Run 'transaction' command with snapshot qemu commands in.
          {"execute":"transaction","arguments":
            {"actions":
              [{"type":"blockdev-snapshot-sync","data":
                {"device":"drive-virtio-disk0","snapshot-file":"/var/lib/libvirt/images/firstqcow2-snapshot.img","format":"qcow2"}
               },
               {"type":"blockdev-snapshot-sync","data":
                {"device":"drive-virtio-disk1","snapshot-file":"/var/lib/libvirt/images/secondqcow2-snapshot.img","format":"qcow2"}
               }]
            },
         "id":"libvirt-6"}
      
       5, Got the error as follows:
          {"id": "libvirt-6",
            "error": {"class": "OpenFileFailed", "desc": "Could not open '/var/lib/libvirt/images/secondqcow2-snapshot.img'",
                      "data": {"filename": "/var/lib/libvirt/images/secondqcow2-snapshot.img"}
                     }
          }
      
       6, List first newly-created snapshot file:
          -rw-r--r--. 1 root root     262144 Sep 13 11:43 firstqcow2-snapshot.img
      ac89a611
    • O
      Improve virTypedParameterValidateSet · 1e2864c2
      Osier Yang 提交于
      Assume not only domain object will use it.
      1e2864c2
    • A
      conf: avoid libvirt crash with empty address guestfwd channel · 9ed534f0
      Alex Jia 提交于
      The 'def->target.addr' hasn't been initialized in virDomainChrDefNew() and
      its value is always '0xffffffff', in addition, the following test scenario
      hasn't also include 'address' element in channel XML block, so the branch
      'if (addrStr == NULL)' is hit in virDomainChrDefParseTargetXML(), the
      programming jumps to 'error' label to release relevant resources, and the
      statement 'if (VIR_ALLOC(def->target.addr) < 0)' hasn't been executed then
      the virDomainChrDefFree() will free 'def->target.addr'(0xffffffff) via
      VIR_FREE(), which results in libvirt crash, to use valgrind can also
      find a 'Invalid free() / delete / delete[]' error. This patch just adjusts
      codes order to initialize 'def->target.addr' firstly.
      
      With this patch, libvirt hasn't crash and can get a expected error message "
      XML error: guestfwd channel does not define a target address".
      
      How to reproduce?
      
      1. define a guest with the following channel XML configuration
      
      $ cat foo.xml
      <snip>
          <channel type='pty'>
            <target type='guestfwd'/>
          </channel>
      </snip>
      
      $ virsh define foo.xml
      
      2. actual result
      
      error: Failed to define domain from /tmp/foo.xml
      error: End of file while reading data: Input/output error
      error: Failed to reconnect to the hypervisor
      
      GDB debugger information:
      <snip>
      Breakpoint 1, virDomainChrDefFree (def=0x7f8ab000ec70) at conf/domain_conf.c:1264
      ...ignore
      1264    {
      (gdb) p def->target
      $2 = {port = -1, addr = 0xffffffff, name = 0xffffffff <Address 0xffffffff out of bounds>}
      </snip>
      
      RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=856489Signed-off-by: NAlex Jia <ajia@redhat.com>
      9ed534f0
  4. 13 9月, 2012 17 次提交
  5. 12 9月, 2012 6 次提交
    • D
      parallels: fix parallelsDomainDefineXML for domains with VNC and autoport · 4cf4120b
      Dmitry Guryanov 提交于
      virDomainDefParseString assigns 0 to port if autoport enabled.
      So fix code, which check different between old and new
      configurations.
      4cf4120b
    • D
      parallels: fix parallelsDoCmdRun in case of command failure · 748b6d8e
      Dmitry Guryanov 提交于
      Don't try to dereferece NULL pointer.
      748b6d8e
    • L
      Backcompt for console devices in virDomainDeviceInfoIterate · babe7dad
      Li Zhang 提交于
      Historically, the first <console> element is treated as the
      alias of a <serial> device. In the virDomainDeviceInfoIterate,
      This situation is not considered. It still handles the first <console>
      element as another devices, which means that for console[0] with
      serial targetType, it calls callback function another time.
      It will cause the problem of address conflicts when assigning
      spapr-vio address for serial device on pSeries guest.
      
      For pSeries guest, the serial configuration in the xml file
      is as the following:
               <serial type='pty'>
                     <target port='0'/>
                     <address type='spapr-vio'/>
                </serial>
      
      Console configuration is default, the dumped xml file is as the following:
         <serial type='pty'>
            <source path='/dev/pts/5'/>
            <target port='0'/>
            <alias name='serial0'/>
            <address type='spapr-vio' reg='0x30000000'/>
          </serial>
          <console type='pty' tty='/dev/pts/5'>
            <source path='/dev/pts/5'/>
            <target type='serial' port='0'/>
            <alias name='serial0'/>
            <address type='spapr-vio' reg='0x30000000'/>
          </console>
      
      It shows that the <console> device is the alias of serial device.
      So its address is the same as the serial device. When detecting
      the conflicts in the qemuAssignSpaprVIOAddress the first console
      and the serial device conflicts because virDomainDeviceInfoIterate()
      still handle these as two different devices, and in the qemuAssignSpaprVIOAddress(),
      it will compare these two devices' addressed. If they have same address,
      it will report address conflict error.
      
      So this patch is to handle the first console which targetType is serial
      as the alias of serial device to avoid address conflicts error reported.
      Signed-off-by: NLi Zhang <zhlcindy@linux.vnet.ibm.com>
      babe7dad
    • O
      list: Implement listAllInterfaces · a3cf061c
      Osier Yang 提交于
      This is not that ideal as API for other objects, as it's still
      O(n). Because interface driver uses netcf APIs to manage the
      stuffs, instead of by itself. And netcf APIs don't return a object.
      It provides APIs like old libvirt APIs:
      
         ncf_number_of_interfaces
         ncf_list_interfaces
         ncf_lookup_by_name
         ......
      
      Perhaps we should further improve netcf to let it provide an API
      to return the object, but it could be a later patch. And anyway,
      we will still benefit from the new API for the simplification,
      and no race like the old APIs.
      
      src/interface/netcf_driver.c: Implement listAllInterfaces
      a3cf061c
    • O
      list: Implemente RPC calls for virConnectListAllInterfaces · 65741d84
      Osier Yang 提交于
      The RPC generator doesn't support returning list of object yet, this patch
      do the work manually.
      
        * daemon/remote.c:
          Implemente the server side handler remoteDispatchConnectListAllInterfaces.
      
        * src/remote/remote_driver.c:
          Add remote driver handler remoteConnectListAllInterfaces.
      
        * src/remote/remote_protocol.x:
          New RPC procedure REMOTE_PROC_CONNECT_LIST_ALL_INTERFACES and
          structs to represent the args and ret for it.
      
        * src/remote_protocol-structs: Likewise.
      65741d84
    • O
      list: Define new API virConnectListAllInterfaces · f4af202f
      Osier Yang 提交于
      This is to list the interface objects, supported filtering flags
      are: active|inactive.
      
      include/libvirt/libvirt.h.in: Declare enum virConnectListAllInterfaceFlags
                                    and virConnectListAllInterfaces.
      python/generator.py: Skip auto-generating
      src/driver.h: (virDrvConnectListAllInterfaces)
      src/libvirt.c: Implement the public API
      src/libvirt_public.syms: Export the symbol to public
      f4af202f