Commit Graph

22 Commits

Author SHA1 Message Date
Nikolay Shirokovskiy
2d3940907d vz: cleanup: define vz format of uuids
vz puts uuids into curly braces. Simply introduce new contstant to reflect this
and get rid of magic +2 in code.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-05-19 14:57:13 +03:00
Nikolay Shirokovskiy
17c37031e5 vz: fix const correctness case
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-05-19 14:56:00 +03:00
Nikolay Shirokovskiy
34075acf21 vz: save session uuid on login
This session uuid acts as authN token for different multihost vz operations one
of which is migration. Unfortunately we can't get it from server at any time
thus we need to save it at login.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-05-19 14:56:00 +03:00
Nikolay Shirokovskiy
abc85b2cab vz: add domain snapshots functionality
This solution does not keep snapshots cache because vz sdk lacks good support
for snapshot related events.

Libvirt and vz sdk has different approach to snapshot ids. vz sdk always
auto generate them while libvirt has ability to specify id by user.
Thus I have no other choice rather than simply ignore ids set by user
or generated by libvirt.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-05-18 18:14:58 +03:00
Maxim Nestratov
52616fc5db vz: remove vzDriverLock/Unlock function
We don't need them anymore as all pointers within vzDriver structure
are not changed during the time it exists.
Where we still need to synchronize we use virObjectLock/Unlock as far
as vzDriver is lockable object.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-04-13 18:48:44 +03:00
Maxim Nestratov
6202b72387 vz: implement connectGetSysinfo hypervisor callback
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-04-13 18:48:44 +03:00
Maxim Nestratov
7762c5a233 vz: introduce new vzDriver lockable structure and use it
This patch introduces a new 'vzDriver' lockable object and provides
helper functions to allocate/destroy it and we pass it to prlsdkXxx
functions instead of virConnectPtr.
Now we store domain related objects such as domain list, capabitilies
etc. within a single vz_driver vzDriver structure, which is shared by
all driver connections. It is allocated during daemon initialization or
in a lazy manner when a new connection to 'vz' driver is established.
When a connection to vz daemon drops, vzDestroyConnection is called,
which in turn relays disconnect event to all connection to 'vz' driver.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-04-13 18:48:43 +03:00
Maxim Nestratov
f376069fa5 vz: remove drivername field from vzConn structure
No need to remember connection name and have corresponding
domain type to keep backward compatibility with former
'parallels' driver. It is enough to be able to accept 'parallels'
uri and domain types.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-04-12 21:05:05 +03:00
Mikhail Feoktistov
bb2f63da79 vz: set default SCSI model
Each version of virtuozzo supports only one type of SCSI controller
So if we add disk on SCSI bus, we should set SCSI controller model.
We can take it from vzCapabilities structure.
2016-03-16 19:34:27 +03:00
Mikhail Feoktistov
97841dd9e6 vz: check supported controllers
Because Vz6 supports SCSI(BUSLOGIC), IDE and SATA controllers only and
Vz7 supports SCSI(VIRTIO_SCSI) and IDE only we add list of supported
controllers and scsi models to vzCapabilities structure.
When a new  connection opens, we select proper capabilities values according
to Virtuozzo version and check them in XMLPostParse.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-03-16 19:34:27 +03:00
Mikhail Feoktistov
adbe76fb42 vz: check supported disk format and bus
Now we check disk parameters correctness in DomainPostParse.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-03-16 19:34:27 +03:00
Mikhail Feoktistov
19d979edff vz: add vzCapabilities to connection structure
As far as Virtuozzo6 and Virtuozzo7 support different disk types for virtual
machines (ploop and qcow2 respectively) and different buses (vz6: IDE, SCSI,
SATA; vz7: IDE SCSI) we add vzCapabilities structure to help undestand which
disk formats and buses are supported in the context of a current connection.

When a new connection opens, we select proper capabilities in accordance to
current Virtuozzo version.
2016-03-16 19:34:26 +03:00
Mikhail Feoktistov
d10b02b5e5 vz: save vz version in connection structure
Move code from connectGetVersion callback to vzInitVersion function
2016-03-16 19:34:26 +03:00
Nikolay Shirokovskiy
4b4fbfe406 vz: implement connection close notification
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-03-01 14:18:16 +00:00
Mikhail Feoktistov
9c14a9ab42 vz: fix race condition when adding domain to domains list
Race condition:
User calls defineXML to create new instance.
The main thread from vzDomainDefineXMLFlags() creates new instance by prlsdkCreateVm.
Then this thread calls prlsdkAddDomain to add new domain to domains list.
The second thread receives notification from hypervisor that new VM was created.
It calls prlsdkHandleVmAddedEvent() and also tries to add new domain to domains list.
These two threads call virDomainObjListFindByUUID() from prlsdkAddDomain() and don't find new domain.
So they add two domains with the same uuid to domains list.

This fix splits logic of prlsdkAddDomain() into two functions.
1. vzNewDomain() creates new empty domain in domains list with the specific uuid.
2. prlsdkLoadDomain() add data from VM to domain object.

New algorithm for creating an instance:
In vzDomainDefineXMLFlags() we add new domain to domain list by calling vzNewDomain()
and only after that we call CreateVm() to create VM.
It means that we "reserve" domain object with the specific uuid.
After creation of new VM we add info from this VM
to reserved domain object by calling prlsdkLoadDomain().

Before this patch prlsdkLoadDomain() worked in 2 different cases:
1. It creates and initializes new domain. Then updates it from sdk handle.
2. It updates existed domain from sdk handle.
In this patch we remove code which creates new domain from LoadDomain()
and move it to vzNewDomain().
Now prlsdkLoadDomain() only updates domain from skd handle.

In notification handler prlsdkHandleVmAddedEvent() we check
the existence of a domain and if it doesn't exist we add new domain by calling
vzNewDomain() and load info from sdk handle via prlsdkLoadDomain().
2016-02-12 13:32:03 +03:00
Mikhail Feoktistov
a7b2257e9a vz: remove unused struct field
In commit 7039bb3c we have removed code that saves uuid to vzDomObj.uuid
So this field is no longer needed.
2016-02-12 13:31:58 +03:00
Michal Privoznik
90f3c0d717 conf: Split virDomainObjList into a separate file
Our domain_conf.* files are big enough. Not only they contain XML
parsing code, but they served as a storage of all functions whose
name is virDomain prefixed. This is just wrong as it gathers not
related functions (and modules) into one big file which is then
harder to maintain. Split virDomainObjList module into a separate
file called virdomainobjlist.[ch].

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-11-30 13:55:10 +01:00
Maxim Nestratov
04a39574a8 vz: cleanup
Remove unused definitions, functions and structure fields.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2015-10-08 16:44:48 +03:00
Maxim Nestratov
bd6ae7b8ab vz: remove storage driver as never used
In fact, it was never used as far as vz has no features supporting it.
That is why there will be no harm to anyone if we just remove this code to
prevent further misunderstanding and efforts to support dead code.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2015-10-06 18:22:47 +03:00
Maxim Nestratov
439f29e78c vz: remove network driver as never used
At the time this code was added we had intentions to support libvirt interface
to manage vz networks. In fact, it was never implemented completely to work
correctly that makes me think that there will be no harm to anyone if we just
rip it off. Moreover, in vz7 we started to use libvirt bridge network driver to
manage networks.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2015-10-06 18:22:47 +03:00
Michal Privoznik
c3c16e694c vz_utils: Reformat
Honour our formatting style. Adjust indentation so it matches the
rest of our code.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-06-26 09:28:28 +02:00
Maxim Nestratov
e6d180f07f parallels: rename all parallels files and driver directory to vz
This patch moves all src/parallels/parallels* files to vz/vz*
and fixes build accordingly.
No functional changes.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-06-17 15:07:55 +03:00