1. 19 2月, 2010 5 次提交
    • S
      macvtap IFF_VNET_HDR configuration · e52687e8
      Stefan Berger 提交于
      This patch sets or unsets the IFF_VNET_HDR flag depending on what device
      is used in the VM. The manipulation of the flag is done in the open
      function and is only fatal if the IFF_VNET_HDR flag could not be cleared
      although it has to be (or if an ioctl generally fails). In that case the
      macvtap tap is closed again and the macvtap interface torn.
      
      * src/qemu/qemu_conf.c src/qemu/qemu_conf.h: pass qemuCmdFlags to
        qemudPhysIfaceConnect()
      * src/util/macvtap.c src/util/macvtap.h: add vnet_hdr boolean to
        openMacvtapTap(), and private function configMacvtapTap()
      * src/qemu/qemu_driver.c: add extra qemuCmdFlags when calling
        qemudPhysIfaceConnect()
      e52687e8
    • L
      Use virFork() in __virExec(), virFileCreate() and virDirCreate() · 61497d95
      Laine Stump 提交于
      For __virExec() this is a semantic NOP except for when fork()
      fails. __virExec() would previously forget to restore the signal mask
      in this case; virFork() corrects this behavior.
      
      virFileCreate() and virDirCreate() gain the code to reset the logging
      and properly deal with the signal handling race condition.
      
      This also removes a log message that had a typo ("cannot fork o create
      file '%s'") - this error is now logged in a more generic manner in
      virFork() (more generic, but really just as informative, since the
      fact that it's forking to create a file is immaterial to the fact that
      it simply can't fork)
      
      * src/util/util.c: use the generic virFork() in the 3 functions
      61497d95
    • L
      Add virFork() function to utils · b4584612
      Laine Stump 提交于
      virFork() contains bookkeeping that must be done any time a process
      forks. Currently this includes:
      
      1) Call virLogLock() prior to fork() and virLogUnlock() just after,
         to avoid a deadlock if some other thread happens to hold that lock
         during the fork.
      
      2) Reset the logging hooks and send all child process log messages to
         stderr.
      
      3) Block all signals prior to fork(), then either a) reset the signal
         mask for the parent process, or b) clear the signal mask for the
         child process.
      
      Note that the signal mask handling in __virExec erroneously fails to
      restore the signal mask when fork() fails. virFork() fixes this
      problem.
      
      Other than this, it attempts to behave as closely to fork() as
      possible (including preserving errno for the caller), with a couple
      exceptions:
      
      1) The return value is 0 (success) or -1 (failure), while the pid is
         returned via the pid_t* argument. Like fork(), if pid < 0 there is
         no child process, otherwise both the child and the parent will
         return to the caller, and both should look at the return value,
         which will indicate if some of the extra processing outlined above
         encountered an error.
      
      2) If virFork() returns with pid < 0 or with a return value < 0
         indicating an error condition, the error has already been
         reported. You can log an additional message if you like, but it
         isn't necessary, and may be awkwardly extraneous.
      
      Note that virFork()'s child process will *never* call _exit() - if a
      child process is created, it will return to the caller.
      
      * util.c util.h: add virFork() function, based on what is currently
                       done in __virExec().
      b4584612
    • M
      Add QEMU support for virtio channel · 3ec09478
      Matthew Booth 提交于
      Support virtio-serial controller and virtio channel in QEMU backend.
      Will output
      the following for virtio-serial controller:
      
      -device
      virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x4,max_ports=16,vectors=4
      
      and the following for a virtio channel:
      
      -chardev pty,id=channel0 \
      -device
      virtserialport,bus=virtio-serial0.0,chardev=channel0,name=org.linux-kvm.port.0
      
      * src/qemu/qemu_conf.c: Add argument output for virtio
      * tests/qemuxml2argvtest.c
        tests/qemuxml2argvdata/qemuxml2argv-channel-virtio.args: Add test for
        QEMU command line generation
      3ec09478
    • M
      Add domain support for virtio channel · 7813a0f8
      Matthew Booth 提交于
      Add support for virtio-serial by defining a new 'virtio' channel target type
      and a virtio-serial controller. Allows the following to be specified in a
      domain:
      
      <controller type='virtio-serial' index='0' ports='16' vectors='4'/>
      <channel type='pty'>
        <target type='virtio' name='org.linux-kvm.port.0'/>
        <address type='virtio-serial' controller='0' bus='0'/>
      </channel>
      
      * docs/schemas/domain.rng: Add virtio-serial controller and virtio
        channel type.
      * src/conf/domain_conf.[ch]: Domain parsing/serialization for
        virtio-serial controller and virtio channel.
      * tests/qemuxml2xmltest.c
        tests/qemuxml2argvdata/qemuxml2argv-channel-virtio.xml: add domain xml
        parsing test
      * src/libvirt_private.syms src/qemu/qemu_conf.c:
        virDomainDefAddDiskControllers() renamed to
        virDomainDefAddImplicitControllers()
      7813a0f8
  2. 18 2月, 2010 10 次提交
    • M
      Remove unused functions from domain_conf · 07e318b3
      Matthew Booth 提交于
      Remove virDomainDevicePCIAddressEqual and virDomainDeviceDriveAddressEqual,
      which are defined but not used anywhere.
      
      * src/conf/domain_conf.[ch] src/libvirt_private.syms: Remove
        virDomainDevicePCIAddressEqual and virDomainDeviceDriveAddressEqual.
      07e318b3
    • M
      Fix typo in comment · 27e63c00
      Matthew Booth 提交于
      * src/qemu/qemu_driver.c: qemudStartVMDaemon() fix typo in comment
      27e63c00
    • J
      get_virtual_functions_linux: would mistakenly always return zero · 081fd746
      Jim Meyering 提交于
      * src/node_device/node_device_linux_sysfs.c(get_virtual_functions_linux):
      Return "ret", rather than always returning 0.
      081fd746
    • C
      qemu: Explicitly error if guest virtual network is inactive · 3f745ebe
      Cole Robinson 提交于
      Currently we just error with ex. 'virbr0: No such device'.
      
      Since we are using public API calls here, we need to ensure that any
      raised error is properly saved and restored, since API entry points
      always reset messages.
      3f745ebe
    • C
      network: bridge: Fix IsActive, IsPersistent · 6d4bd59c
      Cole Robinson 提交于
      We were accessing the wrong private data structure, which would
      cause a segfault.
      6d4bd59c
    • C
      virterror: Make SetError work if no previous error was set · bf6789d9
      Cole Robinson 提交于
      virGetLastError returns NULL if no error has been set, not on
      allocation error like virSetError assumed. Use virLastErrorObject
      instead. This fixes virSetError when no error is currently stored.
      bf6789d9
    • C
      libvirt: Update docs for hotplug only commands · 372a7f45
      Cole Robinson 提交于
      The commands updated are SetMem, SetMaxMem, SetVcpus, and PinVcpu.
      372a7f45
    • S
      macvtap teardown rework · f162252e
      Stefan Berger 提交于
      Rework and simplification of teardown of the macvtap device.
      
      Basically all devices with the same MAC address and link device are kept
      alive and not attempted to be torn down. If a macvtap device linked to a
      physical interface with a certain MAC address 'M' is to be created it
      will automatically fail if the interface is 'up'ed and another macvtap
      with the same properties (MAC addr 'M', link dev) happens to be 'up'.
      This will prevent the VM from starting or the device from being attached
      to a running VM. Stale interfaces are assumed to be there for some
      reason and not stem from libvirt.
      
      In the VM shutdown path, it's assuming that an interface name is always
      available so that if the device type is DIRECT it can be torn down
      using its name.
      
      * src/util/macvtap.h src/libvirt_macvtap.syms: change of deleting routine
      * src/util/macvtap.c: cleanups and change of deleting routine
      * src/qemu/qemu_driver.c: change cleanup on shutdown
      * src/qemu/qemu_conf.c: don't delete Macvtap in qemudPhysIfaceConnect()
      f162252e
    • D
      Update QEMU JSON balloon command handling · 6fe15e35
      Daniel P. Berrange 提交于
      The QEMU JSON monitor changed balloon commands to return/accept
      bytes instead of kilobytes. Update libvirt to cope with this
      
      * src/qemu/qemu_monitor_json.c: Expect/use bytes for ballooning
      6fe15e35
    • J
      openvzLoadDomains: don't ignore failing virUUIDFormat · 294adef3
      Jim Meyering 提交于
      * src/openvz/openvz_conf.c (openvzLoadDomains): Diagnose failure of
      virUUIDFormat.
      294adef3
  3. 17 2月, 2010 11 次提交
  4. 16 2月, 2010 8 次提交
    • D
      Treat missing QEMU 'thread_id' as non-fatal in JSON monitor · 535db41b
      Daniel P. Berrange 提交于
      The plain QEMU tree does not include 'thread_id' in the JSON
      output. Thus we need to treat it as non-fatal if missing.
      
      * src/qemu/qemu_monitor_json.c: Treat missing thread_id as non-fatal
      535db41b
    • D
      Fix check for primary IDE controller in QEMU PCI slot assignment · 9ab3fac8
      Daniel P. Berrange 提交于
      A typo in the check for the primary IDE controller could cause
      a crash on restore depending on the exact guest config.
      
      * src/qemu/qemu_conf.c: Fix s/video/controller/ typo & slot
        number typo
      9ab3fac8
    • D
      Make error reporting for QEMU JSON mode more friendly · b6b80095
      Daniel P. Berrange 提交于
      Current error reporting for JSON mode returns the full JSON
      command string and full JSON error string. This is not very
      user friendly, so this change makes the error report only
      contain the basic command name, and friendly error message
      description string. The full JSON data is logged instead.
      
      * src/qemu/qemu_monitor_json.c: Always return the 'desc' field from
        the JSON error message to users.
      b6b80095
    • D
      Run 'qmp_capabilities' command at QEMU monitor startup · 5d72a894
      Daniel P. Berrange 提交于
      When in JSON mode, QEMU requires that 'qmp_capabilities' is run as
      the first command in the monitor. This is a no-op when run in the
      text mode monitor
      
      * src/qemu/qemu_driver.c: Run capabilities negotiation when
        connecting to the monitor
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
        src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h: Add
        support for the 'qmp_capabilities' command, no-op in text mode.
      5d72a894
    • S
      macvtap support for libvirt -- qemu support · a1b1ab14
      Stefan Berger 提交于
      This part adds support for qemu making a macvtap tap device available
      via file descriptor passed to qemu command line. This also attempts to
      tear down the macvtap device when a VM terminates. This includes support
      for attachment and detachment to/from running VM.
      * src/qemu/qemu_conf.[ch] src/qemu/qemu_driver.c: add support in the
        QEmu driver
      a1b1ab14
    • S
      macvtap support for libvirt -- helper code · 315baab9
      Stefan Berger 提交于
      This part adds the helper code to setup and tear down macvtap devices
      using direct communication with the device driver via netlink sockets.
      The rather short messages received from the netlink layer are now
      written into a dynamically allocated buffer
      
      * src/util/macvtap.h src/util/macvtap.c: provides the new module
      * po/POTFILES.in: the module contains translated strings
      315baab9
    • S
      macvtap support for libvirt -- parse new interface XML · 78d1ee29
      Stefan Berger 提交于
      This part adds support to domain_conf.{c|h} for parsing the new
      interface XML of type 'direct'. The parsed mode is now stored as
      an int.
      * src/conf/domain_conf.c src/conf/domain_conf.h: extend parsing code
      * src/util/macvtap.h: empty header to not break compilation
      78d1ee29
    • S
      macvtap support for libvirt -- build support · fd5091db
      Stefan Berger 提交于
      This patch adds build support for libvirt checking for certain contents
      of /usr/include/linux/if_link.h to see whether macvtap support is
      compilable on that system. One can disable macvtap support in libvirt
      via --without-macvtap passed to configure.
      * configure.ac src/Makefile.am: new build support
      * src/libvirt_macvtap.syms: list of exported symbols
      * src/util/macvtap.c: empty module to not break compilation
      fd5091db
  5. 15 2月, 2010 2 次提交
    • M
      interface: Use proper return codes in the open function · 4b75e4df
      Matthias Bolte 提交于
      The open function returned -1 in case of an error, but -1 maps
      to VIR_DRV_OPEN_DECLINED instead of VIR_DRV_OPEN_ERROR.
      4b75e4df
    • M
      Convert virSecurityReportError into a macro · cad2a4ca
      Matthias Bolte 提交于
      The virRaiseError macro inside of virSecurityReportError expands to
      virRaiseErrorFull and includes the __FILE__, __FUNCTION__ and __LINE__
      information. But this three values are always the same for every call
      to virSecurityReportError and do not reflect the actual error context.
      
      Converting virSecurityReportError into a macro results in getting the
      correct __FILE__, __FUNCTION__ and __LINE__ information.
      cad2a4ca
  6. 13 2月, 2010 4 次提交
    • D
      Add persistence of PCI addresses to QEMU · 141dea6b
      Daniel P. Berrange 提交于
      Current PCI addresses are allocated at time of VM startup.
      To make them truely persistent, it is neccessary to do this
      at time of virDomainDefine/virDomainCreate. The code in
      qemuStartVMDaemon still remains in order to cope with upgrades
      from older libvirt releases
      
      * src/qemu/qemu_driver.c: Rename existing qemuAssignPCIAddresses
        to qemuDetectPCIAddresses. Add new qemuAssignPCIAddresses which
        does auto-allocation upfront. Call qemuAssignPCIAddresses from
        qemuDomainDefine and qemuDomainCreate to assign PCI addresses that
        can then be persisted. Don't clear PCI addresses at shutdown if
        they are intended to be persistent
      141dea6b
    • D
      Fix crash in LXC driver open method when URI has no path · 65834118
      Daniel P. Berrange 提交于
      If giving a lxc://  URI instead of lxc:/// the open method
      would crash ona NULL pointer
      
      * src/lxc/lxc_driver.c: Cope with a NULL URI path
      65834118
    • D
      Fix USB device path formatting mixup · 823a684f
      Daniel P. Berrange 提交于
      * src/util/hostusb.c: The device path for a USB device wants the
        bus/device IDs in decimal not octal
      823a684f
    • D
      Support 'block_passwd' command for QEMU disk encryption · c31a116b
      Daniel P. Berrange 提交于
      The old text mode monitor prompts for a password when disks are
      encrypted. This interactive approach doesn't work for JSON mode
      monitor. Thus there is a new 'block_passwd' command that can be
      used.
      
      * src/qemu/qemu_driver.c: Split out code for looking up a disk
        secret from findVolumeQcowPassphrase, into a new method
        getVolumeQcowPassphrase. Enhance qemuInitPasswords() to also
        set the disk encryption password via the monitor
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
        src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
        src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h: Add
        support for the 'block_passwd' monitor command.
      c31a116b