1. 11 12月, 2012 33 次提交
    • D
      parallels: parse information about network interfaces · 8ce9e2ab
      Dmitry Guryanov 提交于
      Parse network interfaces info from prlctl output.
      
      Parallels Cloud Server uses virtual networks model for
      network configuration: You can add network adapter to
      VM and connect it to some predefined virtual network.
      
      Fill type, mac, network name and linkstate fields of
      virDomainNetDef structure.
      Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
      8ce9e2ab
    • P
      qemu: snapshot: Remove memory image if external checkpoint fails · a912977a
      Peter Krempa 提交于
      When the disk snapshot part of an external system checkpoint fails the
      memory image is retained. This patch adds code to remove the image in
      such case.
      a912977a
    • P
      qemu: snapshot: Don't leak XML definition if restarting of CPUs fails · d5b28287
      Peter Krempa 提交于
      In case the snapshot code isn't able to restart CPUs after an external
      checkpoint we would leak a copy of the domains XML definition. This
      patch fixes the cleanup path.
      d5b28287
    • J
      qemu: fix uninitialized variable warning in doPeer2PeerMigrate · 07b64de5
      Ján Tomko 提交于
      False positive, but it breaks the build with gcc-4.6.3.
      
      qemu/qemu_migration.c:2931:37: error: 'offline' may be used
      uninitialized in this function [-Werror=uninitialized]
      qemu/qemu_migration.c:2887:10: note: 'offline' was declared here
      07b64de5
    • J
      80756876
    • J
      examples: Fix balloon event callback · d648b056
      Jiri Denemark 提交于
      d648b056
    • G
      network: put dnsmasq parameters in conf-file instead of command line · 8b32c80d
      Gene Czarcinski 提交于
      This patch changes how parameters are passed to dnsmasq.  Instead of
      being on the command line, the parameters are put into a file (one
      parameter per line) and a commandline --conf-file= specifies the
      location of the file.  The file is located in the same directory as
      the leases file.
      
      Putting the dnsmasq parameters into a configuration file
      allows them to be examined and more easily understood than
      examining the command lines displayed by "ps ax".  This is
      especially true when a number of networks have been started.
      
      When the use of dnsmasq was originally done, the required command line
      was simple, but it has gotten more complicated over time and will
      likely become even more complicated in the future.
      
      Note: The test conf files have all been renamed .conf instead of
      .argv, and tests/networkxml2xmlargvdata was moved to
      tests/networkxml2xmlconfdata.
      8b32c80d
    • G
      network: add support for DHCPv6 · 2d5cd1d7
      Gene Czarcinski 提交于
      The DHCPv6 support includes IPV6 dhcp-range and dhcp-host for one
      IPv6 subnetwork on one interface.  This support will only work
      if dnsmasq version >= 2.64; otherwise an error occurs if
      dhcp-range or dhcp-host is specified for an IPv6 address.
      
      Essentially, this change provides the same DHCP support for IPv6
      that has been available for IPv4.
      
      With dnsmasq >= 2.64, support for the RA service is also now provided
      by dnsmasq (radvd is no longer used/started). (Although at least one
      version of dnsmasq prior to 2.64 "supported" IPv6 Router
      Advertisement, there were bugs (fixed in 2.64) that rendered it
      unusable.)
      
      Documentation and the network schema has been updated
      to reflect the new support.
      2d5cd1d7
    • L
      conf: split <forward> parser/clear into separate functions · 71e30eff
      Laine Stump 提交于
      virNetworkDefUpdateForward requires separate functions to parse and
      clear a virNetworkForwardDef by itself, but they were previously just
      inlined in the virNetworkDef parse and free functions. This patch
      makes them into separate functions.
      71e30eff
    • L
      conf: put data for network <forward> element into its own struct · 47c94b65
      Laine Stump 提交于
      The attributes of a <network> element's <forward> element were
      previously stored directly in the virNetworkDef object, but
      virNetworkUpdateForward() needs to operate on a <forward> in
      isolation, so this patchs pulls out all those attributes into a
      separate virNetworkForwardDef struct (and shortens their names
      appropriately). This new object is contained in the virNetworkDef, not
      pointed to by it, so there is no extra memory management.
      
      This patch makes no functional changes, it only changes, e.g.,
      "nForwardIfs" to "forward.nifs".
      47c94b65
    • L
      conf: make virNetworkIpDefClear consistent with other functions · 31d21197
      Laine Stump 提交于
      The other clear functions in network_conf.c that clear out arrays of
      sub-objects do so by using the n[itemname]s value as a counter going
      down to 0. Make this one consistent. There's no functional value, just
      makes the style more consistent with the rest of the file.
      31d21197
    • L
      conf: rename some labels and functions in network_conf · dc9d8d68
      Laine Stump 提交于
      This makes some function names and arg lists for consistent with other
      parse functions in network_conf.c. While modifying
      virNetworkIPParseXML(), also change its "error" label to "cleanup",
      since the code at that label is executed on success as well as
      failure.
      dc9d8d68
    • L
      network: backend functions for updating network dns host/srv/txt · fc19a005
      Laine Stump 提交于
      These three functions are very similar - none allow a MODIFY
      operation; you can only add or delete.
      
      The biggest difference between them (other than the data itself) is in
      the criteria for determining a match, and whether or not multiple
      matches are possible:
      
      1) for HOST records, it's considered a match if the IP address or any
      of the hostnames of an existing record matches.
      
      2) for SRV records, it's a match if all of
      domain+service+protocol+target *which have been specified* are
      matched.
      
      3) for TXT records, there is only a single field to match - name
      (value can be the same for multiple records, and isn't considered a
      search term), so by definition there can be no ambiguous matches.
      
      In all three cases, if any matches are found, ADD will fail; if
      multiple matches are found, it means the search term was ambiguous,
      and a DELETE will fail.
      
      The upper level code in bridge_driver.c is already implemented for
      these functions - appropriate conf files will be re-written, and
      dnsmasq will be SIGHUPed or restarted as appropriate.
      fc19a005
    • L
      conf: clear and parse functions for dns host/srv/txt records · ab297bec
      Laine Stump 提交于
      Since there is only a single virNetworkDNSDef for any virNetworkDef,
      and it's trivial to determine whether or not it contains any real
      data, it's much simpler (and fits more uniformly with the parse
      function calling sequence of the parsers for many other objects that
      are subordinates of virNetworkDef) if virNetworkDef *contains* an
      virNetworkDNSDef rather than pointing to one.
      
      Since it is now just a part of another object rather than its own
      object, it no longer makes sense to have a *Free() function, so that
      is changed to a *Clear() function.
      
      More importantly though, ParseXML and Clear functions are needed for
      the individual items contained in a virNetworkDNSDef (srv, txt, and
      host records), but none of them have a *Clear(), and only two of the
      three had *ParseXML() functions (both of which used a non-uniform
      arglist). Those problems are cleared up by this patch - it splits the
      higher-level Clear function into separate functions for each of the
      three, creates a parse for txt records, and cleans up the srv and host
      parsers, so we now have all the utility functions necessary to
      implement virNetworkDefUpdateDNS(Host|Srv|Txt).
      ab297bec
    • L
      conf: rename network dns host/srv/txt arrays · 8b7d1874
      Laine Stump 提交于
      This shortens the name of the structs for srv and txt, and their
      instances in virNetworkDNSDef, to be more compact and uniform with the
      naming of the dns host array. It also changes the type of ntxts, etc
      from unsigned int to size_t, so that they can be used directly as args
      to VIR_*_ELEMENT.
      8b7d1874
    • L
      conf: use VIR_(INSERT|DELETE)_ELEMENT in virNetworkUpdate backend · 2dc5839a
      Laine Stump 提交于
      The already-written backend functions for virNetworkUpdate that add
      and delete items into lists within the a network were already debugged
      to work properly, but future such functions will use
      VIR_(INSERT|DELETE)_ELEMENT instead, so these are changed for
      uniformity.
      2dc5839a
    • L
      util: add VIR_(APPEND|INSERT|DELETE)_ELEMENT · 85b22f52
      Laine Stump 提交于
      I noticed when writing the backend functions for virNetworkUpdate that
      I was repeating the same sequence of memmove, VIR_REALLOC, nXXX-- (and
      messed up the args to memmove at least once), and had seen the same
      sequence in a lot of other places, so I decided to write a few
      utility functions/macros - see the .h file for full documentation.
      
      The intent is to reduce the number of lines of code, but more
      importantly to eliminate the need to check the element size and
      element count arithmetic every time we need to do this (I *always*
      make at least one mistake.)
      
      VIR_INSERT_ELEMENT: insert one element at an arbitrary index within an
        array of objects. The size of each object is determined
        automatically by the macro using sizeof(*array). The new element's
        contents are copied into the inserted space, then the original copy
        of contents are 0'ed out (if everything else was
        successful). Compile-time assignment and size compatibility between
        the array and the new element is guaranteed (see explanation below
        [*])
      
      VIR_INSERT_ELEMENT_COPY: identical to VIR_INSERT_ELEMENT, except that
        the original contents of newelem are not cleared to 0 (i.e. a copy
        is made).
      
      VIR_APPEND_ELEMENT: This is just a special case of VIR_INSERT_ELEMENT
        that "inserts" one past the current last element.
      
      VIR_APPEND_ELEMENT_COPY: identical to VIR_APPEND_ELEMENT, except that
        the original contents of newelem are not cleared to 0 (i.e. a copy
        is made).
      
      VIR_DELETE_ELEMENT: delete one element at an arbitrary index within an
        array of objects. It's assumed that the element being deleted is
        already saved elsewhere (or cleared, if that's what is appropriate).
      
      All five of these macros have an _INPLACE variant, which skips the
      memory re-allocation of the array, assuming that the caller has
      already done it (when inserting) or will do it later (when deleting).
      
      Note that VIR_DELETE_ELEMENT* can return a failure, but only if an
      invalid index is given (index + amount to delete is > current array
      size), so in most cases you can safely ignore the return (that's why
      the helper function virDeleteElementsN isn't declared with
      ATTRIBUTE_RETURN_CHECK). A warning is logged if this ever happens,
      since it is surely a coding error.
      
      [*] One initial problem with the INSERT and APPEND macros was that,
      due to both the array pointer and newelem pointer being cast to void*
      when passing to virInsertElementsN(), any chance of type-checking was
      lost. If we were going to move in newelem with a memmove anyway, we
      would be no worse off for this. However, most current open-coded
      insert/append operations use direct struct assignment to move the new
      element into place (or just populate the new element directly) - thus
      use of the new macros would open a possibility for new usage errors
      that didn't exist before (e.g. accidentally sending &newelemptr rather
      than newelemptr - I actually did this quite a lot in my test
      conversions of existing code).
      
      But thanks to Eric Blake's clever thinking, I was able to modify the
      INSERT and APPEND macros so that they *do* check for both assignment
      and size compatibility of *ptr (an element in the array) and newelem
      (the element being copied into the new position of the array). This is
      done via clever use of the C89-guaranteed fact that the sizeof()
      operator must have *no* side effects (so an assignment inside sizeof()
      is checked for validity, but not actually evaluated), and the fact
      that virInsertElementsN has a "# of new elements" argument that we
      want to always be 1.
      85b22f52
    • P
      qemu: Restart CPUs with valid async job type when doing external snapshots · 46b0c933
      Peter Krempa 提交于
      When restarting CPUs after an external snapshot, the restarting function
      was called without the appropriate async job type. This caused that a
      new sync job wasn't created and allowed races in the monitor.
      46b0c933
    • D
      parallels: add support of removing disks · 84e27a6f
      Dmitry Guryanov 提交于
      If some hard disk is not found in new domain configuration, it
      should be removed.
      Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
      84e27a6f
    • D
      parallels: apply config after VM creation · d5c4783c
      Dmitry Guryanov 提交于
      New VM will have default values for all parameters, like
      cpu number, we have to change its configuration as provided
      by xml definition, given to parallelsDomainDefineXML.
      Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
      d5c4783c
    • D
      parallels: add support of disks creation · b4f0c19e
      Dmitry Guryanov 提交于
      Implement creation of new disks - if a new disk found
      in configuration, find a volume by disk path and
      actually create a disk image by issuing prlctl command.
      If it's successfully finished - remove the file with volume
      definition.
      Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
      b4f0c19e
    • D
      parallels: add function parallelsGetDiskBusName · 592664c1
      Dmitry Guryanov 提交于
      Add function for convertion bus from libvirt's numeric constant
      to a name, used in a parallels command-line tools.
      Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
      592664c1
    • D
      parallels: split parallelsStorageVolumeDelete function · 944705e2
      Dmitry Guryanov 提交于
      Move part, which deletes existing volume, to a new function
      parallelsStorageVolumeDefRemove so that we can use it later
      in parallels_driver.c
      Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
      944705e2
    • D
      parallels: fill volumes capacity parameter · a9bd9b94
      Dmitry Guryanov 提交于
      Read disk images size from xml description and fill
      virStorageVolDef.capacity and allocation (let's consider
      that allocation is the same as capacity, calculating real
      allcoation will be implemented later).
      Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
      a9bd9b94
    • D
      parallels: add info about volumes · 9b4c03ae
      Dmitry Guryanov 提交于
      Disk images in Parallels Cloud Server stored in directories. Each
      one has files with data and xml description of an image stored in
      file DiskDescriptior.xml.
      
      Since we have to support 'detached' images, which are not used by
      any VM, the better way to collect info about volumes is searching for
      directories with a file DiskDescriptior.xml in each VM directory.
      Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
      9b4c03ae
    • D
      parallels: fix leaks in parallelsFindVolumes · 7abe342d
      Dmitry Guryanov 提交于
      We always have to close opened dir and free 'path'.
      Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
      7abe342d
    • D
      parallels: create storage pools by VM list · 766e0c91
      Dmitry Guryanov 提交于
      There are no storage pools in Parallels Cloud Server -
      All VM data stored in a single directory: config, snapshots,
      memory dump together with disk images.
      
      Let's look through list of VMs and create a storage pool for
      each directory, containing VMs.
      
      So if you have 3 vms: /var/parallels/vm-1.pvm,
      /var/parallels/vm-2.pvm and /root/test.pvm - 2 storage pools
      appear: -var-parallels and -root. xml descriptions of the pools
      will be saved in /etc/libvirt/parallels-storage, so UUIDs will
      not change netween connections to libvirt.
      Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
      766e0c91
    • D
      parallels: remove unused code from storage driver · 4dc52e1e
      Dmitry Guryanov 提交于
      We don't support unprivileged users anymore, so remove code, which
      selects configuration directory depending on user.
      Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
      4dc52e1e
    • D
      parallels: split parallelsStorageOpen function · 21e1bdeb
      Dmitry Guryanov 提交于
      Move code for loading inforation about pools to a separate
      function - parallelsLoadPools.
      Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
      21e1bdeb
    • D
      parallels: handle disk devices in parallelsDomainDefineXML · 45e63171
      Dmitry Guryanov 提交于
      Allow changing some parameters of the hard disks: bus,
      image and drive address.
      
      Creating new disk devices and removing existing ones
      require changes in the storage driver, so it will be
      implemented later.
      Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
      45e63171
    • D
      parallels: add info about hard disk devices · 6718b2d7
      Dmitry Guryanov 提交于
      Parse information about hard disks and fill disks array
      in virDomainDef structure.
      Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
      6718b2d7
    • L
      Add support for offline migration · 8b9bf787
      liguang 提交于
      Offline migration transfers inactive definition of a domain (which may
      or may not be active). After successful completion, the domain remains
      in its current state on source host and is defined but inactive on
      destination host. It's a bit more clever than virDomainGetXMLDesc() on
      source host followed by virDomainDefineXML() on destination host, as
      offline migration will run pre-migration hook to update the domain XML
      on destination host. Currently, copying non-shared storage is not
      supported during offline migration.
      
      Offline migration can be requested with a new migration flag called
      VIR_MIGRATE_OFFLINE (which has to be combined with
      VIR_MIGRATE_PERSIST_DEST flag).
      8b9bf787
    • L
      qemu: eliminate bogus error log when changing netdev's bridge · e5577872
      Laine Stump 提交于
      This fixes a problem that showed up during testing of:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=881480
      
      Due to a logic error in the function that gets the name of the bridge
      an interface connects to, any time a bridge was specified directly
      (type='bridge') rather than indirectly (type='network'), An error
      would be logged (although the operation would then complete
      successfully):
      
         Network type 6 is not supported
      
      The final virReportError() in the function
      qemuDomainNetGetBridgeName() was apparently avoided in the past with a
      "goto cleanup" at the end of each case, but the case of bridge somehow
      no longer has that final goto cleanup.
      
      The proper solution is anyway to not rely on goto's, but put the error
      log inside an else {} clause, so that it's executed only if the type
      is neither bridge nor network (in reality, this function should only
      ever be called for those two types, that's why this is an internal
      error).
      
      While making this change, the error message was also tuned to be more
      correct (since it's not really the type of the network, but the type
      of the interface, and it *is* otherwise supported, it's just that the
      interface type in question doesn't *have* a bridge device associated
      with it, or at least we don't know how to get it).
      e5577872
  2. 10 12月, 2012 2 次提交
  3. 08 12月, 2012 1 次提交
  4. 07 12月, 2012 4 次提交
    • P
      virsh: Fix usage of header termios.h · 989a427d
      Peter Krempa 提交于
      The termios struct exported by the termios.h header is used as an
      argument for vshMakeStdinRaw(). The header isn't used anywhere in
      tools/virsh-domain.c.
      
      This patch adds the header to the header declaring vshMakeStdinRaw() and
      removes other places in virsh.
      989a427d
    • J
      virsh: allow metadata preallocation when creating volumes · 790dfee5
      Ján Tomko 提交于
      Add --prealloc-metadata flag to these commands:
      vol-clone
      vol-create
      vol-create-as
      vol-create-from
      790dfee5
    • J
      storage: allow metadata preallocation when creating qcow2 images · 1c9a2fb1
      Ján Tomko 提交于
      Add VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA flag to virStorageVolCreateXML
      and virStorageVolCreateXMLFrom. This flag requests metadata
      preallocation when creating/cloning qcow2 images, resulting in creating
      a sparse file with qcow2 metadata. It has only slightly larger disk usage
      compared to new image with no allocation, but offers higher performance.
      1c9a2fb1
    • O
      qemu: Allow the user to specify vendor and product for disk · b718ded3
      Osier Yang 提交于
      QEMU supports setting vendor and product strings for disk since
      1.2.0 (only scsi-disk, scsi-hd, scsi-cd support it), this patch
      exposes it with new XML elements <vendor> and <product> of disk
      device.
      b718ded3