1 | /* $Id: ApplianceImplPrivate.h 84312 2020-05-14 17:46:45Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox Appliance private data definitions
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2020 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef MAIN_INCLUDED_ApplianceImplPrivate_h
|
---|
19 | #define MAIN_INCLUDED_ApplianceImplPrivate_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 |
|
---|
25 | class VirtualSystemDescription;
|
---|
26 |
|
---|
27 | #include "ovfreader.h"
|
---|
28 | #include "SecretKeyStore.h"
|
---|
29 | #include "ThreadTask.h"
|
---|
30 | #include "CertificateImpl.h"
|
---|
31 | #include <map>
|
---|
32 | #include <vector>
|
---|
33 | #include <iprt/manifest.h>
|
---|
34 | #include <iprt/vfs.h>
|
---|
35 | #include <iprt/crypto/x509.h>
|
---|
36 | #include <iprt/crypto/pkcs7.h>
|
---|
37 |
|
---|
38 | ////////////////////////////////////////////////////////////////////////////////
|
---|
39 | //
|
---|
40 | // Appliance data definition
|
---|
41 | //
|
---|
42 | ////////////////////////////////////////////////////////////////////////////////
|
---|
43 |
|
---|
44 | namespace settings
|
---|
45 | {
|
---|
46 | struct AttachedDevice;
|
---|
47 | }
|
---|
48 |
|
---|
49 | typedef std::pair<Utf8Str, Utf8Str> STRPAIR;
|
---|
50 |
|
---|
51 | typedef std::vector<com::Guid> GUIDVEC;
|
---|
52 |
|
---|
53 | /* Describe a location for the import/export. The location could be a file on a
|
---|
54 | * local hard disk or a remote target based on the supported inet protocols. */
|
---|
55 | struct LocationInfo
|
---|
56 | {
|
---|
57 | LocationInfo()
|
---|
58 | : storageType(VFSType_File) {}
|
---|
59 | VFSType_T storageType; /* Which type of storage should be handled */
|
---|
60 | Utf8Str strProvider; /* cloud provider name in case of export/import to Cloud */
|
---|
61 | Utf8Str strPath; /* File path for the import/export */
|
---|
62 | Utf8Str strHostname; /* Hostname on remote storage locations (could be empty) */
|
---|
63 | Utf8Str strUsername; /* Username on remote storage locations (could be empty) */
|
---|
64 | Utf8Str strPassword; /* Password on remote storage locations (could be empty) */
|
---|
65 | };
|
---|
66 |
|
---|
67 | /**
|
---|
68 | * opaque private instance data of Appliance class
|
---|
69 | */
|
---|
70 | struct Appliance::Data
|
---|
71 | {
|
---|
72 | enum digest_T {SHA1, SHA256};
|
---|
73 |
|
---|
74 | Data()
|
---|
75 | : state(Appliance::ApplianceIdle)
|
---|
76 | , fDigestTypes(0)
|
---|
77 | , hOurManifest(NIL_RTMANIFEST)
|
---|
78 | , fManifest(true)
|
---|
79 | , fDeterminedDigestTypes(false)
|
---|
80 | , hTheirManifest(NIL_RTMANIFEST)
|
---|
81 | , hMemFileTheirManifest(NIL_RTVFSFILE)
|
---|
82 | , fSignerCertLoaded(false)
|
---|
83 | , fCertificateIsSelfSigned(false)
|
---|
84 | , fSignatureValid(false)
|
---|
85 | , fCertificateValid(false)
|
---|
86 | , fCertificateMissingPath(true)
|
---|
87 | , fCertificateValidTime(false)
|
---|
88 | , pbSignedDigest(NULL)
|
---|
89 | , cbSignedDigest(0)
|
---|
90 | , enmSignedDigestType(RTDIGESTTYPE_INVALID)
|
---|
91 | , fContentInfoLoaded(false)
|
---|
92 | , fContentInfoValid(false)
|
---|
93 | , fContentInfoSameCert(false)
|
---|
94 | , fContentInfoValidSignature(false)
|
---|
95 | , fExportISOImages(false)
|
---|
96 | , pReader(NULL)
|
---|
97 | , ulWeightForXmlOperation(0)
|
---|
98 | , ulWeightForManifestOperation(0)
|
---|
99 | , ulTotalDisksMB(0)
|
---|
100 | , cDisks(0)
|
---|
101 | , m_cPwProvided(0)
|
---|
102 | {
|
---|
103 | RT_ZERO(SignerCert);
|
---|
104 | RT_ZERO(ContentInfo);
|
---|
105 | }
|
---|
106 |
|
---|
107 | ~Data()
|
---|
108 | {
|
---|
109 | if (pReader)
|
---|
110 | {
|
---|
111 | delete pReader;
|
---|
112 | pReader = NULL;
|
---|
113 | }
|
---|
114 | resetReadData();
|
---|
115 | }
|
---|
116 |
|
---|
117 | /**
|
---|
118 | * Resets data used by read.
|
---|
119 | */
|
---|
120 | void resetReadData(void)
|
---|
121 | {
|
---|
122 | strOvfManifestEntry.setNull();
|
---|
123 | if (hOurManifest != NIL_RTMANIFEST)
|
---|
124 | {
|
---|
125 | RTManifestRelease(hOurManifest);
|
---|
126 | hOurManifest = NIL_RTMANIFEST;
|
---|
127 | }
|
---|
128 | if (hTheirManifest != NIL_RTMANIFEST)
|
---|
129 | {
|
---|
130 | RTManifestRelease(hTheirManifest);
|
---|
131 | hTheirManifest = NIL_RTMANIFEST;
|
---|
132 | }
|
---|
133 | if (hMemFileTheirManifest)
|
---|
134 | {
|
---|
135 | RTVfsFileRelease(hMemFileTheirManifest);
|
---|
136 | hMemFileTheirManifest = NIL_RTVFSFILE;
|
---|
137 | }
|
---|
138 | if (pbSignedDigest)
|
---|
139 | {
|
---|
140 | RTMemFree(pbSignedDigest);
|
---|
141 | pbSignedDigest = NULL;
|
---|
142 | cbSignedDigest = 0;
|
---|
143 | }
|
---|
144 | if (fSignerCertLoaded)
|
---|
145 | {
|
---|
146 | RTCrX509Certificate_Delete(&SignerCert);
|
---|
147 | fSignerCertLoaded = false;
|
---|
148 | }
|
---|
149 | RT_ZERO(SignerCert);
|
---|
150 | enmSignedDigestType = RTDIGESTTYPE_INVALID;
|
---|
151 | fCertificateIsSelfSigned = false;
|
---|
152 | fSignatureValid = false;
|
---|
153 | fCertificateValid = false;
|
---|
154 | fCertificateMissingPath = true;
|
---|
155 | fCertificateValidTime = false;
|
---|
156 | fDeterminedDigestTypes = false;
|
---|
157 | fDigestTypes = RTMANIFEST_ATTR_SHA1 | RTMANIFEST_ATTR_SHA256 | RTMANIFEST_ATTR_SHA512;
|
---|
158 | ptrCertificateInfo.setNull();
|
---|
159 | strCertError.setNull();
|
---|
160 | if (fContentInfoLoaded)
|
---|
161 | {
|
---|
162 | RTCrPkcs7ContentInfo_Delete(&ContentInfo);
|
---|
163 | fContentInfoLoaded = false;
|
---|
164 | }
|
---|
165 | RT_ZERO(ContentInfo);
|
---|
166 | }
|
---|
167 |
|
---|
168 | Appliance::ApplianceState state;
|
---|
169 |
|
---|
170 | LocationInfo locInfo; // location info for the currently processed OVF
|
---|
171 | /** The digests types to calculate (RTMANIFEST_ATTR_XXX) for the manifest.
|
---|
172 | * This will be a single value when exporting. Zero, one or two. */
|
---|
173 | uint32_t fDigestTypes;
|
---|
174 | /** Manifest created while importing or exporting. */
|
---|
175 | RTMANIFEST hOurManifest;
|
---|
176 |
|
---|
177 | /** @name Write data
|
---|
178 | * @{ */
|
---|
179 | bool fManifest; // Create a manifest file on export
|
---|
180 | /** @} */
|
---|
181 |
|
---|
182 | /** @name Read data
|
---|
183 | * @{ */
|
---|
184 | /** The manifest entry name of the OVF-file. */
|
---|
185 | Utf8Str strOvfManifestEntry;
|
---|
186 |
|
---|
187 | /** Set if we've parsed the manifest and determined the digest types. */
|
---|
188 | bool fDeterminedDigestTypes;
|
---|
189 |
|
---|
190 | /** Manifest read in during read() and kept around for later verification. */
|
---|
191 | RTMANIFEST hTheirManifest;
|
---|
192 | /** Memorized copy of the manifest file for signature checking purposes. */
|
---|
193 | RTVFSFILE hMemFileTheirManifest;
|
---|
194 |
|
---|
195 | /** The signer certificate from the signature file (.cert).
|
---|
196 | * This will be used in the future provide information about the signer via
|
---|
197 | * the API. */
|
---|
198 | RTCRX509CERTIFICATE SignerCert;
|
---|
199 | /** Set if the SignerCert member contains usable data. */
|
---|
200 | bool fSignerCertLoaded;
|
---|
201 | /** Cached RTCrX509Validity_IsValidAtTimeSpec result set by read(). */
|
---|
202 | bool fCertificateIsSelfSigned;
|
---|
203 | /** Set by read() if pbSignedDigest verified correctly against SignerCert. */
|
---|
204 | bool fSignatureValid;
|
---|
205 | /** Set by read() when the SignerCert checked out fine. */
|
---|
206 | bool fCertificateValid;
|
---|
207 | /** Set by read() when the SignerCert certificate path couldn't be built. */
|
---|
208 | bool fCertificateMissingPath;
|
---|
209 | /** Set by read() when the SignerCert (+path) is valid in the temporal sense. */
|
---|
210 | bool fCertificateValidTime;
|
---|
211 | /** For keeping certificate error messages we delay from read() to import(). */
|
---|
212 | Utf8Str strCertError;
|
---|
213 | /** The signed digest of the manifest. */
|
---|
214 | uint8_t *pbSignedDigest;
|
---|
215 | /** The size of the signed digest. */
|
---|
216 | size_t cbSignedDigest;
|
---|
217 | /** The digest type used to sign the manifest. */
|
---|
218 | RTDIGESTTYPE enmSignedDigestType;
|
---|
219 | /** The certificate info object. This is NULL if no signature and
|
---|
220 | * successfully loaded certificate. */
|
---|
221 | ComObjPtr<Certificate> ptrCertificateInfo;
|
---|
222 |
|
---|
223 | /** The PKCS\#7/CMS signed data signing manifest, optional VBox extension.
|
---|
224 | * This contains at least one signature using the same certificate as above
|
---|
225 | * (SignerCert), but should preferrably use a different digest. The PKCS\#7/CMS
|
---|
226 | * format is a lot more versatile, allow multiple signatures using different
|
---|
227 | * digests and certificates, optionally with counter signed timestamps.
|
---|
228 | * Additional intermediate certificates can also be shipped, helping to bridge
|
---|
229 | * the gap to a trusted root certificate installed on the recieving system. */
|
---|
230 | RTCRPKCS7CONTENTINFO ContentInfo;
|
---|
231 | /** Set if the ContentInfo member contains usable data. */
|
---|
232 | bool fContentInfoLoaded;
|
---|
233 | /** Set if the ContentInfo member validated okay (says nothing about the
|
---|
234 | * signature or certificates within it). */
|
---|
235 | bool fContentInfoValid;
|
---|
236 | /** Set if the ContentInfo member is using the SignerCert too. */
|
---|
237 | bool fContentInfoSameCert;
|
---|
238 | /** Set if the ContentInfo member contains a valid signature (not saying
|
---|
239 | * anything about valid signing certificates). */
|
---|
240 | bool fContentInfoValidSignature;
|
---|
241 | /** @} */
|
---|
242 |
|
---|
243 | bool fExportISOImages;// when 1 the ISO images are exported
|
---|
244 |
|
---|
245 | RTCList<ImportOptions_T> optListImport;
|
---|
246 | RTCList<ExportOptions_T> optListExport;
|
---|
247 |
|
---|
248 | ovf::OVFReader *pReader;
|
---|
249 |
|
---|
250 | std::list< ComObjPtr<VirtualSystemDescription> >
|
---|
251 | virtualSystemDescriptions;
|
---|
252 |
|
---|
253 | std::list<Utf8Str> llWarnings;
|
---|
254 |
|
---|
255 | ULONG ulWeightForXmlOperation;
|
---|
256 | ULONG ulWeightForManifestOperation;
|
---|
257 | ULONG ulTotalDisksMB;
|
---|
258 | ULONG cDisks;
|
---|
259 |
|
---|
260 | std::list<Guid> llGuidsMachinesCreated;
|
---|
261 |
|
---|
262 | /** Sequence of password identifiers to encrypt disk images during export. */
|
---|
263 | std::vector<com::Utf8Str> m_vecPasswordIdentifiers;
|
---|
264 | /** Map to get all medium identifiers assoicated with a given password identifier. */
|
---|
265 | std::map<com::Utf8Str, GUIDVEC> m_mapPwIdToMediumIds;
|
---|
266 | /** Secret key store used to hold the passwords during export. */
|
---|
267 | SecretKeyStore *m_pSecretKeyStore;
|
---|
268 | /** Number of passwords provided. */
|
---|
269 | uint32_t m_cPwProvided;
|
---|
270 | };
|
---|
271 |
|
---|
272 | struct Appliance::XMLStack
|
---|
273 | {
|
---|
274 | std::map<Utf8Str, const VirtualSystemDescriptionEntry*> mapDisks;
|
---|
275 | std::list<Utf8Str> mapDiskSequence;
|
---|
276 | std::list<Utf8Str> mapDiskSequenceForOneVM;//temporary keeps all disks attached to one exported VM
|
---|
277 | std::map<Utf8Str, bool> mapNetworks;
|
---|
278 | };
|
---|
279 |
|
---|
280 | class Appliance::TaskOVF : public ThreadTask
|
---|
281 | {
|
---|
282 | public:
|
---|
283 | enum TaskType
|
---|
284 | {
|
---|
285 | Read,
|
---|
286 | Import,
|
---|
287 | Write
|
---|
288 | };
|
---|
289 |
|
---|
290 | TaskOVF(Appliance *aThat,
|
---|
291 | TaskType aType,
|
---|
292 | LocationInfo aLocInfo,
|
---|
293 | ComObjPtr<Progress> &aProgress)
|
---|
294 | : ThreadTask("TaskOVF"),
|
---|
295 | pAppliance(aThat),
|
---|
296 | taskType(aType),
|
---|
297 | locInfo(aLocInfo),
|
---|
298 | pProgress(aProgress),
|
---|
299 | enFormat(ovf::OVFVersion_unknown),
|
---|
300 | rc(S_OK)
|
---|
301 | {
|
---|
302 | switch (taskType)
|
---|
303 | {
|
---|
304 | case TaskOVF::Read: m_strTaskName = "ApplRead"; break;
|
---|
305 | case TaskOVF::Import: m_strTaskName = "ApplImp"; break;
|
---|
306 | case TaskOVF::Write: m_strTaskName = "ApplWrit"; break;
|
---|
307 | default: m_strTaskName = "ApplTask"; break;
|
---|
308 | }
|
---|
309 | }
|
---|
310 |
|
---|
311 | static DECLCALLBACK(int) updateProgress(unsigned uPercent, void *pvUser);
|
---|
312 |
|
---|
313 | Appliance *pAppliance;
|
---|
314 | TaskType taskType;
|
---|
315 | const LocationInfo locInfo;
|
---|
316 | ComObjPtr<Progress> pProgress;
|
---|
317 |
|
---|
318 | ovf::OVFVersion_T enFormat;
|
---|
319 |
|
---|
320 | HRESULT rc;
|
---|
321 |
|
---|
322 | void handler()
|
---|
323 | {
|
---|
324 | Appliance::i_importOrExportThreadTask(this);
|
---|
325 | }
|
---|
326 | };
|
---|
327 |
|
---|
328 | class Appliance::TaskOPC : public ThreadTask
|
---|
329 | {
|
---|
330 | public:
|
---|
331 | enum TaskType
|
---|
332 | {
|
---|
333 | Export
|
---|
334 | };
|
---|
335 |
|
---|
336 | TaskOPC(Appliance *aThat,
|
---|
337 | TaskType aType,
|
---|
338 | LocationInfo aLocInfo,
|
---|
339 | ComObjPtr<Progress> &aProgress)
|
---|
340 | : ThreadTask("TaskOPC"),
|
---|
341 | pAppliance(aThat),
|
---|
342 | taskType(aType),
|
---|
343 | locInfo(aLocInfo),
|
---|
344 | pProgress(aProgress),
|
---|
345 | rc(S_OK)
|
---|
346 | {
|
---|
347 | m_strTaskName = "OPCExpt";
|
---|
348 | }
|
---|
349 |
|
---|
350 | ~TaskOPC()
|
---|
351 | {
|
---|
352 | }
|
---|
353 |
|
---|
354 | static DECLCALLBACK(int) updateProgress(unsigned uPercent, void *pvUser);
|
---|
355 |
|
---|
356 | Appliance *pAppliance;
|
---|
357 | TaskType taskType;
|
---|
358 | const LocationInfo locInfo;
|
---|
359 | ComObjPtr<Progress> pProgress;
|
---|
360 |
|
---|
361 | HRESULT rc;
|
---|
362 |
|
---|
363 | void handler()
|
---|
364 | {
|
---|
365 | Appliance::i_exportOPCThreadTask(this);
|
---|
366 | }
|
---|
367 | };
|
---|
368 |
|
---|
369 |
|
---|
370 | class Appliance::TaskCloud : public ThreadTask
|
---|
371 | {
|
---|
372 | public:
|
---|
373 | enum TaskType
|
---|
374 | {
|
---|
375 | Export,
|
---|
376 | Import,
|
---|
377 | ReadData
|
---|
378 | };
|
---|
379 |
|
---|
380 | TaskCloud(Appliance *aThat,
|
---|
381 | TaskType aType,
|
---|
382 | LocationInfo aLocInfo,
|
---|
383 | ComObjPtr<Progress> &aProgress)
|
---|
384 | : ThreadTask("TaskCloud"),
|
---|
385 | pAppliance(aThat),
|
---|
386 | taskType(aType),
|
---|
387 | locInfo(aLocInfo),
|
---|
388 | pProgress(aProgress),
|
---|
389 | rc(S_OK)
|
---|
390 | {
|
---|
391 | switch (taskType)
|
---|
392 | {
|
---|
393 | case TaskCloud::Export: m_strTaskName = "CloudExpt"; break;
|
---|
394 | case TaskCloud::Import: m_strTaskName = "CloudImpt"; break;
|
---|
395 | case TaskCloud::ReadData: m_strTaskName = "CloudRead"; break;
|
---|
396 | default: m_strTaskName = "CloudTask"; break;
|
---|
397 | }
|
---|
398 | }
|
---|
399 |
|
---|
400 | ~TaskCloud()
|
---|
401 | {
|
---|
402 | }
|
---|
403 |
|
---|
404 | static DECLCALLBACK(int) updateProgress(unsigned uPercent, void *pvUser);
|
---|
405 |
|
---|
406 | Appliance *pAppliance;
|
---|
407 | TaskType taskType;
|
---|
408 | const LocationInfo locInfo;
|
---|
409 | ComObjPtr<Progress> pProgress;
|
---|
410 |
|
---|
411 | HRESULT rc;
|
---|
412 |
|
---|
413 | void handler()
|
---|
414 | {
|
---|
415 | Appliance::i_importOrExportCloudThreadTask(this);
|
---|
416 | }
|
---|
417 | };
|
---|
418 |
|
---|
419 | struct MyHardDiskAttachment
|
---|
420 | {
|
---|
421 | ComPtr<IMachine> pMachine;
|
---|
422 | Utf8Str controllerName;
|
---|
423 | int32_t lControllerPort; // 0-29 for SATA
|
---|
424 | int32_t lDevice; // IDE: 0 or 1, otherwise 0 always
|
---|
425 | };
|
---|
426 |
|
---|
427 | /**
|
---|
428 | * Used by Appliance::importMachineGeneric() to store
|
---|
429 | * input parameters and rollback information.
|
---|
430 | */
|
---|
431 | struct Appliance::ImportStack
|
---|
432 | {
|
---|
433 | // input pointers
|
---|
434 | const LocationInfo &locInfo; // ptr to location info from Appliance::importFS()
|
---|
435 | Utf8Str strSourceDir; // directory where source files reside
|
---|
436 | const ovf::DiskImagesMap &mapDisks; // ptr to disks map in OVF
|
---|
437 | ComObjPtr<Progress> &pProgress; // progress object passed into Appliance::importFS()
|
---|
438 |
|
---|
439 | // input parameters from VirtualSystemDescriptions
|
---|
440 | Utf8Str strNameVBox; // VM name
|
---|
441 | Utf8Str strSettingsFilename; // Absolute path to VM config file
|
---|
442 | Utf8Str strMachineFolder; // Absolute path to VM folder (derived from strSettingsFilename)
|
---|
443 | Utf8Str strOsTypeVBox; // VirtualBox guest OS type as string
|
---|
444 | Utf8Str strPrimaryGroup; // VM primary group as string
|
---|
445 | Utf8Str strDescription;
|
---|
446 | uint32_t cCPUs; // CPU count
|
---|
447 | bool fForceHWVirt; // if true, we force enabling hardware virtualization
|
---|
448 | bool fForceIOAPIC; // if true, we force enabling the IOAPIC
|
---|
449 | uint32_t ulMemorySizeMB; // virtual machine RAM in megabytes
|
---|
450 | Utf8Str strFirmwareType; //Firmware - BIOS or EFI
|
---|
451 | #ifdef VBOX_WITH_USB
|
---|
452 | bool fUSBEnabled;
|
---|
453 | #endif
|
---|
454 | Utf8Str strAudioAdapter; // if not empty, then the guest has audio enabled, and this is the decimal
|
---|
455 | // representation of the audio adapter (should always be "0" for AC97 presently)
|
---|
456 |
|
---|
457 | // session (not initially created)
|
---|
458 | ComPtr<ISession> pSession; // session opened in Appliance::importFS() for machine manipulation
|
---|
459 | bool fSessionOpen; // true if the pSession is currently open and needs closing
|
---|
460 |
|
---|
461 | /** @name File access related stuff (TAR stream)
|
---|
462 | * @{ */
|
---|
463 | /** OVA file system stream handle. NIL if not OVA. */
|
---|
464 | RTVFSFSSTREAM hVfsFssOva;
|
---|
465 | /** OVA lookahead I/O stream object. */
|
---|
466 | RTVFSIOSTREAM hVfsIosOvaLookAhead;
|
---|
467 | /** OVA lookahead I/O stream object name. */
|
---|
468 | char *pszOvaLookAheadName;
|
---|
469 | /** @} */
|
---|
470 |
|
---|
471 | // a list of images that we created/imported; this is initially empty
|
---|
472 | // and will be cleaned up on errors
|
---|
473 | std::list<MyHardDiskAttachment> llHardDiskAttachments; // disks that were attached
|
---|
474 | std::map<Utf8Str , Utf8Str> mapNewUUIDsToOriginalUUIDs;
|
---|
475 |
|
---|
476 | ImportStack(const LocationInfo &aLocInfo,
|
---|
477 | const ovf::DiskImagesMap &aMapDisks,
|
---|
478 | ComObjPtr<Progress> &aProgress,
|
---|
479 | RTVFSFSSTREAM aVfsFssOva)
|
---|
480 | : locInfo(aLocInfo),
|
---|
481 | mapDisks(aMapDisks),
|
---|
482 | pProgress(aProgress),
|
---|
483 | cCPUs(1),
|
---|
484 | fForceHWVirt(false),
|
---|
485 | fForceIOAPIC(false),
|
---|
486 | ulMemorySizeMB(0),
|
---|
487 | fSessionOpen(false),
|
---|
488 | hVfsFssOva(aVfsFssOva),
|
---|
489 | hVfsIosOvaLookAhead(NIL_RTVFSIOSTREAM),
|
---|
490 | pszOvaLookAheadName(NULL)
|
---|
491 | {
|
---|
492 | if (hVfsFssOva != NIL_RTVFSFSSTREAM)
|
---|
493 | RTVfsFsStrmRetain(hVfsFssOva);
|
---|
494 |
|
---|
495 | // disk images have to be on the same place as the OVF file. So
|
---|
496 | // strip the filename out of the full file path
|
---|
497 | strSourceDir = aLocInfo.strPath;
|
---|
498 | strSourceDir.stripFilename();
|
---|
499 | }
|
---|
500 |
|
---|
501 | ~ImportStack()
|
---|
502 | {
|
---|
503 | if (hVfsFssOva != NIL_RTVFSFSSTREAM)
|
---|
504 | {
|
---|
505 | RTVfsFsStrmRelease(hVfsFssOva);
|
---|
506 | hVfsFssOva = NIL_RTVFSFSSTREAM;
|
---|
507 | }
|
---|
508 | if (hVfsIosOvaLookAhead != NIL_RTVFSIOSTREAM)
|
---|
509 | {
|
---|
510 | RTVfsIoStrmRelease(hVfsIosOvaLookAhead);
|
---|
511 | hVfsIosOvaLookAhead = NIL_RTVFSIOSTREAM;
|
---|
512 | }
|
---|
513 | if (pszOvaLookAheadName)
|
---|
514 | {
|
---|
515 | RTStrFree(pszOvaLookAheadName);
|
---|
516 | pszOvaLookAheadName = NULL;
|
---|
517 | }
|
---|
518 | }
|
---|
519 |
|
---|
520 | HRESULT restoreOriginalUUIDOfAttachedDevice(settings::MachineConfigFile *config);
|
---|
521 | HRESULT saveOriginalUUIDOfAttachedDevice(settings::AttachedDevice &device,
|
---|
522 | const Utf8Str &newlyUuid);
|
---|
523 | RTVFSIOSTREAM claimOvaLookAHead(void);
|
---|
524 |
|
---|
525 | };
|
---|
526 |
|
---|
527 | ////////////////////////////////////////////////////////////////////////////////
|
---|
528 | //
|
---|
529 | // VirtualSystemDescription data definition
|
---|
530 | //
|
---|
531 | ////////////////////////////////////////////////////////////////////////////////
|
---|
532 |
|
---|
533 | struct VirtualSystemDescription::Data
|
---|
534 | {
|
---|
535 | std::vector<VirtualSystemDescriptionEntry>
|
---|
536 | maDescriptions; // item descriptions
|
---|
537 |
|
---|
538 | ComPtr<Machine> pMachine; // VirtualBox machine this description was exported from (export only)
|
---|
539 |
|
---|
540 | settings::MachineConfigFile
|
---|
541 | *pConfig; // machine config created from <vbox:Machine> element if found (import only)
|
---|
542 | };
|
---|
543 |
|
---|
544 | ////////////////////////////////////////////////////////////////////////////////
|
---|
545 | //
|
---|
546 | // Internal helpers
|
---|
547 | //
|
---|
548 | ////////////////////////////////////////////////////////////////////////////////
|
---|
549 |
|
---|
550 | void convertCIMOSType2VBoxOSType(Utf8Str &strType, ovf::CIMOSType_T c, const Utf8Str &cStr);
|
---|
551 |
|
---|
552 | ovf::CIMOSType_T convertVBoxOSType2CIMOSType(const char *pcszVBox, BOOL fLongMode);
|
---|
553 |
|
---|
554 | Utf8Str convertNetworkAttachmentTypeToString(NetworkAttachmentType_T type);
|
---|
555 |
|
---|
556 |
|
---|
557 | #endif /* !MAIN_INCLUDED_ApplianceImplPrivate_h */
|
---|
558 |
|
---|