1. 18 3月, 2015 7 次提交
    • P
      conf: disk: Simplify checking if source definition was parsed · 7a8f54bf
      Peter Krempa 提交于
      Previously we had to check for 3 fields to see if the source was filled.
      Repurpose one of the variables as a boolean flag and use it instead of
      combining multiple sources.
      
      For the condition that checks that only CDROM/FLOPPY drives can be empty
      we can use the virStorageSourceIsEmpty() helper.
      7a8f54bf
    • P
      util: storage: Fix check for empty storage device · 158340e2
      Peter Krempa 提交于
      If the storage device type is parsed as network our parser still allows
      it to omit the <source> element. The empty drive check would not trigger
      on such device as it expects that every network storage source is valid.
      
      Use VIR_STORAGE_NET_PROTOCOL_NONE as a marker that the storage source is
      empty.
      158340e2
    • P
      qemu: driver: Fix cold-update of removable storage devices · d0dc6c03
      Peter Krempa 提交于
      Only selected fields from the disk source were copied when cold updating
      source in a CDROM drive. When such drive was backed by a network file
      this resulted into corruption of the definition:
      
          <disk type='network' device='cdrom'>
            <driver name='qemu' type='raw' cache='none'/>
            <source protocol='gluster' name='gluster-vol1(null)'>
              <host name='localhost'/>
            </source>
            <target dev='vdc' bus='virtio'/>
            <readonly/>
            <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
          </disk>
      
      Update the whole source instead of cherry-picking elements.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1166024
      d0dc6c03
    • P
      e7974b4f
    • P
      virsh: domain: Fix the change-media command · f4b5f530
      Peter Krempa 提交于
      The command did not modify the disk type and thus didn't allow to change
      media from a file image to a block backed image or vice versa. In
      addition when operating on a network backed removable devices the
      command would replace the while <source> subelement with an invalid one.
      
      This patch adds the --block option that allows to specify that the new
      image is block backed and assumes that without that option all images
      are file backed. Since network backends were always mangled it should
      not cause problems.
      f4b5f530
    • P
      virsh: domain: Add --print-xml flag for command change-media · 4cbcaffb
      Peter Krempa 提交于
      Allow printing the XML that would be used mostly for debugging purposes.
      4cbcaffb
    • P
      virsh: domain: Don't use vshPrepareDiskXML for creating XML to detach disk · 1cc82093
      Peter Krempa 提交于
      Since cmdDetachDisk() calls into vshPrepareDiskXML() with
      type == VSH_PREPARE_DISK_XML_NONE && source == NULL this would result
      into skipping all the checks and effectively turn the function into a
      XML formatter.
      
      This patch changes the code to use the formatter directly so that the
      function can be refactored in a easier way.
      1cc82093
  2. 17 3月, 2015 18 次提交
    • M
      parallels_sdk.c: minor cleanup · 50bdad66
      Maxim Nestratov 提交于
      Fix indentation in prlsdkGetNetInf()o, remove unnecessary error
      message in prlsdkDomainChangeState(), remove unnecessary job
      freeing in prlsdkLoadDomains().
      Signed-off-by: NMaxim Nestratov <mnestratov@parallels.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      50bdad66
    • N
      domifaddr: Add virsh support · 2f36e694
      Nehal J Wani 提交于
      tools/virsh-domain-monitor.c
         * Introduce new command : domifaddr
           Usage: domifaddr <domain> [interface] [--full] [--source lease|agent]
      
           Example outputs:
           virsh # domifaddr f20
           Name       MAC address          Protocol     Address
           -------------------------------------------------------------------------------
           lo         00:00:00:00:00:00    ipv4         127.0.0.1/8
           -          -                    ipv6         ::1/128
           vnet0      52:54:00:2e:45:ce    ipv4         10.1.33.188/24
           -          -                    ipv6         2001:db8:0:f101::2/64
           -          -                    ipv6         fe80::5054:ff:fe2e:45ce/64
           vnet1      52:54:00:b1:70:19    ipv4         192.168.105.201/16
           -          -                    ipv4         192.168.201.195/16
           -          -                    ipv6         fe80::5054:ff:feb1:7019/64
           vnet2      52:54:00:36:2a:e5    N/A          N/A
           vnet3      52:54:00:20:70:3d    ipv4         192.168.105.240/16
           -          -                    ipv6         fe80::5054:ff:fe20:703d/64
      
           virsh # domifaddr f20 eth1 --source lease
           Name       MAC address          Protocol     Address
           -------------------------------------------------------------------------------
           vnet1      52:54:00:b1:70:19    ipv4         192.168.105.201/16
           -          -                    ipv4         192.168.201.195/16
           -          -                    ipv6         fe80::5054:ff:feb1:7019/64
      
           virsh # domifaddr f20 eth0 --source agent --full
           Name       MAC address          Protocol     Address
           -------------------------------------------------------------------------------
           eth0       52:54:00:2e:45:ce    ipv4         10.1.33.188/24
           eth0       52:54:00:2e:45:ce    ipv6         2001:db8:0:f101::2/64
           eth0       52:54:00:2e:45:ce    ipv6         fe80::5054:ff:fe2e:45ce/64
      
      tools/virsh.pod
         * Document new command
      Signed-off-by: NNehal J Wani <nehaljw.kkd1@gmail.com>
      2f36e694
    • N
      domifaddr: Implement the API for qemu · 0977b8aa
      Nehal J Wani 提交于
      By querying the qemu guest agent with the QMP command
      "guest-network-get-interfaces" and converting the received JSON
      output to structured objects.
      
      Although "ifconfig" is deprecated, IP aliases created by "ifconfig"
      are supported by this API. The legacy syntax of an IP alias is:
      "<ifname>:<alias-name>". Since we want all aliases to be clubbed
      under parent interface, simply stripping ":<alias-name>" suffices.
      Note that IP aliases formed by "ip" aren't visible to "ifconfig",
      and aliases created by "ip" do not have any specific name. But
      we are lucky, as qemu guest agent detects aliases created by both.
      
      src/qemu/qemu_agent.h:
        * Define qemuAgentGetInterfaces
      
      src/qemu/qemu_agent.c:
        * Implement qemuAgentGetInterface
      
      src/qemu/qemu_driver.c:
        * New function qemuGetDHCPInterfaces
        * New function qemuDomainInterfaceAddresses
      
      src/remote_protocol-sructs:
        * Define new structs
      
      tests/qemuagenttest.c:
        * Add new test: testQemuAgentGetInterfaces
          Test cases for IP aliases, 0 or multiple ipv4/ipv6 address(es)
      Signed-off-by: NNehal J Wani <nehaljw.kkd1@gmail.com>
      0977b8aa
    • N
      domifaddr: Implement the remote protocol · 71546d17
      Nehal J Wani 提交于
      daemon/remote.c
         * Define remoteSerializeDomainInterface, remoteDispatchDomainInterfaceAddresses
      
      src/remote/remote_driver.c
         * Define remoteDomainInterfaceAddresses
      
      src/remote/remote_protocol.x
         * New RPC procedure: REMOTE_PROC_DOMAIN_INTERFACE_ADDRESSES
         * Define structs remote_domain_ip_addr, remote_domain_interface,
           remote_domain_interfaces_addresse_args, remote_domain_interface_addresses_ret
         * Introduce upper bounds (to handle DoS attacks):
           REMOTE_DOMAIN_INTERFACE_MAX = 2048
           REMOTE_DOMAIN_IP_ADDR_MAX = 2048
           Restrictions on the maximum number of aliases per interface were
           removed after kernel v2.0, and theoretically, at present, there
           are no upper limits on number of interfaces per virtual machine
           and on the number of IP addresses per interface.
      
      src/remote_protocol-structs
         * New structs added
      Signed-off-by: NNehal J Wani <nehaljw.kkd1@gmail.com>
      71546d17
    • N
      domifaddr: Implement the public APIs · 5b5242a7
      Nehal J Wani 提交于
      Define helper function virDomainInterfaceFree, which allows
      the upper layer application to free the domain interface object
      conveniently.
      
      The API is going to provide multiple methods by flags, e.g.
        * Query guest agent
        * Parse DHCP lease file
      
      include/libvirt/libvirt-domain.h
        * Define virDomainInterfaceAddresses, virDomainInterfaceFree
        * Define structs virDomainInterface, virDomainIPAddress
      
      src/driver-hypervisor.h:
        * Define domainInterfaceAddresses
      
      src/libvirt-domain.c:
        * Implement virDomainInterfaceAddresses
        * Implement virDomainInterfaceFree
      
      src/libvirt_public.syms:
        * Export the new symbols
      Signed-off-by: NNehal J Wani <nehaljw.kkd1@gmail.com>
      5b5242a7
    • M
      parallels: fix home directory for VMs · b980c34d
      Maxim Nestratov 提交于
      Failures of parallelsStorageOpen occured because we incorrectly treated
      path to VM' configuration file as a directory. Now initialization of
      parallels VM domains home directory is fixed.
      Signed-off-by: NMaxim Nestratov <mnestratov@parallels.com>
      b980c34d
    • M
    • M
      parallels: set cpu mode when applying xml configuration · 7bf69e02
      Mikhail Feoktistov 提交于
      Otherwise exporting existing domain config and defining a new one like this:
      virsh -c parallels:///system dumpxml instance01 > my.xml
      virsh -c parallels:///system define my.xml
      leads to an error because PCS default x64 mode turns to x32.
      Thus, we need to set correct cpuMode in prlsdkDoApplyConfig() explicitly.
      Signed-off-by: NMikhail Feoktistov <mfeoktistov@parallels.com>
      Signed-off-by: NMaxim Nestratov <mnestratov@parallels.com>
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      7bf69e02
    • M
      conf: Use correct type for balloon stats period · ad69e8be
      Martin Kletzander 提交于
      We're parsing memballoon status period as unsigned int, but when we're
      trying to set it, both we and qemu use signed int.  That means large
      values will get wrapped around to negative one resulting in error.
      Basically the same problem as commit e3a7b874 was dealing with when
      updating live domain.
      
      QEMU changed the accepted value to int64 in commit 1f9296b5, but even
      values as INT_MAX don't make sense since the value passed means seconds.
      Hence adding capability flag for this change isn't worth it.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1140958Signed-off-by: NLuyao Huang <lhuang@redhat.com>
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      ad69e8be
    • M
      qemu: Don't duplicate errors when settings stats period · 4fca30e0
      Martin Kletzander 提交于
      In order not to leave old error messages set, this patch refactors the
      code so the error is reported only when acted upon.  The only such place
      already rewrites any error, so cleaning up all the error reporting in
      qemuMonitorSetMemoryStatsPeriod() is enough.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      4fca30e0
    • M
      conf: Reorder elements inside memballoon · 02ce97bc
      Martin Kletzander 提交于
      All the devices we have format their address as its last sub-element, so
      let's change memballoon to follow suit.  Also adjust RNG to allow any
      order of them so 'virsh edit' doesn't shout at us.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      02ce97bc
    • M
      util: Make sure the comment about virBufferAddBuffer is true · 3a13e4f1
      Martin Kletzander 提交于
      Change it so it really *always* eats the @toadd buffer.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      3a13e4f1
    • P
      wireshark: fix VPATH build · 57f726a5
      Pavel Hrdina 提交于
      Add $(top_builddir) paths to INCLUDES to fix VPATH build.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      57f726a5
    • L
      qemu_command: Fix some indentation and a typo · 4acd2bce
      Luyao Huang 提交于
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      4acd2bce
    • P
      rpm-build: use pkg-config to detect wireshark presence · 37397320
      Pavel Hrdina 提交于
      Wireshark supports pkg-config since 1.11.3.  Right now we build
      wireshark-dissectior tool as default trough rpm build only on
      fedora >= 21 and there is new wireshark that supports pkg-config.
      If someone wants to build libvirt with wireshark-dissector against old
      wireshark, they should specify the location by hand.
      
      This patch is mainly to fix wrong dependency on wireshark binary as it
      doesn't make sense to require that binary file to just get version info
      of that package in makefile.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      37397320
    • J
      libxl: fix regression introduced by commit 4ab8cd77 · a7d6b94a
      Jim Fehlig 提交于
      Commit 4ab8cd77 added a check requiring input devices to have
      a bus type of VIR_DOMAIN_INPUT_BUS_USB, failing to start the
      domain otherwise.  But virDomainDefParseXML adds implicit mouse
      and keyboard if a graphics device is configured.  See calls to
      virDomainDefMaybeAddInput.
      
      The regression is fixed by removing the check requiring USB input
      devices, and skipping non-USB input devices when populating USB
      'usbdevice' in libxl_domain_build_info struct.
      a7d6b94a
    • P
      qemu: block-commit: Mark disk in block jobs only on successful command · ee744b5b
      Peter Krempa 提交于
      Patch 51f9f03a introduces a regression
      where if a blockCommit operation fails the disk is still marked as being
      part of a block job but can't be unmarked later.
      ee744b5b
    • E
      daemon: avoid memleak when ListAll returns nothing · 3c2ff502
      Eric Blake 提交于
      Commit 4f25146b (v1.2.8) managed to silence Coverity, but at the
      cost of a memory leak detected by valgrind:
      ==24129== 40 bytes in 5 blocks are definitely lost in loss record 355 of 637
      ==24129==    at 0x4A08B1C: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==24129==    by 0x5084B8E: virReallocN (viralloc.c:245)
      ==24129==    by 0x514D5AA: virDomainObjListExport (domain_conf.c:22200)
      ==24129==    by 0x201227DB: qemuConnectListAllDomains (qemu_driver.c:18042)
      ==24129==    by 0x51CC1B6: virConnectListAllDomains (libvirt-domain.c:6797)
      ==24129==    by 0x14173D: remoteDispatchConnectListAllDomains (remote.c:1580)
      ==24129==    by 0x121BE1: remoteDispatchConnectListAllDomainsHelper (remote_dispatch.h:1072)
      
      In short, every time a client calls a ListAll variant and asks
      for the resulting list, but there are 0 elements to return, we
      end up leaking the 1-entry array that holds the NULL terminator.
      
      What's worse, a read-only client can access these functions in a
      tight loop to cause libvirtd to eventually run out of memory; and
      this can be considered a denial of service attack against more
      privileged clients.  Thankfully, the leak is so small (8 bytes per
      call) that you would already have some other denial of service with
      any guest calling the API that frequently, so an out-of-memory
      crash is unlikely enough that this did not warrant a CVE.
      
      * daemon/remote.c (remoteDispatchConnectListAllDomains)
      (remoteDispatchDomainListAllSnapshots)
      (remoteDispatchDomainSnapshotListAllChildren)
      (remoteDispatchConnectListAllStoragePools)
      (remoteDispatchStoragePoolListAllVolumes)
      (remoteDispatchConnectListAllNetworks)
      (remoteDispatchConnectListAllInterfaces)
      (remoteDispatchConnectListAllNodeDevices)
      (remoteDispatchConnectListAllNWFilters)
      (remoteDispatchConnectListAllSecrets)
      (remoteDispatchNetworkGetDHCPLeases): Plug leak.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      3c2ff502
  3. 16 3月, 2015 15 次提交