Commit Graph

6 Commits

Author SHA1 Message Date
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
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
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
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