-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
On Wed, Nov 25, 2015 at 02:04:40PM +0100, Bahtiar Gadimov wrote:
> Hi,
>
> while working on an lvm storage implementation for the current
> qubes-core-admin I noticed that some of the logic used by XenStorage
> and XenPool is general enough to be reused. I started moving code from
> XenStorage & XenPool to QubesVmStorage & Pool. I prepared a branch
> (
https://github.com/QubesOS/qubes-core-admin/compare/master...kalkin:storage?expand=1),
> but there is one issue stopping me from opening a PR.
>
> One of the changes is moving the vmdir logic from `XenPool` to the
> general `Pool` class. Any storage implementation needs this logic for
> saving the vm config and not storage related data. Part of this logic
> is looking at the the `vm_type` (i.e: `QubesAppVm`, `QubesTemplateVm`,
> ..) and then deciding in which dir the vm data should be (i.e:
> 'appvms/, 'vm-templates/').
Maybe the better option would be to use vm.is_template() instead of
checking direct VM class? This would for example remove need for
specifically list both TemplateVm and TemplateHVm. And maybe some future
classes...
The same for types:
vm.is_netvm()
vm.is_disposablevm()
> When importing all the needed vm classes at the top of the file i get
> the an error like 'cannot import name QubesAppVm'. I had to import
> inside the `Pool.vmdir_path()` method instead of on the top of file
> (See
https://github.com/QubesOS/qubes-core-admin/compare/master...kalkin:storage?expand=1#diff-1887b5d6907fa270c4a5ebf5507a6ee1R386).
>
> I am not sure i fully understand the whole module magic which
> qubes-core-admin does. My suspicion is that the a vm class needs to
> call `register_qubes_vm_class()` to register the class inside the
> module. For this `QubesVm` has to import the `qubes.storage` module
> and this needs to import all the vm classes for the
> `Pool.vmdir_path()` method -> Circular dependency. Am I right?
Yes.
Generally I think storage classes shouldn't depend on explicit VM
classes. I we'd like to add some other class in the future that would
mean (in current implementation) need to modify also storage pool for
that...
- --
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQEcBAEBCAAGBQJWVb2jAAoJENuP0xzK19cspD0H/2FFUBKdWCzwXXQsRz13P+uG
VJ9smk6kN/PW78b3zt7zDbDoXUz7Z17nM24eGahz6Jp/pHjV0WF0/Lrl3TdkBMxU
2lZC1vJ3gGTAiSFl4m28haEzRoI1FnhfY+j/ZIUKnLJYg/wXt5FYAewIbbCoIswb
t9IJ0oCkWBwyal9ZwYgEFIFKY+ezwcIt+YZBLKM1E9Vg6zAwNgjqVCuZdl/BCnlB
WU3Sw5msUdV0Hp6rVsqPjuVLqlIwVorx8ix4tuODCILAy85TEibMIdh60t6dq/lP
LvWT9HV4FmZMVbofRmxMHpwhmS1XmC58nTuhJZe4aFSz+N6KVp8Hvzs+zpBRiKY=
=Duvi
-----END PGP SIGNATURE-----