1. 08 4月, 2013 2 次提交
    • O
      New XML attributes for storage pool source adapter · 9f781da6
      Osier Yang 提交于
      This introduces 4 new attributes for storage pool source adapter.
      E.g.
      
      <adapter type='fc_host' parent='scsi_host5' wwnn='20000000c9831b4b' wwpn='10000000c9831b4b'/>
      
      Attribute 'type' can be either 'scsi_host' or 'fc_host', and defaults
      to 'scsi_host' if attribute 'name' is specified. I.e. It's optional
      for 'scsi_host' adapter, for back-compat reason. However, mandatory
      for 'fc_host' adapter and any new future adapter types. Attribute
      'parent' is to specify the parent for the fc_host adapter.
      
      * docs/formatstorage.html.in:
        - Add documents for the 4 new attrs
      * docs/schemas/storagepool.rng:
        - Add RNG schema
      * src/conf/storage_conf.c:
        - Parse and format the new XMLs
      * src/conf/storage_conf.h:
        - New struct virStoragePoolSourceAdapter, replace "char *adapter" with it;
        - New enum virStoragePoolSourceAdapterType
      * src/libvirt_private.syms:
        - Export TypeToString and TypeFromString
      * src/phyp/phyp_driver.c:
        - Replace "adapter" with "adapter.data.name", which is member of the union
          of the new struct virStoragePoolSourceAdapter now. Later patch will
          add the checking, as "adapter.data.name" is only valid for "scsi_host"
          adapter.
      * src/storage/storage_backend_scsi.c:
        - Like above
      * tests/storagepoolxml2xmlin/pool-scsi-type-scsi-host.xml:
      * tests/storagepoolxml2xmlin/pool-scsi-type-fc-host.xml:
        - New test for 'fc_host' and "scsi_host" adapter
      * tests/storagepoolxml2xmlout/pool-scsi.xml:
        - Change the expected output, as the 'type' defaults to 'scsi_host' if 'name"
          specified now
      * tests/storagepoolxml2xmlout/pool-scsi-type-scsi-host.xml:
      * tests/storagepoolxml2xmlout/pool-scsi-type-fc-host.xml:
        - New test
      * tests/storagepoolxml2xmltest.c:
        - Include the test
      9f781da6
    • D
      Disable cast-align warnings in various places · e57aaa6f
      Daniel P. Berrange 提交于
      There are a number of places which generate cast alignment
      warnings, which are difficult or impossible to address. Use
      pragmas to disable the warnings in these few places
      
      conf/nwfilter_conf.c: In function 'virNWFilterRuleDetailsParse':
      conf/nwfilter_conf.c:1806:16: warning: cast increases required alignment of target type [-Wcast-align]
               item = (nwItemDesc *)((char *)nwf + att[idx].dataIdx);
      conf/nwfilter_conf.c: In function 'virNWFilterRuleDefDetailsFormat':
      conf/nwfilter_conf.c:3238:16: warning: cast increases required alignment of target type [-Wcast-align]
               item = (nwItemDesc *)((char *)def + att[i].dataIdx);
      
      storage/storage_backend_mpath.c: In function 'virStorageBackendCreateVols':
      storage/storage_backend_mpath.c:247:17: warning: cast increases required alignment of target type [-Wcast-align]
               names = (struct dm_names *)(((char *)names) + next);
      
      nwfilter/nwfilter_dhcpsnoop.c: In function 'virNWFilterSnoopDHCPDecode':
      nwfilter/nwfilter_dhcpsnoop.c:994:15: warning: cast increases required alignment of target type [-Wcast-align]
               pip = (struct iphdr *) pep->eh_data;
      nwfilter/nwfilter_dhcpsnoop.c:1004:11: warning: cast increases required alignment of target type [-Wcast-align]
           pup = (struct udphdr *) ((char *) pip + (pip->ihl << 2));
      
      nwfilter/nwfilter_learnipaddr.c: In function 'procDHCPOpts':
      nwfilter/nwfilter_learnipaddr.c:327:33: warning: cast increases required alignment of target type [-Wcast-align]
                       uint32_t *tmp = (uint32_t *)&dhcpopt->value;
      nwfilter/nwfilter_learnipaddr.c: In function 'learnIPAddressThread':
      nwfilter/nwfilter_learnipaddr.c:501:43: warning: cast increases required alignment of target type [-Wcast-align]
                           struct iphdr *iphdr = (struct iphdr*)(packet +
      nwfilter/nwfilter_learnipaddr.c:538:43: warning: cast increases required alignment of target type [-Wcast-align]
                           struct iphdr *iphdr = (struct iphdr*)(packet +
      nwfilter/nwfilter_learnipaddr.c:544:48: warning: cast increases required alignment of target type [-Wcast-align]
                               struct udphdr *udphdr= (struct udphdr *)
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      e57aaa6f
  2. 06 4月, 2013 1 次提交
    • O
      qemu: Support multiple queue virtio-scsi · d4bf0a93
      Osier Yang 提交于
      This introduce a new attribute "num_queues" (same with the good name
      QEMU uses) for virtio-scsi controller. An example of the XML:
      
      <controller type='scsi' index='0' model='virtio-scsi' num_queues='8'/>
      
      The corresponding QEMU command line:
      
      -device virtio-scsi-pci,id=scsi0,num_queues=8,bus=pci.0,addr=0x3 \
      d4bf0a93
  3. 05 4月, 2013 10 次提交
    • P
      virCaps: get rid of defaultConsoleTargetType callback · 482e5f15
      Peter Krempa 提交于
      This patch refactors various places to allow removing of the
      defaultConsoleTargetType callback from the virCaps structure.
      
      A new console character device target type is introduced -
      VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE - to mark that no type was
      specified in the XML. This type is at the end converted to the standard
      VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL. Other types that are
      different from this default have to be processed separately in the
      device post parse callback.
      482e5f15
    • P
      virCaps: get rid of macPrefix field · 46becc18
      Peter Krempa 提交于
      Use the virDomainXMLConf structure to hold this data and tweak the code
      to avoid semantic change.
      
      Without configuration the KVM mac prefix is used by default. I chose it
      as it's in the privately administered segment so it should be usable for
      any purposes.
      46becc18
    • P
      virCaps: get rid of hasWideScsiBus · 8960d656
      Peter Krempa 提交于
      Use the virDomainXMLConf structure to hold this data.
      8960d656
    • P
      virCaps: get rid of defaultDiskDriverType · b2990849
      Peter Krempa 提交于
      Use the qemu specific callback to fill this data in the qemu driver as
      it's the only place where it was used and fix tests as the qemu test
      capability object didn't configure the defaults for the tests.
      b2990849
    • P
      virCaps: get rid of emulatorRequired · b5def001
      Peter Krempa 提交于
      This patch removes the emulatorRequired field and associated
      infrastructure from the virCaps object. Instead the driver specific
      callbacks are used as this field isn't enforced by all drivers.
      
      This patch implements the appropriate callbacks in the qemu and lxc
      driver and moves to check to that location.
      b5def001
    • P
      virCaps: get rid of defaultDiskDriverName · 9ea249e7
      Peter Krempa 提交于
      This patch removes the defaultDiskDriverName from the virCaps
      structure. This particular default value is used only in the qemu driver
      so this patch uses the recently added callback to fill the driver name
      if it's needed instead of propagating it through virCaps.
      9ea249e7
    • P
      virCaps: get rid of "defaultInitPath" value in the virCaps struct · 4750c848
      Peter Krempa 提交于
      This gets rid of the parameter in favor of using the new callback
      infrastructure to do the same stuff.
      
      This patch implements the domain adjustment callback in the openVZ
      driver and moves the check from the parser to a new validation method in
      the callback infrastructure.
      4750c848
    • P
      conf callback: Rearrange function parameters · ad0d10b2
      Peter Krempa 提交于
      Move the xmlopt and caps arguments to the end of the argument list.
      ad0d10b2
    • P
      conf: Add post XML parse callbacks and prepare for cleaning of virCaps · 43b99fc4
      Peter Krempa 提交于
      This patch adds instrumentation that will allow hypervisor drivers to
      fill and validate domain and device definitions after parsed by the XML
      parser.
      
      With this patch, after the XML is parsed, a callback to the driver is
      issued requesting to fill and validate driver specific details of the
      configuration. This allows to use sensible defaults and checks on a per
      driver basis at the time the XML is parsed.
      
      Two callback pointers are stored in the new virDomainXMLConf object:
      * virDomainDeviceDefPostParseCallback (devicesPostParseCallback)
        - called for a single device parsed and for every single device in a
          domain config. A virDomainDeviceDefPtr is passed along with the
          domain definition and virCaps.
      
      * virDomainDefPostParseCallback, (domainPostParseCallback)
        - A callback that is meant to process the domain config after it's
        parsed.  A virDomainDefPtr is passed along with virCaps.
      
      Both types of callbacks support arbitrary opaque data passed for the
      callback functions.
      
      Errors may be reported in those callbacks resulting in a XML parsing
      failure.
      43b99fc4
    • P
      maint: Rename xmlconf to xmlopt and virDomainXMLConfig to virDomainXMLOption · e84b1931
      Peter Krempa 提交于
      This patch is the result of running:
      
      for i in $(git ls-files | grep -v html | grep -v \.po$ ); do
        sed -i -e "s/virDomainXMLConf/virDomainXMLOption/g" -e "s/xmlconf/xmlopt/g" $i
      done
      
      and a few manual tweaks.
      e84b1931
  4. 02 4月, 2013 2 次提交
  5. 28 3月, 2013 2 次提交
    • M
      security_manager: Don't manipulate domain XML in virDomainDefGetSecurityLabelDef · 6c4de116
      Michal Privoznik 提交于
      The virDomainDefGetSecurityLabelDef was modifying the domain XML.
      It tried to find a seclabel corresponding to given sec driver. If the
      label wasn't found, the function created one which is wrong. In fact
      it's security manager which should modify this part of domain XML.
      6c4de116
    • G
      conf: fix memory leak of class_id bitmap · 7a0f5021
      Guannan Ren 提交于
      When libvirtd loads active network configs from network state directory,
      it should release the class_id memory block which was allocated
      at the time of loading xml from network config directory.
      virBitmapParse will create a new memory block of bitmap class_id which
      causes a memory leak.
      
      This happens when at least one virtual network is active before.
      
      ==12234== 8,216 (24 direct, 8,192 indirect) bytes in 1 blocks are definitely \
                    lost in loss record 702 of 709
      ==12234==    at 0x4A06B2F: calloc (vg_replace_malloc.c:593)
      ==12234==    by 0x37AB04D77D: virAlloc (in /usr/lib64/libvirt.so.0.1000.3)
      ==12234==    by 0x37AB04EF89: virBitmapNew (in /usr/lib64/libvirt.so.0.1000.3)
      ==12234==    by 0x37AB0BFB37: virNetworkAssignDef (in /usr/lib64/libvirt.so.0.1000.3)
      ==12234==    by 0x37AB0BFD31: ??? (in /usr/lib64/libvirt.so.0.1000.3)
      ==12234==    by 0x37AB0BFE92: virNetworkLoadAllConfigs (in /usr/lib64/libvirt.so.0.1000.3)
      ==12234==    by 0x10650E5A: ??? (in /usr/lib64/libvirt/connection-driver/libvirt_driver_network.so)
      ==12234==    by 0x37AB0EB72F: virStateInitialize (in /usr/lib64/libvirt.so.0.1000.3)
      ==12234==    by 0x40DE04: ??? (in /usr/sbin/libvirtd)
      ==12234==    by 0x37AB0832E8: ??? (in /usr/lib64/libvirt.so.0.1000.3)
      ==12234==    by 0x3796807D14: start_thread (in /usr/lib64/libpthread-2.16.so)
      ==12234==    by 0x37960F246C: clone (in /usr/lib64/libc-2.16.so)
      7a0f5021
  6. 27 3月, 2013 1 次提交
    • G
      conf: fix a failure when detaching a usb device · a950f03e
      Guannan Ren 提交于
       #virsh detach-device $guest usb.xml
       error: Failed to detach device from usb2.xml
       error: operation failed: host usb device vendor=0x0951 \
       product=0x1625 not found
      
      This regresstion is due to a typo in matching function. The first
      argument is always the usb device that we are checking for. If the
      usb xml file provided by user contains bus and device info, we try
      to search it by them, otherwise, we use vendor and product info.
      
      The bug occurred only when detaching a usb device with no bus and
      device info provided in the usb xml file.
      a950f03e
  7. 25 3月, 2013 3 次提交
    • O
      nodedev: Dump max vports and vports in use for HBA's XML · 448be8f7
      Osier Yang 提交于
      This enrichs HBA's xml by dumping the number of max vports and
      vports in use. Format is like:
      
        <capability type='vport_ops'>
          <max_vports>164</max_vports>
          <vports>5</vports>
        </capability>
      
      * docs/formatnode.html.in: (Document the new XML)
      * docs/schemas/nodedev.rng: (Add the schema)
      * src/conf/node_device_conf.h: (New member for data.scsi_host)
      * src/node_device/node_device_linux_sysfs.c: (Collect the value of
        max_vports and vports)
      448be8f7
    • O
      nodedev: Introduce two new flags for listAll API · 652a2ec6
      Osier Yang 提交于
      VIR_CONNECT_LIST_NODE_DEVICES_CAP_FC_HOST to filter the FC HBA,
      and VIR_CONNECT_LIST_NODE_DEVICES_CAP_VPORTS to filter the FC HBA
      which supports vport.
      652a2ec6
    • O
      nodedev: Remove the unused enum · ab4b0001
      Osier Yang 提交于
      Guess it was created for the fc_host and vports_ops capabilities
      purpose, but there is enum virNodeDevScsiHostCapFlags for them,
      and enum virNodeDevHBACapType is unused, and actually both
      VIR_ENUM_DECL and VIR_ENUM_IMPL use the wrong enum name
      "virNodeDevHBACap".
      ab4b0001
  8. 23 3月, 2013 1 次提交
  9. 22 3月, 2013 5 次提交
  10. 21 3月, 2013 1 次提交
  11. 20 3月, 2013 2 次提交
  12. 15 3月, 2013 1 次提交
    • P
      audit: Audit resources used by VirtIO RNG · a71680fe
      Peter Krempa 提交于
      This patch adds auditing of resources used by Virtio RNG devices. Only
      resources on the local filesystems are audited.
      
      The audit logs look like:
      
      For the 'random' backend:
      type=VIRT_RESOURCE msg=audit(1363099126.643:31): pid=995252 uid=0 auid=4294967295 ses=4294967295 msg='virt=kvm resrc=rng reason=start vm="qcow-test" uuid=118733ed-b658-3e22-a2cb-4fe5cb3ddf79 old-rng="?" new-rng="/dev/random": exe="/home/pipo/libvirt/daemon/.libs/libvirtd" hostname=? addr=? terminal=pts/0 res=success'
      
      For local character device source:
      type=VIRT_RESOURCE msg=audit(1363100164.240:96): pid=995252 uid=0 auid=4294967295 ses=4294967295 msg='virt=kvm resrc=rng reason=start vm="qcow-test" uuid=118733ed-b658-3e22-a2cb-4fe5cb3ddf79 old-rng="?" new-rng="/tmp/unix.sock": exe="/home/pipo/libvirt/daemon/.libs/libvirtd" hostname=? addr=? terminal=pts/0 res=success'
      a71680fe
  13. 14 3月, 2013 2 次提交
    • P
      virtio-rng: Add rate limiting options for virtio-RNG · 32bd699f
      Peter Krempa 提交于
      Qemu's implementation of virtio RNG supports rate limiting of the
      entropy used. This patch exposes the option to tune this functionality.
      
      This patch is based on qemu commit 904d6f588063fb5ad2b61998acdf1e73fb4
      
      The rate limiting is exported in the XML as:
      <devices>
        ...
        <rng model='virtio'>
          <rate bytes='123' period='1234'/>
          <backend model='random'/>
        </rng>
        ...
      32bd699f
    • V
      S390: domain_conf support for CCW · e50a1bae
      Viktor Mihajlovski 提交于
      Add necessary handling code for the new s390 CCW address type to
      virDomainDeviceInfo. Further, introduce  memory management, XML
      parsing, output formatting and range validation for the new
      virDomainDeviceCCWAddress type.
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      e50a1bae
  14. 13 3月, 2013 1 次提交
    • P
      virCaps: conf: start splitting out irrelevat data · 27cf98e2
      Peter Krempa 提交于
      The virCaps structure gathered a ton of irrelevant data over time that.
      The original reason is that it was propagated to the XML parser
      functions.
      
      This patch aims to create a new data structure virDomainXMLConf that
      will contain immutable data that are used by the XML parser. This will
      allow two things we need:
      
      1) Get rid of the stuff from virCaps
      
      2) Allow us to add callbacks to check and add driver specific stuff
      after domain XML is parsed.
      
      This first attempt removes pointers to private data allocation functions
      to this new structure and update all callers and function that require
      them.
      27cf98e2
  15. 09 3月, 2013 1 次提交
  16. 08 3月, 2013 1 次提交
  17. 07 3月, 2013 2 次提交
    • D
      Fix crash parsing RNG device specification · 75e656a3
      Daniel P. Berrange 提交于
      Code that validates the whitelist for the RNG device filename
      didn't account for fact that filename may be NULL. This led
      to a NULL reference crash. This wasn't caught since the test
      suite was not covering this XML syntax
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      75e656a3
    • J
      Resolve valgrind error · 1cf4ef1f
      John Ferlan 提交于
      Resolves the following valgrind error from qemuxml2argvtest:
      
      ==20393== 5 bytes in 1 blocks are definitely lost in loss record 2 of 60
      ==20393==    at 0x4A0883C: malloc (vg_replace_malloc.c:270)
      ==20393==    by 0x38D690A167: __vasprintf_chk (in /usr/lib64/libc-2.16.so)
      ==20393==    by 0x4CB0D97: virVasprintf (stdio2.h:210)
      ==20393==    by 0x4CB0E53: virAsprintf (virutil.c:2017)
      ==20393==    by 0x428DC5: qemuAssignDeviceAliases (qemu_command.c:791)
      ==20393==    by 0x41DF93: testCompareXMLToArgvHelper (qemuxml2argvtest.c:151)
      ==20393==    by 0x41F53F: virtTestRun (testutils.c:157)
      ==20393==    by 0x41DA9B: mymain (qemuxml2argvtest.c:885)
      ==20393==    by 0x41FB7A: virtTestMain (testutils.c:719)
      ==20393==    by 0x38D6821A04: (below main) (in /usr/lib64/libc-2.16.so)
      ==20393==
      
      From qemu_command.c/line 791:
      
          if (def->rng) {
              if (virAsprintf(&def->rng->info.alias, "rng%d", 0) < 0)
                  goto no_memory;
          }
      1cf4ef1f
  18. 05 3月, 2013 2 次提交
    • P
      conf: Report errors on cputune parameter parsing · 7fc4864a
      Peter Krempa 提交于
      This patch adds proper error reporting if parsing of cputune parameters
      fails due to incorrect values provided by the user. Previously no errors
      were reported in such a case and the failure was silently ignored.
      7fc4864a
    • P
      conf: Make virDomainDeviceInfoIterate usable without os type · 5d9169e4
      Peter Krempa 提交于
      Make the iterator function usable in the next patches. Also refactor
      some parts to avoid strcmp if not necessary.
      
      This commit tweaks and shadows the change that was done in commit
      babe7dad and was needed after the
      support for multiple console devices was added. Historically the first
      <console> element is alias for the <serial> device.
      5d9169e4