1. 02 4月, 2014 4 次提交
    • E
      conf: move network disk protocol type to util/ · 4220f76a
      Eric Blake 提交于
      Another enum moved to util/, this time the fallout from renaming
      is not quite as large.
      
      * src/conf/domain_conf.h (virDomainDiskProtocol): Move...
      * src/util/virstoragefile.h (virStorageNetProtocol): ...and
      rename.
      * src/conf/domain_conf.c: Update clients.
      * src/qemu/qemu_command.c: Likewise.
      * src/qemu/qemu_conf.c: Likewise.
      * src/qemu/qemu_driver.c: Likewise.
      * src/qemu/qemu_migration.c: Likewise.
      * src/storage/storage_backend.c: Likewise.
      * src/storage/storage_backend_gluster.c: Likewise.
      * src/libvirt_private.syms (domain_conf.h): Move symbols...
      (virstoragefile.h): ...as appropriate.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      4220f76a
    • E
      conf: move host disk type to util/ · 16ac4c9d
      Eric Blake 提交于
      A continuation of the migration of disk details to virstoragefile.
      This patch moves a single enum, but converting the name has quite
      a bit of fallout.
      
      * src/conf/domain_conf.h (virDomainDiskType): Move...
      * src/util/virstoragefile.h (virStorageType): ...and rename.
      * src/bhyve/bhyve_command.c (bhyveBuildDiskArgStr)
      (virBhyveProcessBuildLoadCmd): Update clients.
      * src/conf/domain_conf.c (virDomainDiskSourceDefParse)
      (virDomainDiskDefParseXML, virDomainDiskSourceDefFormatInternal)
      (virDomainDiskDefFormat, virDomainDiskGetActualType)
      (virDomainDiskDefForeachPath, virDomainDiskSourceIsBlockType):
      Likewise.
      * src/conf/snapshot_conf.h (_virDomainSnapshotDiskDef): Likewise.
      * src/conf/snapshot_conf.c (virDomainSnapshotDiskDefParseXML)
      (virDomainSnapshotAlignDisks, virDomainSnapshotDiskDefFormat):
      Likewise.
      * src/esx/esx_driver.c (esxAutodetectSCSIControllerModel)
      (esxDomainDefineXML): Likewise.
      * src/locking/domain_lock.c (virDomainLockManagerAddDisk):
      Likewise.
      * src/lxc/lxc_controller.c
      (virLXCControllerSetupLoopDeviceDisk)
      (virLXCControllerSetupNBDDeviceDisk)
      (virLXCControllerSetupLoopDevices, virLXCControllerSetupDisk):
      Likewise.
      * src/parallels/parallels_driver.c (parallelsGetHddInfo):
      Likewise.
      * src/phyp/phyp_driver.c (phypDiskType): Likewise.
      * src/qemu/qemu_command.c (qemuGetDriveSourceString)
      (qemuDomainDiskGetSourceString, qemuBuildDriveStr)
      (qemuBuildCommandLine, qemuParseCommandLineDisk)
      (qemuParseCommandLine): Likewise.
      * src/qemu/qemu_conf.c (qemuCheckSharedDevice)
      (qemuTranslateDiskSourcePool)
      (qemuTranslateSnapshotDiskSourcePool): Likewise.
      * src/qemu/qemu_domain.c (qemuDomainDeviceDefPostParse)
      (qemuDomainDetermineDiskChain): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainGetBlockInfo)
      (qemuDomainSnapshotPrepareDiskExternalBackingInactive)
      (qemuDomainSnapshotPrepareDiskExternalBackingActive)
      (qemuDomainSnapshotPrepareDiskExternalOverlayActive)
      (qemuDomainSnapshotPrepareDiskExternalOverlayInactive)
      (qemuDomainSnapshotPrepareDiskInternal)
      (qemuDomainSnapshotPrepare)
      (qemuDomainSnapshotCreateSingleDiskActive): Likewise.
      * src/qemu/qemu_hotplug.c (qemuDomainChangeEjectableMedia):
      Likewise.
      * src/qemu/qemu_migration.c (qemuMigrationIsSafe): Likewise.
      * src/security/security_apparmor.c
      (AppArmorRestoreSecurityImageLabel)
      (AppArmorSetSecurityImageLabel): Likewise.
      * src/security/security_dac.c (virSecurityDACSetSecurityImageLabel)
      (virSecurityDACRestoreSecurityImageLabelInt)
      (virSecurityDACSetSecurityAllLabel): Likewise.
      * src/security/security_selinux.c
      (virSecuritySELinuxRestoreSecurityImageLabelInt)
      (virSecuritySELinuxSetSecurityImageLabel)
      (virSecuritySELinuxSetSecurityAllLabel): Likewise.
      * src/storage/storage_backend.c (virStorageFileBackendForType):
      Likewise.
      * src/storage/storage_backend_fs.c (virStorageFileBackendFile)
      (virStorageFileBackendBlock): Likewise.
      * src/storage/storage_backend_gluster.c
      (virStorageFileBackendGluster): Likewise.
      * src/vbox/vbox_tmpl.c (vboxDomainGetXMLDesc, vboxAttachDrives)
      (vboxDomainAttachDeviceImpl, vboxDomainDetachDevice): Likewise.
      * src/vmware/vmware_conf.c (vmwareVmxPath): Likewise.
      * src/vmx/vmx.c (virVMXParseDisk, virVMXFormatDisk)
      (virVMXFormatFloppy): Likewise.
      * src/xenxs/xen_sxpr.c (xenParseSxprDisks, xenParseSxpr)
      (xenFormatSxprDisk): Likewise.
      * src/xenxs/xen_xm.c (xenParseXM, xenFormatXMDisk): Likewise.
      * tests/securityselinuxlabeltest.c (testSELinuxLoadDef):
      Likewise.
      * src/libvirt_private.syms (domain_conf.h): Move symbols...
      (virstoragefile.h): ...as appropriate.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      16ac4c9d
    • E
      conf: split network host structs to util/ · 52fb5311
      Eric Blake 提交于
      Continuing the refactoring of host-side storage descriptions out
      of conf/domain_conf and into util/virstoragefile, this patch
      focuses on details about a host name/port/transport as used by
      a network storage volume.
      
      * src/conf/domain_conf.h (virDomainDiskProtocolTransport)
      (virDomainDiskHostDef, virDomainDiskHostDefClear)
      (virDomainDiskHostDefFree, virDomainDiskHostDefCopy): Move...
      * src/util/virstoragefile.h (virStorageNetHostTransport)
      (virStorageNetHostDef, virStorageNetHostDefClear)
      (virStorageNetHostDefFree, virStorageNetHostDefCopy): ...here,
      with better names.
      * src/util/virstoragefile.c (virStorageNetHostDefClear)
      (virStorageNetHostDefFree, virStorageNetHostDefCopy): Moved from...
      * src/conf/domain_conf.c (virDomainDiskHostDefClear)
      (virDomainDiskHostDefFree, virDomainDiskHostDefCopy): ...here.
      (virDomainDiskSourceDefClear, virDomainDiskSourceDefParse)
      (virDomainDiskSourceDefFormatInternal): Adjust callers.
      * src/conf/snapshot_conf.h (_virDomainSnapshotDiskDef): Likewise.
      * src/conf/snapshot_conf.c (virDomainSnapshotDiskDefClear):
      Likewise.
      * src/qemu/qemu_command.c (qemuAddRBDHost)
      (qemuParseDriveURIString, qemuParseNBDString)
      (qemuBuildNetworkDriveURI, qemuParseCommandLineDisk)
      (qemuParseCommandLine, qemuGetDriveSourceString): Likewise.
      * src/qemu/qemu_command.h: Likewise.
      * src/qemu/qemu_conf.c (qemuAddISCSIPoolSourceHost)
      (qemuTranslateDiskSourcePool): Likewise.
      * src/qemu/qemu_driver.c
      (qemuDomainSnapshotCreateSingleDiskActive)
      (qemuDomainSnapshotUndoSingleDiskActive): Likewise.
      * src/storage/storage_backend_gluster.c
      (virStorageFileBackendGlusterInit): Likewise.
      * src/storage/storage_driver.c (virStorageFileFree)
      (virStorageFileInitInternal): Likewise.
      * src/storage/storage_driver.h (_virStorageFile): Likewise.
      * src/libvirt_private.syms (domain_conf.h): Move symbols...
      (virstoragefile.h): ...as appropriate.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      52fb5311
    • E
      conf: split security label structs to util/ · 3e929386
      Eric Blake 提交于
      In order to reuse the newly-created host-side disk struct in
      the virstoragefile backing chain code, I first have to move
      it to util/.  This starts the process, by first moving the
      security label structures.
      
      * src/conf/domain_conf.h (virDomainDefGenSecurityLabelDef)
      (virDomainDiskDefGenSecurityLabelDef, virSecurityLabelDefFree)
      (virSecurityDeviceLabelDefFree, virSecurityLabelDef)
      (virSecurityDeviceLabelDef): Move...
      * src/util/virseclabel.h: ...to new file.
      (virSecurityLabelDefNew, virSecurityDeviceLabelDefNew): Rename the
      GenSecurity functions.
      * src/qemu/qemu_process.c (qemuProcessAttach): Adjust callers.
      * src/security/security_manager.c (virSecurityManagerGenLabel):
      Likewise.
      * src/security/security_selinux.c
      (virSecuritySELinuxSetSecurityFileLabel): Likewise.
      * src/util/virseclabel.c: New file.
      * src/conf/domain_conf.c: Move security code, and fix fallout.
      * src/Makefile.am (UTIL_SOURCES): Build new file.
      * src/libvirt_private.syms (domain_conf.h): Move symbols...
      (virseclabel.h): ...to new section.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      3e929386
  2. 01 4月, 2014 8 次提交
  3. 31 3月, 2014 5 次提交
  4. 30 3月, 2014 1 次提交
  5. 29 3月, 2014 1 次提交
  6. 28 3月, 2014 2 次提交
  7. 27 3月, 2014 6 次提交
    • C
      Fix apparmor profile to make vfio pci passthrough work · 74e86b6b
      Cédric Bosdonnat 提交于
      See lp#1276719 for the bug description. As virt-aa-helper doesn't know
      the VFIO groups to use for the guest, allow access to all
      /dev/vfio/[0-9]* and /dev/vfio/vfio files if there is a potential need
      for vfio
      Signed-off-by: NEric Blake <eblake@redhat.com>
      74e86b6b
    • C
    • N
      Fix Memory Leak in virQEMUCapsInitGuestFromBinary() · faad5582
      Nehal J Wani 提交于
      While running qemucaps2xmltest, it was found that valgrind pointed out
      the following memory leaks:
      
      ==29896== 0 bytes in 1 blocks are definitely lost in loss record 1 of 65
      ==29896==    at 0x4A0577B: calloc (vg_replace_malloc.c:593)
      ==29896==    by 0x4C6B45E: virAllocN (viralloc.c:191)
      ==29896==    by 0x4232A9: virQEMUCapsGetMachineTypesCaps (qemu_capabilities.c:1999)
      ==29896==    by 0x4234E7: virQEMUCapsInitGuestFromBinary (qemu_capabilities.c:789)
      ==29896==    by 0x41F10B: testQemuCapsXML (qemucaps2xmltest.c:118)
      ==29896==    by 0x41FFD1: virtTestRun (testutils.c:201)
      ==29896==    by 0x41EE7A: mymain (qemucaps2xmltest.c:203)
      ==29896==    by 0x42074D: virtTestMain (testutils.c:789)
      ==29896==    by 0x3E6CE1ED1C: (below main) (libc-start.c:226)
      ==29896==
      ==29896== 0 bytes in 1 blocks are definitely lost in loss record 2 of 65
      ==29896==    at 0x4A0577B: calloc (vg_replace_malloc.c:593)
      ==29896==    by 0x4C6B45E: virAllocN (viralloc.c:191)
      ==29896==    by 0x4232A9: virQEMUCapsGetMachineTypesCaps (qemu_capabilities.c:1999)
      ==29896==    by 0x4234E7: virQEMUCapsInitGuestFromBinary (qemu_capabilities.c:789)
      ==29896==    by 0x41F10B: testQemuCapsXML (qemucaps2xmltest.c:118)
      ==29896==    by 0x41FFD1: virtTestRun (testutils.c:201)
      ==29896==    by 0x41EEA3: mymain (qemucaps2xmltest.c:204)
      ==29896==    by 0x42074D: virtTestMain (testutils.c:789)
      ==29896==    by 0x3E6CE1ED1C: (below main) (libc-start.c:226)
      Signed-off-by: NEric Blake <eblake@redhat.com>
      faad5582
    • H
      util: fix a typo in virprocess.c and docs · b2ed4f68
      Hongwei Bi 提交于
      s/forcably/forcibly
      Signed-off-by: NHongwei Bi <hwbi2008@gmail.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b2ed4f68
    • W
      bhyve: add domainLookupByID · 8433de2e
      Wojciech Macek 提交于
      Implement domain lookup by its ID.
      8433de2e
    • R
      Move virBhyveTapGetRealDeviceName to virnetdevtap · a1bd8d25
      Roman Bogorodskiy 提交于
      To ease mocking for bhyve unit tests move virBhyveTapGetRealDeviceName()
      out of bhyve_command.c to virnetdevtap and rename it to
      virNetDevTapGetRealDeviceName().
      a1bd8d25
  8. 26 3月, 2014 13 次提交
    • L
      network: fix problems with SRV records · 6612d1ad
      Laine Stump 提交于
      A patch submitted by Steven Malin last week pointed out a problem with
      libvirt's DNS SRV record configuration:
      
        https://www.redhat.com/archives/libvir-list/2014-March/msg00536.html
      
      When searching for that message later, I found another series that had
      been posted by Guannan Ren back in 2012 that somehow slipped between
      the cracks:
      
        https://www.redhat.com/archives/libvir-list/2012-July/msg00236.html
      
      That patch was very much out of date, but also pointed out some real
      problems.
      
      This patch fixes all the noted problems by refactoring
      virNetworkDNSSrvDefParseXML() and networkDnsmasqConfContents(), then
      verifies those fixes by added several new records to the test case.
      
      Problems fixed:
      
      * both service and protocol now have an underscore ("_") prepended on
        the commandline, as required by RFC2782.
      
        <srv service='sip' protocol='udp' domain='example.com'
             target='tests.example.com' port='5060' priority='10'
             weight='150'/>
      
        before: srv-host=sip.udp.example.com,tests.example.com,5060,10,150
        after:  srv-host=_sip._udp.example.com,tests.example.com,5060,10,150
      
      * if "domain" wasn't specified in the <srv> element, the extra
        trailing "." will no longer be added to the dnsmasq commandline.
      
        <srv service='sip' protocol='udp' target='tests.example.com'
             port='5060' priority='10' weight='150'/>
      
        before: srv-host=sip.udp.,tests.example.com,5060,10,150
        after:  srv-host=_sip._udp,tests.example.com,5060,10,150
      
      * when optional attributes aren't specified, the separating comma is
        also now not placed on the dnsmasq commandline. If optional
        attributes in the middle of the line are not specified, they are
        replaced with a default value in the commandline (1 for port, 0 for
        priority and weight).
      
        <srv service='sip' protocol='udp' target='tests.example.com'
             port='5060'/>
      
        before: srv-host=sip.udp.,tests.example.com,5060,,
        after:  srv-host=_sip._udp,tests.example.com,5060
      
        (actually the would have generated an error, because "optional"
        attributes weren't really optional.)
      
      * The allowed characters for both service and protocol are now limited
        to alphanumerics, plus a few special characters that are found in
        existing names in /etc/services and /etc/protocols. (One exception
        is that both of these files contain names with an embedded ".", but
        "."  can't be used in these fields of an SRV record because it is
        used as a field separator and there is no method to escape a "."
        into a field.) (Previously only the strings "tcp" and "udp" were
        allowed for protocol, but this restriction has been removed, since
        RFC2782 specifically says that it isn't limited to those, and that
        anyway it is case insensitive.)
      
      * the "domain" attribute is no longer required in order to recognize
        the port, priority, and weight attributes during parsing. Only
        "target" is required for this.
      
      * if "target" isn't specified, port, priority, and weight are not
        allowed (since they are meaningless - an empty target means "this
        service is *not available* for this domain").
      
      * port, priority, and weight are now truly optional, as the comments
        originally suggested, but which was not actually true.
      6612d1ad
    • J
      Shift the for loop over matched vars by one · 9d430686
      Ján Tomko 提交于
      Instead of adding one to the iterator on every use.
      9d430686
    • J
      25c49db5
    • J
      Free groups in case of a partial match · d223cd76
      Ján Tomko 提交于
      If there are more than two regexes, but only one of them matches,
      the matched groups would be leaked.
      d223cd76
    • J
      Simplify the loop in virCommandRunRegex · cf4fb7d9
      Ján Tomko 提交于
      Do not check for border iterator values inside the loop,
      move the code before/after the loop instead.
      cf4fb7d9
    • J
      Remove useless 'maxReg' variable · f01f62d4
      Ján Tomko 提交于
      It is used to break out of the loop early if one regex does not match.
      Use the 'break' statement instead.
      f01f62d4
    • M
      qemuDomainAttachDeviceFlags: Parse device xml as inactive · 220c0031
      Michal Privoznik 提交于
      In all other drivers we are doing so. Moreover, we don't want to parse
      runtime information in attach (even if the attach is meant as live)
      because we are generating the runtime info ourselves. We can't trust
      users they supply sane values anyway.
      
      ==1140== 9 bytes in 1 blocks are definitely lost in loss record 72 of 1,151
      ==1140==    at 0x4A06C2B: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==1140==    by 0x623C758: xmlStrndup (in /usr/lib64/libxml2.so.2.9.1)
      ==1140==    by 0x50FD763: virXMLPropString (virxml.c:483)
      ==1140==    by 0x510F8B7: virDomainDeviceInfoParseXML (domain_conf.c:3685)
      ==1140==    by 0x511ACFD: virDomainChrDefParseXML (domain_conf.c:7535)
      ==1140==    by 0x5121D13: virDomainDeviceDefParse (domain_conf.c:9918)
      ==1140==    by 0x13AE6313: qemuDomainAttachDeviceFlags (qemu_driver.c:6926)
      ==1140==    by 0x13AE65FA: qemuDomainAttachDevice (qemu_driver.c:7005)
      ==1140==    by 0x51C77DA: virDomainAttachDevice (libvirt.c:10231)
      ==1140==    by 0x127FDD: remoteDispatchDomainAttachDevice (remote_dispatch.h:2404)
      ==1140==    by 0x127EC5: remoteDispatchDomainAttachDeviceHelper (remote_dispatch.h:2382)
      ==1140==    by 0x5241F81: virNetServerProgramDispatchCall (virnetserverprogram.c:437)
      
      When doing live attach, we are passing the inactive definition anyway
      since we are passing the result of virDomainDeviceDefCopy() which does
      inactive copy by default.
      
      Moreover, we are doing the same mistake in qemuhotplugtest.
      
      Just a side note - it makes perfect sense to parse the runtime info
      like alias in qemuDomainDetachDevice and qemuDomainUpdateDeviceFlags()
      as in some cases the only difference to distinguish two devices can be
      just their alias.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      220c0031
    • F
      qemu: extract guest capabilities initialization · f35e89ff
      Francesco Romani 提交于
      This patch decouples the binary and the capabilities detection
      from the guest initialization.
      
      The purpose is to make testing easier.
      f35e89ff
    • F
      qemu: export disk snapshot support in capabilities · 85a3eb8a
      Francesco Romani 提交于
      This patch adds an element to QEMU's capability XML, to
      show if the underlying QEMU binary supports the live disk
      snapshotting or not.
      This allows any client to know ahead of time if the feature
      is available.
      
      Without this information available, the only way to check
      for the snapshot support is to request one and check for
      errors.
      Signed-off-by: NFrancesco Romani <fromani@redhat.com>
      85a3eb8a
    • J
      Show the real cpu shares value in live XML · 97814d8a
      Ján Tomko 提交于
      Currently, the Linux kernel treats values of '0' and '1' as
      the minimum of 2. Values larger than the maximum are changed
      to the maximum.
      
      Re-reading the shares value after setting it reflects this in
      the live domain XML.
      97814d8a
    • J
      Treat zero cpu shares as a valid value · bdffab0d
      Ján Tomko 提交于
      Currently, <cputune><shares>0</shares></cputune> is treated
      as if it were not specified.
      
      Treat is as a valid value if it was explicitly specified
      and write it to the cgroups.
      bdffab0d
    • J
      Coverity: Resolve a RESOURCE_LEAK · c668cd50
      John Ferlan 提交于
      On error the lofd would have been leaked.
      c668cd50
    • J
      Coverity: Resolve a CHECKED_RETURN message · b2e4ace2
      John Ferlan 提交于
      Recent changes to the module seemed to have caused Coverity to find a new
      issue regarding the failure to check the return from a sendmsg. The code
      doesn't seem to care about the return status, so just added an ignore_value
      to keep Coverity quiet.
      b2e4ace2