1. 02 4月, 2014 10 次提交
    • E
      conf: let snapshots share disk source struct · ca1ee0fd
      Eric Blake 提交于
      Now that we have a common struct, it's time to start using it!
      Since external snapshots make a longer backing chain, it is
      only natural to use the same struct for the file created by
      the snapshot as what we use for <domain> disks.
      
      * src/conf/snapshot_conf.h (_virDomainSnapshotDiskDef): Use common
      struct instead of open-coded duplicate fields.
      * src/conf/snapshot_conf.c (virDomainSnapshotDiskDefClear)
      (virDomainSnapshotDiskDefParseXML, virDomainSnapshotAlignDisks)
      (virDomainSnapshotDiskDefFormat)
      (virDomainSnapshotDiskGetActualType): Adjust clients.
      * src/qemu/qemu_conf.c (qemuTranslateSnapshotDiskSourcePool):
      Likewise.
      * src/qemu/qemu_driver.c (qemuDomainSnapshotDiskGetSourceString)
      (qemuDomainSnapshotCreateInactiveExternal)
      (qemuDomainSnapshotPrepareDiskExternalOverlayActive)
      (qemuDomainSnapshotPrepareDiskExternal)
      (qemuDomainSnapshotPrepare)
      (qemuDomainSnapshotCreateSingleDiskActive): Likewise.
      * src/storage/storage_driver.c
      (virStorageFileInitFromSnapshotDef): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      ca1ee0fd
    • E
      conf: move common disk source functions · 7a4fd22b
      Eric Blake 提交于
      Move some functions out of domain_conf for use in the next
      patch where snapshot starts to directly use structs in
      virstoragefile.
      
      * src/conf/domain_conf.c (virDomainDiskDefFree)
      (virDomainDiskSourcePoolDefParse): Adjust callers.
      (virDomainDiskSourceDefClear, virDomainDiskSourcePoolDefFree)
      (virDomainDiskAuthClear): Move...
      * src/util/virstoragefile.c (virStorageSourceClear)
      (virStorageSourcePoolDefFree, virStorageSourceAuthClear): ...and
      rename.
      * src/conf/domain_conf.h (virDomainDiskAuthClear): Drop
      declaration.
      * src/qemu/qemu_conf.c (qemuTranslateDiskSourcePool): Adjust
      caller.
      * src/util/virstoragefile.h: Declare them.
      * src/libvirt_private.syms (virstoragefile.h): Export them.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      7a4fd22b
    • E
      conf: move storage source type to util/ · 8a20e227
      Eric Blake 提交于
      With this patch, all information related to a host resource in
      a storage file backing chain now lives in util/virstoragefile.h.
      The next step will be to consolidate various places that have
      been tracking backing chain details to all use a common struct.
      
      The changes to tools/Makefile.am were made necessary by the
      fact that virstorageencryption includes uses of libxml, and is
      now pulled in by inclusion from virstoragefile.h.  No
      additional libraries are linked into the final image, and in
      comparison, the build of the setuid library in src/Makefile.am
      already was using LIBXML_CFLAGS via AM_CFLAGS.
      
      * src/conf/domain_conf.h (virDomainDiskSourceDef): Move...
      * src/util/virstoragefile.h (virStorageSource): ...and rename.
      * src/conf/domain_conf.c (virDomainDiskSourceDefClear)
      (virDomainDiskAuthClear): Adjust clients.
      * tools/Makefile.am (virt_login_shell_CFLAGS)
      (virt_host_validate_CFLAGS): Add libxml headers.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      8a20e227
    • E
      conf: move storage secret type to util/ · c05d9dca
      Eric Blake 提交于
      This one is a relatively easy move.  We don't ever convert the
      enum to or from strings (it is inferred from other elements in
      the xml, rather than directly represented).
      
      * src/conf/domain_conf.h (virDomainDiskSecretType): Move...
      * src/util/virstoragefile.h (virStorageSecreteType): ...and
      rename.
      * src/conf/domain_conf.c (virDomainDiskSecretType): Drop unused
      enum conversion.
      (virDomainDiskAuthClear, virDomainDiskDefParseXML)
      (virDomainDiskDefFormat): Adjust clients.
      * src/qemu/qemu_command.c (qemuGetSecretString): Likewise.
      * src/qemu/qemu_conf.c (qemuTranslateDiskSourcePoolAuth):
      Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      c05d9dca
    • E
      conf: move source pool type to util/ · b6edf2bf
      Eric Blake 提交于
      Another struct being moved to util.  This one doesn't have as
      much use yet, thankfully.
      
      * src/conf/domain_conf.h (virDomainDiskSourcePoolMode)
      (virDomainDiskSourcePoolDef): Move...
      * src/util/virstoragefile.h (virStorageSourcePoolMode)
      (virStorageSourcePoolDef): ...and rename.
      * src/conf/domain_conf.c (virDomainDiskSourcePoolDefFree)
      (virDomainDiskSourceDefClear, virDomainDiskSourcePoolDefParse)
      (virDomainDiskDefParseXML, virDomainDiskSourceDefParse)
      (virDomainDiskSourceDefFormatInternal)
      (virDomainDiskDefForeachPath, virDomainDiskSourceIsBlockType):
      Adjust clients.
      * src/qemu/qemu_conf.c (qemuTranslateDiskSourcePool): Likewise.
      * src/libvirt_private.syms (domain_conf.h): Move symbols...
      (virstoragefile.h): ...as appropriate.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b6edf2bf
    • E
      conf: move storage encryption type to util/ · 8fc32859
      Eric Blake 提交于
      Encryption keys can be associated with each source file in a
      backing chain; as such, this file belongs more in util/ where
      it can be used by virstoragefile.h.
      
      * src/conf/storage_encryption_conf.h: Rename...
      * src/util/virstorageencryption.h: ...to this.
      * src/conf/storage_encryption_conf.c: Rename...
      * src/util/virstorageencryption.c: ...to this.
      * src/Makefile.am (ENCRYPTION_CONF_SOURCES, CONF_SOURCES)
      (UTIL_SOURCES): Update to new file names.
      * src/libvirt_private.syms: Likewise.
      * src/conf/domain_conf.h: Update client.
      * src/conf/storage_conf.h: Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      8fc32859
    • 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. 31 3月, 2014 1 次提交
  3. 26 3月, 2014 2 次提交
    • 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
      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
  4. 25 3月, 2014 4 次提交
    • J
      Indent top-level labels by one space in src/conf/ · df2013fa
      Ján Tomko 提交于
      df2013fa
    • E
      conf: prepare to track multiple host source files per <disk> · 4f202266
      Eric Blake 提交于
      It's finally time to start tracking disk backing chains in
      <domain> XML.  The first step is to start refactoring code
      so that we have an object more convenient for representing
      each host source resource in the context of a single guest
      <disk>.  Ultimately, I plan to move the new type into src/util
      where it can be reused by virStorageFile, but to make the
      transition easier to review, this patch just creates the
      new type then fixes everything until it compiles again.
      
      * src/conf/domain_conf.h (_virDomainDiskDef): Split...
      (_virDomainDiskSourceDef): ...to new struct.
      (virDomainDiskAuthClear): Use new type.
      * src/conf/domain_conf.c (virDomainDiskDefFree): Split...
      (virDomainDiskSourceDefClear): ...to new function.
      (virDomainDiskGetType, virDomainDiskSetType)
      (virDomainDiskGetSource, virDomainDiskSetSource)
      (virDomainDiskGetDriver, virDomainDiskSetDriver)
      (virDomainDiskGetFormat, virDomainDiskSetFormat)
      (virDomainDiskAuthClear, virDomainDiskGetActualType)
      (virDomainDiskDefParseXML, virDomainDiskSourceDefFormat)
      (virDomainDiskDefFormat, virDomainDiskDefForeachPath)
      (virDomainDiskDefGetSecurityLabelDef)
      (virDomainDiskSourceIsBlockType): Adjust all users.
      * src/lxc/lxc_controller.c (virLXCControllerSetupDisk):
      Likewise.
      * src/lxc/lxc_driver.c (lxcDomainAttachDeviceMknodHelper):
      Likewise.
      * src/qemu/qemu_command.c (qemuAddRBDHost, qemuParseRBDString)
      (qemuParseDriveURIString, qemuParseGlusterString)
      (qemuParseISCSIString, qemuParseNBDString)
      (qemuDomainDiskGetSourceString, qemuBuildDriveStr)
      (qemuBuildCommandLine, qemuParseCommandLineDisk)
      (qemuParseCommandLine): Likewise.
      * src/qemu/qemu_conf.c (qemuCheckSharedDevice)
      (qemuAddISCSIPoolSourceHost, qemuTranslateDiskSourcePool):
      Likewise.
      * src/qemu/qemu_driver.c (qemuDomainUpdateDeviceConfig)
      (qemuDomainPrepareDiskChainElement)
      (qemuDomainSnapshotCreateInactiveExternal)
      (qemuDomainSnapshotPrepareDiskExternalBackingInactive)
      (qemuDomainSnapshotPrepareDiskInternal)
      (qemuDomainSnapshotPrepare)
      (qemuDomainSnapshotCreateSingleDiskActive)
      (qemuDomainSnapshotUndoSingleDiskActive)
      (qemuDomainBlockPivot, qemuDomainBlockJobImpl)
      (qemuDomainBlockCopy, qemuDomainBlockCommit): Likewise.
      * src/qemu/qemu_migration.c (qemuMigrationIsSafe): Likewise.
      * src/qemu/qemu_process.c (qemuProcessGetVolumeQcowPassphrase)
      (qemuProcessInitPasswords): Likewise.
      * src/security/security_selinux.c
      (virSecuritySELinuxSetSecurityFileLabel): Likewise.
      * src/storage/storage_driver.c (virStorageFileInitFromDiskDef):
      Likewise.
      * tests/securityselinuxlabeltest.c (testSELinuxLoadDef):
      Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      4f202266
    • E
      conf: use disk source accessors in conf/ · a9ab99ca
      Eric Blake 提交于
      Part of a series of cleanups to use new accessor methods.
      
      Several places in domain_conf.c still open-code raw field access,
      but that code will be touched later with the diskDef struct split
      so I'm avoiding churn here.
      
      * src/conf/domain_audit.c (virDomainAuditStart): Use accessors.
      * src/conf/domain_conf.c (virDomainDiskIndexByName)
      (virDomainDiskPathByName, virDomainDiskDefForeachPath)
      (virDomainDiskSourceIsBlockType): Likewise.
      * src/conf/snapshot_conf.c (virDomainSnapshotAlignDisks):
      Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      a9ab99ca
    • E
      conf: accessors for common source information · 1014c34e
      Eric Blake 提交于
      A future patch will split virDomainDiskDef, in order to track
      multiple host resources per guest <disk>.  To reduce the size
      of that patch, I've factored out the four most common accesses
      into functions, so that I can incrementally upgrade the code
      base to use the accessors, and so that code that doesn't care
      about the distinction of per-file details won't have to be
      changed when the struct changes.
      
      * src/conf/domain_conf.h (virDomainDiskGetType)
      (virDomainDiskSetType, virDomainDiskGetSource)
      (virDomainDiskSetSource, virDomainDiskGetDriver)
      (virDomainDiskSetDriver, virDomainDiskGetFormat)
      (virDomainDiskSetFormat): New prototypes.
      * src/conf/domain_conf.c (virDomainDiskGetType)
      (virDomainDiskSetType, virDomainDiskGetSource)
      (virDomainDiskSetSource, virDomainDiskGetDriver)
      (virDomainDiskSetDriver, virDomainDiskGetFormat)
      (virDomainDiskSetFormat): Implement them.
      * src/libvirt_private.syms (domain_conf.h): Export them.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1014c34e
  5. 21 3月, 2014 8 次提交
    • R
      Introduce virFDStreamOpenPTY · 4dae396f
      Roman Bogorodskiy 提交于
      Add virFDStreamOpenPTY() function which is a wrapper around
      virFDStreamOpenFileInternal() with putting the device it opens into a
      raw mode.
      
      Make virChrdevOpen() use virFDStreamOpenPTY() for
      VIR_DOMAIN_CHR_TYPE_PTY devices.
      
      This fixes mangled console output when libvirt runs on FreeBSD as it
      requires device it opens to be placed into a raw mode explicitly.
      4dae396f
    • J
      Check boot order on device attach · 585076c7
      Jiri Denemark 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1007754
      
      When attaching a new device, we need to check if its boot order
      configuration is compatible with current domain definition.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      585076c7
    • J
      conf: Introduce virDomainDeviceGetInfo API · 563a12b3
      Jiri Denemark 提交于
      The offset of virDomainDeviceInfo structure within a device definition
      varies with device type and some types do not contain the info structure
      at all. This new API makes it easier to access the info structure from a
      generic virDomainDeviceDef structure.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      563a12b3
    • J
      Pass action to virDomainDefCompatibleDevice · 1c131661
      Jiri Denemark 提交于
      When checking compatibility of a device with a domain definition, we
      should know what we're going to do with the device. Because we may need
      to check for different things when we're attaching a new device versus
      detaching an existing device.
      Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
      1c131661
    • E
      qemu: allow filtering events by regex · 43b17dd4
      Eric Blake 提交于
      When listening for a subset of monitor events, it can be tedious
      to register for each event name in series; nicer is to register
      for multiple events in one go.  Implement a flag to use regex
      interpretation of the event filter.
      
      While at it, prove how much I hate the shift key, by adding a
      way to filter for 'shutdown' instead of 'SHUTDOWN'. :)
      
      * include/libvirt/libvirt-qemu.h
      (virConnectDomainQemuMonitorEventRegisterFlags): New enum.
      * src/libvirt-qemu.c (virConnectDomainQemuMonitorEventRegister):
      Document flags.
      * tools/virsh-domain.c (cmdQemuMonitorEvent): Expose them.
      * tools/virsh.pod (qemu-monitor-event): Document this.
      * src/conf/domain_event.c
      (virDomainQemuMonitorEventStateRegisterID): Add flags.
      (virDomainQemuMonitorEventFilter): Handle regex, and optimize
      client side.
      (virDomainQemuMonitorEventCleanup): Clean up regex.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      43b17dd4
    • E
      qemu: enable monitor event filtering by name · d0ba8dd7
      Eric Blake 提交于
      Filtering monitor events by name requires tracking the name for
      the duration of the filtering.  In order to free the name, I
      found it easiest to just piggyback on the user's freecb function,
      which gets called when the event is deregistered.
      
      For events without a name filter, we have the design of multiple
      client registrations sharing a common server registration, because
      the server side uses the same callback function and we reject
      duplicate use of the same function.  But with events in the mix,
      we want to be able to allow the same function pointer to be used
      with more than one event name.  The solution is to tweak the
      duplicate detection code to only act when there is no additional
      filtering; if name filtering is in use, there is exactly one
      client registration per server registration.  Yes, this means
      that there is no longer a bound on the number of server
      registrations possible, so a malicious client could repeatedly
      register for the same name event to exhaust server memory.  On
      the other hand, we already restricted monitor events to require
      write access (compared to normal events only needing read access),
      and separated it into the intentionally unsupported
      libvirt-qemu.so, with documentation that using this function is
      for debug purposes only; so it is not a security risk worth
      worrying about a client trying to abuse multiple registrations.
      
      * src/conf/domain_event.c (virDomainQemuMonitorEventData): New
      struct.
      (virDomainQemuMonitorEventFilter)
      (virDomainQemuMonitorEventCleanup): New functions.
      (virDomainQemuMonitorEventDispatchFunc)
      (virDomainQemuMonitorEventStateRegisterID): Use new struct.
      * src/conf/object_event.c (virObjectEventCallbackListCount)
      (virObjectEventCallbackListAddID)
      (virObjectEventCallbackListRemoveID)
      (virObjectEventCallbackListMarkDeleteID): Drop duplicate detection
      when filtering is in effect.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      d0ba8dd7
    • E
      qemu: create object for qemu monitor events · 8059afca
      Eric Blake 提交于
      Create qemu monitor events as a distinct class to normal domain
      events, because they will be filtered differently.  For ease of
      review, the logic for filtering by event name is saved for a later
      patch.
      
      * src/conf/domain_event.c (virDomainQemuMonitorEventClass): New
      class.
      (virDomainEventsOnceInit): Register it.
      (virDomainQemuMonitorEventDispose, virDomainQemuMonitorEventNew)
      (virDomainQemuMonitorEventDispatchFunc)
      (virDomainQemuMonitorEventStateRegisterID): New functions.
      * src/conf/domain_event.h (virDomainQemuMonitorEventNew)
      (virDomainQemuMonitorEventStateRegisterID): New prototypes.
      * src/libvirt_private.syms (conf/domain_conf.h): Export them.
      8059afca
    • M
      9c487f65
  6. 19 3月, 2014 1 次提交
  7. 18 3月, 2014 6 次提交
    • D
      Add virLogSource variables to all source files · 2835c1e7
      Daniel P. Berrange 提交于
      Any source file which calls the logging APIs now needs
      to have a VIR_LOG_INIT("source.name") declaration at
      the start of the file. This provides a static variable
      of the virLogSource type.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      2835c1e7
    • M
      Explicitly cast some switch parameters to enum · 2bc46827
      Martin Kletzander 提交于
      This patch is not trying to fix every switch, just the ones I worked
      with last time, because some of these were especially unreadable.
      Covers enums virDomainGraphicsType and virDomainChrType (where
      applicable).
      
      Also sort its cases by their value.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      2bc46827
    • M
      123a881d
    • N
      Fix memory leak in virDomainChrSourceDefClear() · 24b3fcf9
      Nehal J Wani 提交于
      While running qemuxml2xmltest, it was found that valgrind pointed out
      the following memory leak:
      
      ==21905== 26 bytes in 1 blocks are definitely lost in loss record 23 of 69
      ==21905==    at 0x4A069EE: malloc (vg_replace_malloc.c:270)
      ==21905==    by 0x3E782A754D: xmlStrndup (in /usr/lib64/libxml2.so.2.7.6)
      ==21905==    by 0x4CD986D: virDomainChrSourceDefParseXML (domain_conf.c:7233)
      ==21905==    by 0x4CE4199: virDomainChrDefParseXML (domain_conf.c:7512)
      ==21905==    by 0x4CFAF3F: virDomainDefParseXML (domain_conf.c:12303)
      ==21905==    by 0x4CFB46E: virDomainDefParseNode (domain_conf.c:13031)
      ==21905==    by 0x4CFB5E9: virDomainDefParse (domain_conf.c:12973)
      ==21905==    by 0x41E9D8: testCompareXMLToXMLFiles (qemuxml2xmltest.c:40)
      ==21905==    by 0x41EBAA: testCompareXMLToXMLHelper (qemuxml2xmltest.c:93)
      ==21905==    by 0x421D21: virtTestRun (testutils.c:199)
      ==21905==    by 0x41FCE9: mymain.part.0 (qemuxml2xmltest.c:244)
      ==21905==    by 0x42249D: virtTestMain (testutils.c:782)
      ==21905==
      ... and 7 more
      24b3fcf9
    • N
      Fix memory leak in virDomainSnapshotDiskDefClear() · 7d949aa9
      Nehal J Wani 提交于
      While running domainsnapshotxml2xmltest, it was found that valgrind pointed out
      the following memory leak:
      
      ==32176== 42 (32 direct, 10 indirect) bytes in 1 blocks are definitely lost in loss record 42 of 66
      ==32176==    at 0x4A069EE: malloc (vg_replace_malloc.c:270)
      ==32176==    by 0x4A06B62: realloc (vg_replace_malloc.c:662)
      ==32176==    by 0x4C65A07: virReallocN (viralloc.c:243)
      ==32176==    by 0x4C65B2E: virExpandN (viralloc.c:292)
      ==32176==    by 0x4C65E30: virInsertElementsN (viralloc.c:434)
      ==32176==    by 0x4CD71F3: virDomainDiskSourceDefParse (domain_conf.c:5078)
      ==32176==    by 0x4CF6EF4: virDomainSnapshotDefParseNode (snapshot_conf.c:151)
      ==32176==    by 0x4CF7314: virDomainSnapshotDefParseString (snapshot_conf.c:410)
      ==32176==    by 0x41FB8D: testCompareXMLToXMLHelper (domainsnapshotxml2xmltest.c:100)
      ==32176==    by 0x420FD1: virtTestRun (testutils.c:199)
      ==32176==    by 0x41F859: mymain (domainsnapshotxml2xmltest.c:222)
      ==32176==    by 0x42174D: virtTestMain (testutils.c:782)
      ==32176==
      ... and one more.
      7d949aa9
    • D
      Give virNWFilterVarCombIterNext saner semantics · ef2c4c96
      Daniel P. Berrange 提交于
      The virNWFilterVarCombIterNext method will free its
      parameter when it gets to the end of the iterator.
      This is somewhat misleading design, making it appear
      as if the caller has a memory leak. Remove the free'ing
      of the parameter and ensure that the calling method
      ebiptablesCreateRuleInstanceIterate free's it instead.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      ef2c4c96
  8. 14 3月, 2014 8 次提交
    • L
      conf: eliminate hardcoded indentation in all remaining xml · 68d63c6b
      Laine Stump 提交于
      These last files had such a small change count I just put them into a
      single patch.
      68d63c6b
    • L
      conf: eliminate hardcoded indent in volume/pool xml · 5f845437
      Laine Stump 提交于
      Again completely mechanical, but a lot of lines.
      5f845437
    • L
      conf: eliminate hardcoded indentation in node device xml · f728155f
      Laine Stump 提交于
      Completely mechanical changes, but there were a lot of lines so I made
      it a separate patch.
      f728155f
    • L
      conf: eliminate hardcoded indentation in capabilities xml · 75f0b66c
      Laine Stump 提交于
      There were a lot of changes here, but all very mechanical. For some
      reason, the virBufferPtr had been named "xml" instead of "buf" in this
      file, so since the indentation changing touched almost every line
      using the buffer, I took this chance to change its name for "buf" for
      consistency with every other file.
      75f0b66c
    • L
      conf: eliminate hardcoded indentation in nwfilter xml · d3679928
      Laine Stump 提交于
      This file was using multiple virBuffers, inserting the contents of
      buf3 into buf2, then inserting the contents of buf2 into buf1, rather
      than the more conventional method of just passing around a single
      virBufferPtr and streaming everything into that single buffer. This
      was unnecessary, and also made it more difficult to make indentation
      relative, because when you insert a string into a buffer, the
      indentation of the buffer is only applied once at the beginning of the
      string, *not* each time a newline is encountered in the string.
      d3679928
    • L
      conf: eliminate outmoded/odd indent method from interface xml · 257e62df
      Laine Stump 提交于
      These format functions needed the ability to be indented by an
      arbitrary amount, but were written before the introduction of
      virBufferAdjustIndent(). They instead used the much more clunky method
      of adding a "level" arg to every format function, and padding with
      spaces using the "%*s" printf format specifier (giving it the level,
      and "", which has the effect of adding level spaces to the output).
      
      While eliminating the hardcoded indentation in other xml, I decided it
      was finally time to also modernize the interface formatter code to
      make it more consistent.
      257e62df
    • L
      conf: eliminate hardcoded indent from network xml · b1258b27
      Laine Stump 提交于
      This was very simple, since the only place that had hardcoded
      indentation was a few items in the network status xml.
      b1258b27
    • L
      conf: eliminate hardcoded indent from domain snapshot xml · b9e9b76e
      Laine Stump 提交于
      All leading spaces in domain snapshot xml format functions have been
      replaced with appropriate calls to virBufferAdjustIndent(). This will
      make it easier to call other similarly fixed format functions
      (e.g. domain device format functions).
      b9e9b76e