Commit Graph

14 Commits

Author SHA1 Message Date
Dmitry Guryanov
944705e28f parallels: split parallelsStorageVolumeDelete function
Move part, which deletes existing volume, to a new function
parallelsStorageVolumeDefRemove so that we can use it later
in parallels_driver.c

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
2012-12-11 16:26:31 +08:00
Dmitry Guryanov
a9bd9b94e1 parallels: fill volumes capacity parameter
Read disk images size from xml description and fill
virStorageVolDef.capacity and allocation (let's consider
that allocation is the same as capacity, calculating real
allcoation will be implemented later).

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
2012-12-11 16:26:31 +08:00
Dmitry Guryanov
9b4c03ae5d parallels: add info about volumes
Disk images in Parallels Cloud Server stored in directories. Each
one has files with data and xml description of an image stored in
file DiskDescriptior.xml.

Since we have to support 'detached' images, which are not used by
any VM, the better way to collect info about volumes is searching for
directories with a file DiskDescriptior.xml in each VM directory.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
2012-12-11 16:26:31 +08:00
Dmitry Guryanov
7abe342d96 parallels: fix leaks in parallelsFindVolumes
We always have to close opened dir and free 'path'.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
2012-12-11 16:26:31 +08:00
Dmitry Guryanov
766e0c91d7 parallels: create storage pools by VM list
There are no storage pools in Parallels Cloud Server -
All VM data stored in a single directory: config, snapshots,
memory dump together with disk images.

Let's look through list of VMs and create a storage pool for
each directory, containing VMs.

So if you have 3 vms: /var/parallels/vm-1.pvm,
/var/parallels/vm-2.pvm and /root/test.pvm - 2 storage pools
appear: -var-parallels and -root. xml descriptions of the pools
will be saved in /etc/libvirt/parallels-storage, so UUIDs will
not change netween connections to libvirt.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
2012-12-11 16:26:31 +08:00
Dmitry Guryanov
4dc52e1e2f parallels: remove unused code from storage driver
We don't support unprivileged users anymore, so remove code, which
selects configuration directory depending on user.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
2012-12-11 16:26:31 +08:00
Dmitry Guryanov
21e1bdeb3d parallels: split parallelsStorageOpen function
Move code for loading inforation about pools to a separate
function - parallelsLoadPools.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
2012-12-11 16:26:31 +08:00
Daniel P. Berrange
f4ea67f5b3 Turn some dual-state int parameters into booleans
The virStateInitialize method and several cgroups methods were
using an 'int privileged' parameter or similar for dual-state
values. These are better represented with the bool type.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-11-29 16:14:43 +00:00
Ata E Husain Bohra
2b121dbc10 Add private data pointer to virStoragePool and virStorageVol
This will simplify the refactoring of the ESX storage driver to support
a VMFS and an iSCSI backend.

One of the tasks the storage driver needs to do is to decide which backend
driver needs to be invoked for a given request. This approach extends
virStoragePool and virStorageVol to store extra parameters:

1. privateData: stores pointer to respective backend storage driver.
2. privateDataFreeFunc: stores cleanup function pointer.

virGetStoragePool and virGetStorageVol are modfied to accept these extra
parameters as user params. virStoragePoolDispose and virStorageVolDispose
checks for cleanup operation if available.

The private data pointer allows the ESX storage driver to store a pointer
to the used backend with each storage pool and volume. This avoids the need
to detect the correct backend in each storage driver function call.
2012-11-26 14:39:39 +01:00
Ján Tomko
0b121614a2 xml: print uuids in the warning
In the XML warning, we print a virsh command line that can be used to
edit that XML. This patch prints UUIDs if the entity name contains
special characters (like shell metacharacters, or "--" that would break
parsing of the XML comment). If the entity doesn't have a UUID, just
print the virsh command that can be used to edit it.
2012-10-29 14:38:43 +01:00
Laine Stump
73ebd86d73 parallels: fix build for some older compilers
Found this when building on RHEL5:

parallels/parallels_storage.c: In function 'parallelsStorageOpen':
parallels/parallels_storage.c:180: error: 'for' loop initial declaration used outside C99 mode

(and similar error in parallels_driver.c). This was in spite of
configuring with "-Wno-error".
2012-10-26 13:23:56 -04:00
Eric Blake
4ecb723b9e maint: fix up copyright notice inconsistencies
https://www.gnu.org/licenses/gpl-howto.html recommends that
the 'If not, see <url>.' phrase be a separate sentence.

* tests/securityselinuxhelper.c: Remove doubled line.
* tests/securityselinuxtest.c: Likewise.
* globally: s/;  If/.  If/
2012-09-20 16:30:55 -06:00
Dmitry Guryanov
7024ddfc09 parallels: implement VM creation
To create a new VM in Parallels Clud Server we should issue
"prlctl create" command, and give path to the directory,
where VM should be created. VM's storage will be in that
directory later. So in this first version find out location
of first VM's hard disk and create VM there.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
2012-08-01 11:49:10 +08:00
Dmitry Guryanov
aa296e6c29 parallels: add storage driver
Parallels Cloud Server has one serious discrepancy with libvirt:
libvirt stores domain configuration files in one place, and storage
files in other places (with the API of storage pools and storage volumes).
Parallels Cloud Server stores all domain data in a single directory,
for example, you may have domain with name fedora-15, which will be
located in '/var/parallels/fedora-15.pvm', and it's hard disk image will be
in '/var/parallels/fedora-15.pvm/harddisk1.hdd'.

I've decided to create storage driver, which produces pseudo-volumes
(xml files with volume description), and they will be 'converted' to
real disk images after attaching to a VM.

So if someone creates VM with one hard disk using virt-manager,
at first virt-manager creates a new volume, and then defines a
domain. We can lookup a volume by path in XML domain definition
and find out location of new domain and size of its hard disk.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
2012-08-01 11:48:01 +08:00