- 15 4月, 2014 1 次提交
-
-
由 Eric Blake 提交于
Domain snapshots should only permit an external snapshot into a storage format that permits a backing chain, since the new snapshot file necessarily must be backed by the existing file. The C code for the qemu driver is a little bit stricter in currently enforcing only qcow2 or qed, but at the XML parser level, including virt-xml-validate, it is fairly easy to enforce that a user can't request a 'raw' external snapshot. * docs/schemas/storagecommon.rng (storageFormat): Split out... (storageFormatBacking): ...new sublist. * docs/schemas/domainsnapshot.rng (disksnapshotdriver): Use new type. * src/util/virstoragefile.h (virStorageFileFormat): Rearrange for easier code management. * src/util/virstoragefile.c (virStorageFileFormat, fileTypeInfo): Likewise. * src/conf/snapshot_conf.c (virDomainSnapshotDiskDefParseXML): Use new marker to limit selection of formats. Signed-off-by: NEric Blake <eblake@redhat.com> Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
-
- 12 4月, 2014 4 次提交
-
-
由 Eric Blake 提交于
Another field no longer needed, getting us one step closer to merging virStorageFileMetadata and virStorageSource. * src/util/virstoragefile.h (_virStorageFileMetadata): Drop field. * src/util/virstoragefile.c (virStorageFileGetMetadataInternal) (virStorageFileGetMetadataFromFDInternal): Alter signature. (virStorageFileFreeMetadata, virStorageFileGetMetadataFromBuf) (virStorageFileGetMetadataFromFD): Adjust clients. * tests/virstoragetest.c (_testFileData, testStorageChain) (mymain): Simplify test. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
Thanks to the testsuite, I feel quite confident that this rewrite is correct; it gives the same results for all cases except for one. I can make the argument that _that_ case was a pre-existing bug: when looking up relative names, the lookup is supposed to be pegged to the directory that contains the parent qcow2 file. Thus, this resolves the fixme first mentioned in commit 367cd69d (even though I accidentally removed the fixme comment early in 74430fe3). * src/util/virstoragefile.c (virStorageFileChainLookup): Depend on new rather than old fields. * tests/virstoragetest.c (mymain): Adjust test to match fix. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
The original chain lookup code had to pass in the starting name, because it was not available in the chain. But now that we have added fields to the struct, this parameter is redundant. * src/util/virstoragefile.h (virStorageFileChainLookup): Alter signature. * src/util/virstoragefile.c (virStorageFileChainLookup): Adjust handling of top of chain. * src/qemu/qemu_driver.c (qemuDomainBlockCommit): Adjust caller. * tests/virstoragetest.c (testStorageLookup, mymain): Likewise. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
The chain lookup function was inconsistent on whether it left a message in the log when looking up a name that is not found on the chain (leaving a message for OOM or if name was relative but not part of the chain), and could litter the log even when successful (when name was relative but deep in the chain, use of virFindBackingFile early in the chain would complain about a file not found). It's easier to make the function consistently emit a message exactly once on failure, and to let all callers rely on the clean semantics. * src/util/virstoragefile.c (virStorageFileChainLookup): Always report error on failure. Simplify relative lookups. * src/qemu/qemu_driver.c (qemuDomainBlockCommit): Avoid overwriting error. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 11 4月, 2014 5 次提交
-
-
由 Eric Blake 提交于
Drop another redundant field from virStorageFileMetadata. * src/util/virstoragefile.h (_virStorageFileMetadata): Drop field. * src/util/virstoragefile.c (virStorageFileGetMetadataFromFDInternal) (virStorageFileGetMetadataFromFD) (virStorageFileGetMetadataRecurse): Adjust callers. * tests/virstoragetest.c (_testFileData, testStorageChain) (mymain): Simplify test. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
A couple pieces of virStorageFileMetadata are used only while collecting information about the chain, and don't need to live permanently in the struct. This patch refactors external callers to collect the information separately, so that the next patch can remove the fields. * src/util/virstoragefile.h (virStorageFileGetMetadataFromBuf): Alter signature. * src/util/virstoragefile.c (virStorageFileGetMetadataInternal): Likewise. (virStorageFileGetMetadataFromFDInternal): Adjust callers. * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget): Likewise. * src/storage/storage_backend_gluster.c (virStorageBackendGlusterRefreshVol): Likewise. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
Finally starting to prune away some of the old fields that have been made redundant by the new fields, on my way towards directly reusing virStorageSource. * src/util/virstoragefile.h (_virStorageFileMetadata): Drop field. * src/util/virstoragefile.c (virStorageFileGetMetadataInternal) (virStorageFileChainLookup): Adjust callers. * tests/virstoragetest.c (_testFileData, testStorageChain) (mymain): Simplify test. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
Deciding if a user string represents a local file instead of a network path is an operation worth exposing directly, particularly since the next patch will be removing a redundant variable that was caching the information. * src/util/virstoragefile.h (virStorageIsFile): New declaration. * src/util/virstoragefile.c (virBackingStoreIsFile): Rename... (virStorageIsFile): ...export, and allow NULL input. (virStorageFileGetMetadataInternal) (virStorageFileGetMetadataRecurse, virStorageFileGetMetadata): Update callers. * src/conf/domain_conf.c (virDomainDiskDefForeachPath): Use it. * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget): Likewise. * src/libvirt_private.syms (virstoragefile.h): Export function. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
So far, my work has been merely preserving the status quo of backing file analysis. But this patch starts to tread in the territory of making the backing chain code more powerful - we will eventually support network storage containing non-raw formats. Here, we expose metadata information about a network backing store, even if that information is still hardcoded to a raw format for now. * src/util/virstoragefile.c (virStorageFileGetMetadataRecurse): Also populate struct for non-file backing. (virStorageFileGetMetadata, virStorageFileGetMetadatainternal): Recognize non-file top image. (virFindBackingFile): Add comment. (virStorageFileChainGetBroken): Adjust comment, ensure output is set. * tests/virstoragetest.c (mymain): Update test to reflect it. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 09 4月, 2014 5 次提交
-
-
由 Eric Blake 提交于
The current use of virStorageFileMetadata is awkward; to learn some of the information about a child node, you have to read fields in the parent node. This does not lend itself well to modifying backing chains (whether inserting a new node in the chain, or consolidating existing nodes); better would be to learn about a child node directly in that node. This patch sets up some new fields which contain redundant information, although not necessarily in the final desired state for the new fields (see the next patch for actual tests of what is there now). Then later patches will do any refactoring necessary to get the fields to their desired states, and update clients to get the information from the new fields, so we can finally delete the fields that are tracking information about the wrong node. More concretely, compare these three example backing chains: good <- one missing <- two gluster://server/vol/img <- three Pre-patch, querying the chains gives: { .backingStore = "/path/to/good", .backingStoreRaw = "good", .backingStoreIsFile = true, .backingStoreFormat = VIR_STORAGE_FILE_RAW, .backingMeta = { .backingStore = NULL, .backingStoreRaw = NULL, .backingStoreIsFile = false, .backingMeta = NULL, } } { .backingStore = NULL, .backingStoreRaw = "missing", .backingStoreIsFile = false, .backingStoreFormat = VIR_STORAGE_FILE_NONE, .backingMeta = NULL, } { .backingStore = "gluster://server/vol/img", .backingStoreRaw = NULL, .backingStoreIsFile = false, .backingStoreFormat = VIR_STORAGE_FILE_RAW, .backingMeta = NULL, } Deciding whether to ignore a missing backing file (as in virsh vol-dumpxml) or report an error (as in security manager sVirt labeling) requires reading multiple fields. Plus, the format is hard-coded to treat all network protocols as end-of-the-chain, as if they were raw. By the end of this patch series, the goal is to instead represent these three situations as: { .path = "one", .canonPath = "/path/to/one", .type = VIR_STORAGE_TYPE_FILE, .format = VIR_STORAGE_FILE_QCOW2, .backingStoreRaw = "good", .backingMeta = { .path = "good", .canonPath = "/path/to/good", .type = VIR_STORAGE_TYPE_FILE, .format = VIR_STORAGE_FILE_RAW, .backingStoreRaw = NULL, .backingMeta = NULL, } } { .path = "two", .canonPath = "/path/to/two", .type = VIR_STORAGE_TYPE_FILE, .format = VIR_STORAGE_FILE_QCOW2, .backingStoreRaw = "missing", .backingMeta = NULL, } { .path = "three", .canonPath = "/path/to/three", .type = VIR_STORAGE_TYPE_FILE, .format = VIR_STORAGE_FILE_QCOW2, .backingStoreRaw = "gluster://server/vol/img", .backingMeta = { .path = "gluster://server/vol/img", .canonPath = "gluster://server/vol/img", .type = VIR_STORAGE_TYPE_NETWORK, .format = VIR_STORAGE_FILE_RAW, .backingStoreRaw = NULL, .backingMeta = NULL, } } or, for the second file, maybe also allowing: { .path = "two", .canonPath = "/path/to/two", .type = VIR_STORAGE_TYPE_FILE, .format = VIR_STORAGE_FILE_QCOW2, .backingStoreRaw = "missing", .backingMeta = { .path = "missing", .canonPath = NULL, .type = VIR_STORAGE_TYPE_NONE, .format = VIR_STORAGE_FILE_NONE, .backingStoreRaw = NULL, .backingMeta = NULL, } } * src/util/virstoragefile.h (_virStorageFileMetadata): Add path, canonPath, relDir, type, and format fields. Reorder existing fields, and add lots of comments. * src/util/virstoragefile.c (virStorageFileFreeMetadata): Clean new fields. (virStorageFileGetMetadataInternal) (virStorageFileGetMetadataFromFDInternal): Start populating new fields. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
Right now, we are allocating virStorageFileMetadata near the bottom of the callchain, only after we have identified that we are visiting a file (and not a network resource). I'm hoping to eventually support parsing the backing chain from XML, where the backing chain crawl then validates what was parsed rather than allocating a fresh structure. Likewise, I'm working towards a setup where we have a backing element even for networks. Both of these use cases are easier to code if the allocation is hoisted earlier. * src/util/virstoragefile.c (virStorageFileGetMetadataInternal) (virStorageFileGetMetadataFromFDInternal): Change signature. (virStorageFileGetMetadataFromBuf) (virStorageFileGetMetadataRecurse, virStorageFileGetMetadata): Update callers. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
The previous patch started a separation of error messages reported against the user-specified name, vs. tracking the canonical path that was actually opened. This patch extends that notion, by hoisting directory detection up front, passing the canonical path through the entire call chain, and simplifying lower-level functions that can now assume that a canonical path and directory have been supplied. * src/util/virstoragefile.c (virStorageFileGetMetadataFromFDInternal) (virStorageFileGetMetadataInternal): Add parameter, require directory. (virFindBackingFile): Require directory. (virStorageFileGetMetadataFromFD): Pass canonical path. (virStorageFileGetMetadataFromBuf): Likewise. (virStorageFileGetMetadata): Determine initial directory. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Peter Krempa 提交于
Now that the storage source definition is uniform convert the helpers to retrieve the actual storage type to a single one.
-
由 Eric Blake 提交于
While trying to refactor the backing file chain, I noticed that if you have a self-referential qcow2 file via a relative name: qemu-img create -f qcow2 loop 10M qemu-img rebase -u -f qcow2 -F qcow2 -b loop loop then libvirt was creating a chain 2 deep before realizing it had hit a loop; furthermore, virStorageFileChainCheckBroken was not identifying the chain as broken. With this patch, the loop is detected when the chain is only 1 deep; still enough for storage volume XML to display the file, but now with a proper error report about where the loop was found. This patch adds a parameter to virStorageFileGetMetadataRecurse, so that errors at the top of the chain remain unchanged; messages issued for backing files now use the name provided by the user instead of the canonical name (for VDSM, which uses relative symlinks to device mapper block devices, this is actually more useful). * src/util/virstoragefile.c (virStorageFileGetMetadataRecurse): Add parameter, require canonical path up front. Mark chain broken on OOM or loop detection. (virStorageFileGetMetadata): Pass in canonical name. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 08 4月, 2014 1 次提交
-
-
由 Eric Blake 提交于
I noticed that the apparmor code could request metadata even for a cdrom with no media, which would cause a memory leak of the hash table used to look for loops in the backing chain. But even before that, we blindly dereferenced the path for printing a debug statement, so it is just better to enforce that this is only used on non-NULL names. * src/util/virstoragefile.c (virStorageFileGetMetadata): Assume non-NULL path. * src/util/virstoragefile.h: Annotate this. * src/security/virt-aa-helper.c (get_files): Fix caller. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 05 4月, 2014 1 次提交
-
-
由 Eric Blake 提交于
Right now, virStorageFileMetadata tracks bool backingStoreIsFile for whether the backing string specified in metadata can be resolved as a file (covering both block and regular file resources) or is treated as a network protocol. But when merging this struct with virStorageSource, it will be easier to just actually track which type of resource it is, as well as have a reserved value for the case where the resource type is unknown (or had an error during probing). * src/util/virstoragefile.h (virStorageType): Add a placeholder value, swap order to match similar public enum. * src/util/virstoragefile.c (virStorage): Update string mapping. * src/conf/domain_conf.c (virDomainDiskSourceParse) (virDomainDiskDefParseXML, virDomainDiskDefFormat) (virDomainDiskSourceFormat): Adjust clients. * src/conf/snapshot_conf.c (virDomainSnapshotDiskDefParseXML): Likewise. * src/qemu/qemu_driver.c (qemuDomainSnapshotPrepareDiskExternalBackingInactive) (qemuDomainSnapshotPrepareDiskExternalOverlayActive) (qemuDomainSnapshotPrepareDiskExternalOverlayInactive) (qemuDomainSnapshotPrepareDiskInternal) (qemuDomainSnapshotCreateSingleDiskActive): Likewise. * src/qemu/qemu_command.c (qemuGetDriveSourceString): Likewise. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 02 4月, 2014 8 次提交
-
-
由 Eric Blake 提交于
A future patch will merge virStorageFileMetadata and virStorageSource, but I found it easier to do if both structs use the same information for tracking whether a source file needs encryption keys. * src/util/virstoragefile.h (_virStorageFileMetadata): Prepare full encryption struct instead of just a bool. * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget): Use transfer semantics. * src/storage/storage_backend_gluster.c (virStorageBackendGlusterRefreshVol): Likewise. * src/util/virstoragefile.c (virStorageFileGetMetadataInternal): Populate struct. (virStorageFileFreeMetadata): Adjust clients. * tests/virstoragetest.c (testStorageChain): Likewise. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
Another step towards unification of structures. While we might not expose everything in XML via domain disk as we do for storage volume pointer, both places want to deal with (at least part of) the backing chain; therefore, moving towards a single struct usable from both contexts will make the backing chain code more reusable. * src/conf/storage_conf.h (_virStoragePerms) (virStorageTimestamps): Move... * src/util/virstoragefile.h: ...here. (_virStorageSource): Add more fields. * src/util/virstoragefile.c (virStorageSourceClear): Clean additional fields. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 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>
-
由 Eric Blake 提交于
The code in virstoragefile.c is getting more complex as I consolidate backing chain handling code. But for the setuid virt-login-shell, we don't need to crawl backing chains. It's easier to audit things for setuid security if there are fewer files involved, so this patch moves the one function that virFileOpen() was actually relying on to also live in virfile.c. * src/util/virstoragefile.c (virStorageFileIsSharedFS) (virStorageFileIsSharedFSType): Move... * src/util/virfile.c (virFileIsSharedFS, virFileIsSharedFSType): ...to here, and rename. (virFileOpenAs): Update caller. * src/security/security_selinux.c (virSecuritySELinuxSetFileconHelper) (virSecuritySELinuxSetSecurityAllLabel) (virSecuritySELinuxRestoreSecurityImageLabelInt): Likewise. * src/security/security_dac.c (virSecurityDACRestoreSecurityImageLabelInt): Likewise. * src/qemu/qemu_driver.c (qemuOpenFileAs): Likewise. * src/qemu/qemu_migration.c (qemuMigrationIsSafe): Likewise. * src/util/virstoragefile.h: Adjust declarations. * src/util/virfile.h: Likewise. * src/libvirt_private.syms (virfile.h, virstoragefile.h): Move symbols as appropriate. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 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>
-
由 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>
-
由 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>
-
由 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>
-
- 31 3月, 2014 1 次提交
-
-
由 Peter Krempa 提交于
When virStorageFileGetMetadata is called with NULL path argument, the invalid pointer boils down through the recursive worker and is caught by virHashAddEntry which is thankfully resistant to NULL arguments. As it doesn't make sense to pursue backing chains of NULL volumes, exit earlier. This was noticed in the virt-aahelper-test with a slightly modified codebase.
-
- 25 3月, 2014 1 次提交
-
-
由 Ján Tomko 提交于
-
- 18 3月, 2014 1 次提交
-
-
由 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>
-
- 07 11月, 2013 4 次提交
-
-
由 Eric Blake 提交于
This gets rid of another stat() per volume, as well as cutting bytes read in half, when populating the volumes of a directory pool during a pool refresh. Not to mention that it provides an interface that can let gluster pools also probe file types. * src/util/virstoragefile.h (virStorageFileProbeFormatFromFD): Delete. (virStorageFileProbeFormatFromBuf): New prototype. (VIR_STORAGE_MAX_HEADER): New constant, based on... * src/util/virstoragefile.c (STORAGE_MAX_HEAD): ...old name. (vmdk4GetBackingStore, virStorageFileGetMetadataInternal) (virStorageFileProbeFormat): Adjust clients. (virStorageFileProbeFormatFromFD): Delete. (virStorageFileProbeFormatFromBuf): Export. * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget): Adjust client. * src/libvirt_private.syms (virstoragefile.h): Adjust exports. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
Future patches will want to learn metadata about a file using a buffer that was already parsed in order to probe the file's format. Rather than reopening and re-reading the file, it makes sense to separate getting file contents from actually parsing those contents. * src/util/virstoragefile.c (virStorageFileGetMetadataFromBuf) (virStorageFileGetMetadataFromFDInternal): New functions. (virStorageFileGetMetadataInternal): Hoist fstat() and read() into callers. (virStorageFileGetMetadataFromFD) (virStorageFileGetMetadataRecurse): Rework clients. * src/util/virstoragefile.h (virStorageFileGetMetadataFromBuf): New prototype. * src/libvirt_private.syms (virstoragefile.h): Export it. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
Our backing file chain code was not very robust to an ill-timed EINTR, which could lead to a short read causing us to randomly treat metadata differently than usual. But the existing virFileReadLimFD forces an error if we don't read the entire file, even though we only care about the header of the file. So add a new virFile function that does what we want. * src/util/virfile.h (virFileReadHeaderFD): New prototype. * src/util/virfile.c (virFileReadHeaderFD): New function. * src/libvirt_private.syms (virfile.h): Export it. * src/util/virstoragefile.c (virStorageFileGetMetadataInternal) (virStorageFileProbeFormatFromFD): Use it. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
'unsigned char *' makes sense if you are doing math on bytes and don't want to worry about wraparound from a signed 'char'; but since all we are doing is memcmp() or virReadBufInt*[LB]E(), which are both safe on either type of char, and since read() prefers to operate on 'char *', it's simpler to avoid casts by just typing things as 'char *' from the get-go. [Technically, read can operate on an 'unsigned char *' thanks to the C rule that any pointer can be implicitly converted to 'char *' for legacy K&R compatibility; but where this patch saves us is if we try to use virfile.h functions that take 'char **' in order to allocate the buffer, where the compiler would barf on type mismatch.] * src/util/virstoragefile.c (FileTypeInfo): Avoid unsigned char. (cowGetBackingStore, qcow2GetBackingStoreFormat) (qcowXGetBackingStore, qcow1GetBackingStore) (qcow2GetBackingStore, vmdk4GetBackingStore, qedGetBackingStore) (virStorageFileMatchesMagic, virStorageFileMatchesVersion) (virStorageFileProbeFormatFromBuf, qcow2GetFeatures) (virStorageFileGetMetadataInternal) (virStorageFileProbeFormatFromFD): Simplify clients. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 05 11月, 2013 1 次提交
-
-
由 Eric Blake 提交于
A qcow2 file with a backing file of 'gluster://host/vol/file' should not try to look for a directory named './gluster:/' in the file system. * src/util/virstoragefile.c (virBackingStoreIsFile): Broaden check to include all protocols. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 21 10月, 2013 1 次提交
-
-
由 Daniel P. Berrange 提交于
Most of the usage of getuid()/getgid() is in cases where we are considering what privileges we have. As such the code should be using the effective IDs, not real IDs. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 01 10月, 2013 1 次提交
-
-
由 Laine Stump 提交于
This should resolve: https://bugzilla.redhat.com/show_bug.cgi?id=1012085 libvirt previously recognized NFS, GFS2, OCFS2, and AFS filesystems as "shared", and thus eligible for exceptions to certain rules/actions about chowning image files before handing them off to a guest. This patch widens the definition of "shared filesystem" to include SMB and CIFS filesystems (aka "Windows file sharing"); both of these use the same protocol, but different drivers so there are different magic numbers for each.
-
- 01 8月, 2013 1 次提交
-
-
由 Guannan Ren 提交于
*src/util/virstoragefile.c: Add a helper function to get the first name of missing backing files, if the name is NULL, it means the diskchain is not broken. *src/qemu/qemu_domain.c: qemuDiskChainCheckBroken(disk) to check if its chain is broken
-
- 11 7月, 2013 1 次提交
-
-
由 Daniel P. Berrange 提交于
Convert the type of loop iterators named 'i', 'j', k', 'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or 'unsigned int', also santizing 'ii', 'jj', 'kk' to use the normal 'i', 'j', 'k' naming Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 10 7月, 2013 2 次提交
-
-
由 Michal Privoznik 提交于
-
由 Martin Kletzander 提交于
Initially proposed as [1], but then changed to comment fix only. VMDK can have internal version set to 2 when there are few features added which do not affect us. Thanks to Jan's commit a1ee8e18 this can be easily fixed by adding it to list of supported versions. [1] http://www.redhat.com/archives/libvir-list/2013-June/msg00419.html Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=836676
-
- 21 6月, 2013 1 次提交
-
-
由 Ján Tomko 提交于
Detect qcow2 images with version 3 in the image header as VIR_STORAGE_FILE_QCOW2. These images have a feature bitfield, with just one feature supported so far: lazy_refcounts. The header length changed too, moving the location of the backing format name.
-