附加/分离存储的源代码分析

Attach Storage
AttachStorageDomainToPoolCommand.java
AttachStorageDomainVDSCommand.java
GetImagesListVDSCommand.java---获取存储域内的所有images
GetVolumesListVDSCommand.java
GetImageInfoVDSCommand.java
RetrieveImageDataCommand.java---解析OVF_STORE文件
AttachStorageDomainToPoolCommand.java
ActivateStorageDomainCommand.java
OvfDataUpdater.java
ProcessOvfUpdateForStoragePoolCommand.java
UploadStreamVDSCommand.java


Detach Storage
DeactivateStorageDomainWithOvfUpdateCommand.java---如果它是数据域-->
ProcessOvfUpdateForStoragePoolCommand.java
  updateOvfForVmsOfStoragePool()
  populateVmsMetadataForOvfUpdate()
  buildMetadataDictionaryForVm()
  OvfUpdateProcessHelper.java
    generateVmMetadata()
    OvfManager.java
      ExportVm()
      OvfVmWriter.java
      OvfWriter.java
  performOvfUpdate()---
    getVmAndTemplatesGenerationsDAO().updateOvfGenerations(guidsForUpdate, ovfGenerationsForUpdate, ovfConfigurationsInfo);---将上面的生成的Ovf_Data插入数据库表vm_ovf_generations
ProcessOvfUpdateForStorageDomainCommand.java
CreateOvfStoresForStorageDomainCommand.java
CreateOvfVolumeForStorageDomainCommand.java
AddDiskCommand.java
AddImageFromScratchCommand.java--创建images(bfffc2fd-449a-4d97-ae0d-42b90bb2f953/images/0736e854-3716-4f5d-9ed5-a1b2da68b291)---Volume.create
ProcessOvfUpdateForStorageDomainCommand.java
SetVolumeDescriptionVDSCommand.java----Volume.setDescription
UploadStreamCommand.java
  byteArrayInputStream---vmAndTemplatesIds--不包括共享盘
  byte[] bytes = buildOvfInfoFileByteArray(vmAndTemplatesIds);
  通过字节流的方式向后端发送的
UploadStreamVDSCommand.java
HttpImageTaskVDSCommand.java



initOvfDataUpdater
OvfDataUpdater.java
SELECT * from storage_domains_ovf_info; 存的是vm的ID
VolumeType.Preallocated
db_generation
ovf_generation
getOvfUpdateProcessHelper().loadVmData(vm);



vdsm:
644 Detector thread::DEBUG::2016-01-22 07:38:20,460::protocoldetector::187::vds.MultiProtocolAcceptor::(_add_connection) Adding connection from 192.168.70.7:44142
645 Detector thread::DEBUG::2016-01-22 07:38:20,486::protocoldetector::201::vds.MultiProtocolAcceptor::(_remove_connection) Connection removed from 192.168.70.7:44142
646 Detector thread::DEBUG::2016-01-22 07:38:20,486::protocoldetector::247::vds.MultiProtocolAcceptor::(_handle_connection_read) Detected protocol xml from 192.168.70.7:44142
647 Detector thread::DEBUG::2016-01-22 07:38:20,487::BindingXMLRPC::1223::XmlDetector::(handleSocket) xml over http detected from ('192.168.70.7', 44142)
648 Thread-64216::DEBUG::2016-01-22 07:38:20,492::task::595::Storage.TaskManager.Task::(_updateState) Task=`de4abd93-b707-4835-a642-23af5088022c`::moving from state init -> state preparing
649 Thread-64216::INFO::2016-01-22 07:38:20,492::logUtils::44::dispatcher::(wrapper) Run and protect: downloadImageFromStream(methodArgs={'length': 20480, 'fileObj': <socket._fileobject object at 0x7f0b2c290250>}, callback=<function  setCallback at 0x7f0b5018ba28>, spUUID='d2b85873-c8ed-4725-8230-09eb0aba54fc', sdUUID='2b9d9c7a-91a9-45ec-99b5-fd58b58641f9', imgUUID='500b1522-0978-49f3-ad82-1a14352169e5', volUUID='0923409c-fbc8-4525-925a-72a4d135b532')

downloadImageFromStream()
XmlDetector


2016-01-25 11:27:35,171 INFO  [org.ovirt.engine.core.vdsbroker.irsbroker.CreateImageVDSCommand] (org.ovirt.thread.pool-8-thread-22) [7f9d03f8] START, CreateImageVDSCommand( storagePoolId = d2b85873-c8ed-4725-8230-09eb0aba54fc, ignoreFailoverLimit = false, storageDomainId = f96b6271-d591-49b7-b65b-23f8ea893535, imageGroupId = df1bf713-5aea-46f7-8487-80a66678bd20, imageSizeInBytes = 134217728, volumeFormat = RAW, newImageId = ad33c4eb-669b-4e4e-8a84-1ff62b852dd4, newImageDescription = {"DiskAlias":"OVF_STORE","DiskDescription":"OVF_STORE"}), log id: 12f478c2
2016-01-25 11:27:35,174 INFO  [org.ovirt.engine.core.vdsbroker.irsbroker.CreateImageVDSCommand] (org.ovirt.thread.pool-8-thread-22) [7f9d03f8] -- executeIrsBrokerCommand: calling 'createVolume' with two new parameters: description and UUID
2016-01-25 11:27:35,766 INFO  [org.ovirt.engine.core.vdsbroker.irsbroker.CreateImageVDSCommand] (org.ovirt.thread.pool-8-thread-22) [7f9d03f8] FINISH, CreateImageVDSCommand, return: ad33c4eb-669b-4e4e-8a84-1ff62b852dd4, log id: 12f478c2


2016-01-25 11:28:02,340 INFO  [org.ovirt.engine.core.vdsbroker.irsbroker.SetVolumeDescriptionVDSCommand] (org.ovirt.thread.pool-8-thread-17) [21ae43a2] -- setVolumeDescription parameters:
                spUUID=d2b85873-c8ed-4725-8230-09eb0aba54fc
                sdUUID=f96b6271-d591-49b7-b65b-23f8ea893535
                imageGroupGUID=df1bf713-5aea-46f7-8487-80a66678bd20
                volUUID=ad33c4eb-669b-4e4e-8a84-1ff62b852dd4
                description={"Updated":false,"Disk Description":"OVF_STORE","Storage Domains":[{"uuid":"f96b6271-d591-49b7-b65b-23f8ea893535"}],"Last Updated":null}

2016-01-25 11:28:02,544 INFO  [org.ovirt.engine.core.vdsbroker.irsbroker.UploadStreamVDSCommand] (org.ovirt.thread.pool-8-thread-17) [38bf1f67] -- parameters:
                spUUID=d2b85873-c8ed-4725-8230-09eb0aba54fc
                sdUUID=f96b6271-d591-49b7-b65b-23f8ea893535
                imageGUID=df1bf713-5aea-46f7-8487-80a66678bd20
                volUUID=ad33c4eb-669b-4e4e-8a84-1ff62b852dd4
                size=10,240

你可能感兴趣的:(附加/分离存储的源代码分析)