1. 29 2月, 2012 8 次提交
  2. 28 2月, 2012 14 次提交
    • L
      libxl: eliminate memory leak in libxmlDomainModifyDeviceFlags · 3207de30
      Laine Stump 提交于
      This call to virDomainDeviceDefParse is both unnecessary (since
      it will again be called at the top of the immediately following if(),
      and if not there, then at the top of the if following that), but it
      also creates a leak of one virDomainDeviceDef and one [whatever type
      of device the DeviceDef is pointing to; probably a virDomainDiskDef]
      in the case that the function has been called with
      VIR_DOMAIN_DEVICE_MODIFY_CONFIG (the second parse will overwrite the
      devicedef that was just created).
      3207de30
    • O
      virsh: Break long lines in virsh.pod · 3aab4d79
      Osier Yang 提交于
      No content changes, just breaking long lines.
      3aab4d79
    • O
      virsh: New command cmdChangeMedia · 33855f5d
      Osier Yang 提交于
      One could use it to eject, insert, or update media of the CDROM
      or floppy drive. See the documentation for more details.
      33855f5d
    • O
      virsh: Use vshFindDisk and vshPrepareDiskXML in cmdDetachDisk · 42accf1b
      Osier Yang 提交于
      The first use of the two new helper functions.
      42accf1b
    • O
      virsh: Two new helper functions for disk device changes · 025998eb
      Osier Yang 提交于
      vshFindDisk is to find the disk node in xml doc with given source
      path or target of disk device, and type (indicates disk type,
      normal disk or changeable disk).
      
      vshPrepareDiskXML is to make changes on the disk node (e.g. create
      and insert the new <source> node for inserting media of CDROM drive).
      
      They are marked as unused temporarily.
      025998eb
    • O
      c4302486
    • O
      qemu: Build command line for the new address format · c56fe7f1
      Osier Yang 提交于
      For any disk controller model which is not "lsilogic", the command
      line will be like:
      
        -drive file=/dev/sda,if=none,id=drive-scsi0-0-3-0,format=raw \
        -device scsi-disk,bus=scsi0.0,channel=0,scsi-id=3,lun=0,i\
        drive=drive-scsi0-0-3-0,id=scsi0-0-3-0
      
      The relationship between the libvirt address attrs and the qdev
      properties are (controller model is not "lsilogic"; strings
      inside <> represent libvirt adress attrs):
        bus=scsi<controller>.0
        channel=<bus>
        scsi-id=<target>
        lun=<unit>
      
      * src/qemu/qemu_command.h: (New param "virDomainDefPtr def"
        for function qemuBuildDriveDevStr; new param "virDomainDefPtr
        vmdef" for function qemuAssignDeviceDiskAlias. Both for
        virDomainDiskFindControllerModel's use).
      
      * src/qemu/qemu_command.c:
        - New param "virDomainDefPtr def" for qemuAssignDeviceDiskAliasCustom.
          For virDomainDiskFindControllerModel's use, if the disk bus is "scsi"
          and the controller model is not "lsilogic", "target" is one part of
          the alias name.
        - According change on qemuAssignDeviceDiskAlias and qemuBuildDriveDevStr
      
      * src/qemu/qemu_hotplug.c:
        - Changes to be consistent with declarations of qemuAssignDeviceDiskAlias
          qemuBuildDriveDevStr, and qemuBuildControllerDevStr.
      
      * tests/qemuxml2argvdata/qemuxml2argv-pseries-vio-user-assigned.args,
        tests/qemuxml2argvdata/qemuxml2argv-pseries-vio.args: Update the
        generated command line.
      c56fe7f1
    • O
      05fbe728
    • O
      conf: Introduce new attribute for device address format · 4288b22f
      Osier Yang 提交于
      * src/conf/domain_conf.h: Add new member "target" to struct
        _virDomainDeviceDriveAddress.
      
      * src/conf/domain_conf.c: Parse and format "target"
      
      * Lots of tests (.xml) in tests/domainsnapshotxml2xmlout,
        tests/qemuxml2argvdata, tests/qemuxml2xmloutdata, and
        tests/vmx2xmldata/ are modified for newly introduced
        attribute "target" for address of "drive" type.
      4288b22f
    • O
      7eadfdda
    • P
      qemu: add virtio-scsi controller model · 8dcac770
      Paolo Bonzini 提交于
      Adding a new model for virtio-scsi roughly follows the same scheme
      as the previous patch.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      8dcac770
    • P
      qemu: add ibmvscsi controller model · 3482191d
      Paolo Bonzini 提交于
      KVM will be able to use a PCI SCSI controller even on POWER.  Let
      the user specify the vSCSI controller by other means than a default.
      
      After this patch, the QEMU driver will actually look at the model
      and reject anything but auto, lsilogic and ibmvscsi.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NOsier Yang <jyang@redhat.com>
      3482191d
    • L
      qemu: fix cleanup of bridge during failure of qemuDomainAttachNetDevice · 4cc4b62e
      Laine Stump 提交于
      In qemuDomainAttachNetDevice, the guest's tap interface has only been
      attached to the bridge if iface_connected is true. It's possible for
      an error to occur prior to that happening, and previously we would
      attempt to remove the tap interface from the bridge even if it hadn't
      been attached.
      4cc4b62e
    • J
      qemu: unescape HMP commands before converting them to json · f27f616f
      Josh Durgin 提交于
      QMP commands don't need to be escaped since converting them to json
      also escapes special characters. When a QMP command fails, however,
      libvirt falls back to HMP commands. These fallback functions
      (qemuMonitorText*) do their own escaping, and pass the result directly
      to qemuMonitorHMPCommandWithFd. If the monitor is in json mode, these
      pre-escaped commands will be escaped again when converted to json,
      which can result in the wrong arguments being sent.
      
      For example, a filename test\file would be sent in json as
      test\\file.
      
      This prevented attaching an image file with a " or \ in its name in
      qemu 1.0.50, and also broke rbd attachment (which uses backslashes to
      escape some internal arguments.)
      Reported-by: NMasuko Tomoya <tomoya.masuko@gmail.com>
      Signed-off-by: NJosh Durgin <josh.durgin@dreamhost.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      f27f616f
  3. 27 2月, 2012 10 次提交
    • P
      qemu: Add ability to abort existing console while creating new one · 47161382
      Peter Krempa 提交于
      This patch fixes console corruption, that happens if two concurrent
      sessions are opened for a single console on a domain. Result of this
      corruption was that each of the console streams recieved just a part
      of the data written to the pipe so every console rendered unusable.
      
      New helper function for safe console handling is used to establish the
      console stream connection. This function ensures that no other libvirt
      client is using the console (with the ability to disconnect consoles of
      libvirt clients) and that no UUCP style lockfile is placed on the PTY
      device.
      
      * src/qemu/qemu_domain.h
              - add data structure to domain's private data dealing with
                console connections
      * src/qemu/qemu_domain.c:
              - allocate/free domain's console data structure
      * src/qemu/qemu_driver.c
              - use the new helper function for console handling
      47161382
    • P
      util: Add helpers for safe domain console operations · 3f4238d7
      Peter Krempa 提交于
      This patch adds a set of functions used in creating console streams for
      domains using PTYs and ensures mutually exclusive access to the PTYs.
      
      If mutually exclusive access is not used, two clients may open the same
      console, which results in corruption on both clients as both of them
      race to read data from the PTY.
      
      Two approaches are used to ensure this:
      1) Internal data structure holding open PTYs.
              This is used internally and enables the user to forcibly
              terminate another console connection eg. when somebody leaves
              the console open on another host.
      
      2) UUCP style lock files:
              This uses UUCP lock files according to the  FHS
              ( http://www.pathname.com/fhs/pub/fhs-2.3.html#VARLOCKLOCKFILES )
              to check if other programs (like minicom) are not using the pty
              device of the console.
      
              This feature is disabled by default and may be enabled using
              configure parameter
              --with-console-lock-files=/path/to/lock/file/directory
              or --with-console-lock-files=auto (which tries to infer the
              location from OS used (currently only linux).
      
              On usual linux systems, normal users may not write to the
              /var/lock directory containing the locks. This poses problems
              while in session mode. If the current user has no access to the
              lockfile directory, check for presence of the file is still
              done, but no lock file is created. This does NOT result in an
              error.
      3f4238d7
    • P
      fdstream: Add internal callback on stream close · 0c4bfdda
      Peter Krempa 提交于
      This patch adds another callback to a FDstream object. The original
      callback is used by the daemon stream driver to handle events.
      
      This callback is called if and only if the stream is about to be closed.
      This might be used to handle cleanup steps after a fdstream exits. This
      will be used later on in ensuring mutually exclusive access to consoles.
      
      * src/fdstream.c:
              - emit the callback, when stream is being closed
              - add data structures needed to handle the callback
              - add function to register callback
      * src/fdstream.h:
              - define function prototypes for the callback
      0c4bfdda
    • P
      fdstream: Emit stream abort callback even if poll() doesnt. · 95fdc1bc
      Peter Krempa 提交于
      This patch causes the fdstream driver to call the stream event callback
      if virStreamAbort() is called on a stream using this driver.
      
      A remote handler for a stream can only detect changes via stream events,
      so this event callback is necessary in order to enable a daemon to abort
      a stream in such a way that the client will see the change.
      
      * src/fdstream.c:
              - modify close function to call stream event callback
      95fdc1bc
    • P
      virsh: add support for VIR_DOMAIN_CONSOLE_* flags · afa4336e
      Peter Krempa 提交于
      This patch adds support for the newly introduced
      VIR_DOMAIN_CONSOLE_FORCE and VIR_DOMAIN_CONSOLE_SAFE flags. The console
      command now has an optional parameter --force that specifies that the
      user wants to forcibly interrupt an ongoing console session and create
      a new one. Flag --safe requests that the console should be opened only
      if the hypervisor driver supports safe console handling.
      
      The behaviour to this point was that the daemon opened two streams to
      the console, that competed for data from the pipe, and the result was
      that both of the consoles ended up scrambled.
      
      This patch doesn't modify operation of other commands dealing with
      console connections (start, create) as those open connections to newly
      started domains making it virtually impossible for another client to race
      for the console and steal it.
      
      * tools/console.c:
              - add support for flag passthrough
      * tools/console.h:
              - modify function prototypes to match impl.
      * tools/virsh.c:
              - add flag --force for the console command
      afa4336e
    • P
      Add flags for virDomainOpenConsole · a1801023
      Peter Krempa 提交于
      This patch adds a set of flags to be used with the virDomainOpenConsole
      API call to specify if the user wishes to interrupt an existing console
      session or just to try open a new one.
      
      VIR_DOMAIN_CONSOLE_SAFE - specifies that the console connection should
                                be opened only if the hypervisor supports
                                mutually exclusive access to console devices
      
      VIR_DOMAIN_CONSOLE_FORCE - specifies that the caller wishes to interrupt
                                 existing session and force a creation of a
                                 new one.
      a1801023
    • P
      pidfile: Make checking binary path in virPidFileRead optional · 3e0623eb
      Peter Krempa 提交于
      This patch changes behavior of virPidFileRead to enable passing NULL as
      path to the binary the pid file should be checked against to skip this
      check. This enables using this function for reading files that have same
      semantics as pid files, but belong to unknown processes.
      3e0623eb
    • M
      qemu: Implement virDomainPMWakeup API · 9bf1bcc5
      Michal Privoznik 提交于
      using 'system-wakeup' monitor command. It is supported only in JSON,
      as we are enabling it if possible. Moreover, this command is available
      in qemu-1.1+ which definitely has JSON.
      9bf1bcc5
    • M
      virsh: Expose virDomainPMWakeup · a04d10f7
      Michal Privoznik 提交于
      a04d10f7
    • M
      Introduce virDomainPMWakeup API · e2822f19
      Michal Privoznik 提交于
      This API allows a domain which previously called
      virDomainPMSuspendForDuration() to be woken up.
      e2822f19
  4. 25 2月, 2012 6 次提交
    • M
      Fixed URI parsing · 9f748277
      Martin Kletzander 提交于
      Function xmlParseURI does not remove square brackets around IPv6
      address when parsing. One of the solutions is making wrappers around
      functions working with xmlURI*. This assures that uri->server will be
      always properly assigned and it doesn't have to be changed when used
      on some new place in the code.
      For this purpose, functions virParseURI and virSaveURI were
      added. These function are wrappers around xmlParseURI and xmlSaveUri
      respectively.
      Also there is one new syntax check function to prohibit these functions
      anywhere else.
      
      File changes:
       - src/util/viruri.h        -- declaration
       - src/util/viruri.c        -- definition
       - src/libvirt_private.syms -- symbol export
       - src/Makefile.am          -- added source and header files
       - cfg.mk                   -- added sc_prohibit_xmlURI
       - all others               -- ID name and include fixes
      9f748277
    • M
      Fixed service handling in specfile · 801a60ff
      Martin Kletzander 提交于
      After adding the libvirt-guests service into usual runlevels, we used
      to start the libvirt-guests service. However this is usually not a
      good practice. As mentioned on fedoraproject wiki, the installations
      can be in changeroots, in an installer context, or in other situations
      where we don't want the services autostarted.
      801a60ff
    • L
      virsh: fix informational message in iface-bridge command · 4a923600
      Laine Stump 提交于
      See: https://bugzilla.redhat.com/show_bug.cgi?id=797066
      
      The position of the bridge name and ethernet device name were
      accidentally swapped in the message informing of success creating the
      bridge.
      4a923600
    • D
      Workaround python header file insanity · 1d4c4d9d
      Daniel P. Berrange 提交于
      The /usr/include/python/pyconfig.h file pollutes the global
      namespace with a huge number of HAVE_XXX and WITH_XXX
      defines. These change what we detected in our own config.h
      In particular if you try to build without DTrace, python's
      headers turn it back on with predictable fail.
      
      THe hack to workaround this is to rename WITH_DTRACE to
      WITH_DTRACE_PROBES to avoid the namespace clash
      1d4c4d9d
    • D
      Improve error reporting when virsh console is run without a TTY · af6b61ba
      Daniel P. Berrange 提交于
      If attempting to run
      
        ssh root@somehost virsh console someguest
      
      You'll get an error
      
        2012-02-15 13:11:47.683+0000: 4765: info : libvirt version: 0.9.10, package: 1.fc18 (Unknown, 2012-02-15-11:48:57, lettuce.camlab.fab.redhat.com)
        2012-02-15 13:11:47.683+0000: 4765: error : vshRunConsole:320 : unable to get tty attributes: Invalid argument
        Connected to domain f16x86_64
        Escape character is ^]
      
      There are several problems here
      
       - The actual error message is bad for users
       - We shouldn't rely on VIR_ERROR for this case
       - The prompt makes it look like we still connected
         because we didn't flush stdout.
      
      * virsh.c: Flush stdout before starting console and check
        for a valid tty
      af6b61ba
    • C
      Error out when using SPICE TLS with spice_tls=0 · eda0fc7a
      Christophe Fergeau 提交于
      It's possible to disable SPICE TLS in qemu.conf. When this happens,
      libvirt ignores any SPICE TLS port or x509 directory that may have
      been set when it builds the qemu command line to use. However, it's
      not ignoring the secure channels that may have been set and adds
      tls-channel arguments to qemu command line.
      Current qemu versions don't report an error when this happens, and try to use
      TLS for the specified channels.
      
      Before this patch
      
      <domain type='kvm'>
        <name>auto-tls-port</name>
        <memory>65536</memory>
        <os>
          <type arch='x86_64' machine='pc'>hvm</type>
        </os>
        <devices>
          <graphics type='spice' port='5900' tlsPort='-1' autoport='yes' listen='0' ke
            <listen type='address' address='0'/>
            <channel name='main' mode='secure'/>
            <channel name='inputs' mode='secure'/>
          </graphics>
        </devices>
      </domain>
      
      generates
      
      -spice port=5900,addr=0,disable-ticketing,tls-channel=main,tls-channel=inputs
      
      and starts QEMU.
      
      After this patch, an error is reported if a TLS port is set in the XML
      or if secure channels are specified but TLS is disabled in qemu.conf.
      This is the behaviour the oVirt people (where I spotted this issue) said
      they would expect.
      
      This fixes bug #790436
      eda0fc7a
  5. 24 2月, 2012 2 次提交
    • J
      vmx: Better Workstation vmx handling · f246cdb5
      Jean-Baptiste Rouault 提交于
      This patch adds support for vmx files with empty networkName
      values (which is the case for vmx generated by Workstation).
      It also adds support for vmx containing NATed network interfaces.
      
      Update test suite accordingly
      f246cdb5
    • B
      virterror: Misleading error message when name is missing · cff5573d
      Benjamin Cama 提交于
      [forwarding this here from RH bug #796732]
      
      When creating a network (virsh net-create) with an erroneous XML
      containing an empty <name> element, the error message is misleading:
      
      error: Failed to create network from foo.xml
      error: missing domain name information
      
      It took me a bit of time to figure out that it was the *network* name
      that was missing (I generate this xml and didn't look at it, first).
      
      I realized that the same message is used for missing name when creating
      a domain, network, or device node.
      cff5573d