1. 19 7月, 2016 4 次提交
    • N
      vz: cleanup loading domain code · cfc68155
      Nikolay Shirokovskiy 提交于
        9c14a9ab introduced vzNewDomain function to enlist libvirt domain
      object before actually creating vz sdk domain. Fix should fix
      race on same vz sdk domain added event where libvirt domain object is
      enlisted too. But later eb5e9c1e added locked checks for
      adding livirtd domain object to list on vz sdk domain added event.
      Thus now approach of 9c14a9ab is unnecessary complicated.
      
        See we have otherwise unuseful prlsdkGetDomainIds function only
      to create minimal domain definition to create libvirt domain object.
      Also vzNewDomain is difficult to use as it creates partially
      constructed domain object.
      
        Let's move back to original approach where prlsdkLoadDomain do
      all the necessary job. Another benefit is that we can now
      take driver lock for bare minimum and in single place. Reducing
      locking time have small disadvatage of double parsing on race
      conditions which is typical if domain is added thru vz driver.
      Well we have this double parse inevitably with current vz sdk api
      on any domain updates so i would not take it here seriously.
      
        Performance events subscribtion is done before locked check and
      therefore could be done twice on races but this is not the problem.
      Signed-off-by: NNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
      cfc68155
    • N
    • O
      vz: support filesystem type volume · 3dd50be7
      Olga Krishtal 提交于
      Vz containers are able to use ploop volumes from storage pools
      to work upon.
      
      To use filesystem type volume, pool name and volume name should be
      specifaed in <source> :
         <filesystem type='volume' accessmode='passthrough'>
            <driver type='ploop' format='ploop'/>
            <source pool='guest_images' volume='TEST_POOL_CT'/>
            <target dir='/'/>
         </filesystem>
      
      The information about pool and volume is stored in ct dom configuration:
      <StorageURL>libvirt://localhost/pool_name/vol_name</StorageURL>
      and can be easily obtained via PrlVmDevHd_GetStorageURL sdk call.
      
      The only shorcoming: if storage pool is moved somewhere the ct
      should be redefined in order to refresh the information aboot path
      to root.hdd
      Signed-off-by: NOlga Krishtal <okrishtal@virtuozzo.com>
      3dd50be7
    • N
      vz: fix destination domain synchronization · eb2fe4eb
      Nikolay Shirokovskiy 提交于
      Adding domain to domain list on preparation step is not correct.
      First domain is not fully constructed - domain definition is
      missing. Second we can't use VIR_MIGRATE_PARAM_DEST_XML parameter
      to parse definition as vz sdk can patch it by itself. Let's add/remove
      domain on finish step. This is for synchronization purpose only so domain
      is present/absent on destination after migration completion. Actually
      domain object will probably be created right after actual vz sdk
      migration start by vz sdk domain defined event.
      
      We can not and should not sync domain cache on error path in finish step
      of migration. We can not as we really don't know what is the reason of
      cancelling and we should not as user should not make assumptions on
      state on error path. What we should do is cleaning up temporary migration
      state that is induced on prepare step but we don't have one. Thus
      cancellation should be noop.
      Signed-off-by: NNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
      Signed-off-by: NMaxim Nestratov <mnestratov@virtuozzo.com>
      eb2fe4eb
  2. 26 6月, 2016 2 次提交
  3. 11 6月, 2016 2 次提交
  4. 19 5月, 2016 1 次提交
  5. 18 5月, 2016 1 次提交
  6. 13 4月, 2016 1 次提交
    • M
      vz: introduce new vzDriver lockable structure and use it · 7762c5a2
      Maxim Nestratov 提交于
      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: NMaxim Nestratov <mnestratov@virtuozzo.com>
      7762c5a2
  7. 12 4月, 2016 1 次提交
  8. 17 3月, 2016 2 次提交
    • M
      vz: code refactoring · ad29dbb3
      Mikhail Feoktistov 提交于
      In prlsdkAddNet() Attach/DetachNet() functions
      privconn should be the first argument
      ad29dbb3
    • M
      vz: set default SCSI model · bb2f63da
      Mikhail Feoktistov 提交于
      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.
      bb2f63da
  9. 12 2月, 2016 1 次提交
    • M
      vz: fix race condition when adding domain to domains list · 9c14a9ab
      Mikhail Feoktistov 提交于
      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().
      9c14a9ab
  10. 24 12月, 2015 1 次提交
  11. 19 11月, 2015 1 次提交
  12. 26 6月, 2015 3 次提交
    • N
      vz: add memory statistics · bb7d275d
      Nikolay Shirokovskiy 提交于
      Implemented counters:
       VIR_DOMAIN_MEMORY_STAT_SWAP_IN
       VIR_DOMAIN_MEMORY_STAT_SWAP_OUT
       VIR_DOMAIN_MEMORY_STAT_MINOR_FAULT
       VIR_DOMAIN_MEMORY_STAT_MAJOR_FAULT
       VIR_DOMAIN_MEMORY_STAT_AVAILABLE
       VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON
       VIR_DOMAIN_MEMORY_STAT_UNUSED
      
      Comments.
      
      1. Use vzDomObjFromDomainRef/virDomainObjEndAPI pair to get domain
      object as we use prlsdkGetStatsParam. See previous statistics
      comments.
      
      2. Balloon statistics is not applicable to containers. Fault
      statistics for containers not provided in PCS6 yet.
      Signed-off-by: NNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
      bb7d275d
    • N
      vz: add vcpu statistics · b2f73ee2
      Nikolay Shirokovskiy 提交于
      Comments.
      
      Replace vzDomObjFromDomain/virObjectUnlock pair
      to vzDomObjFromDomainRef/virDomainObjEndAPI as we
      use prlsdkGetStatsParam. See previous statistics
      comments.
      Signed-off-by: NNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
      b2f73ee2
    • N
      vz: add net dev statistiscs · b249069d
      Nikolay Shirokovskiy 提交于
      Populate counters SDK currenly supports:
       rx_bytes
       rx_packets
       tx_bytes
       tx_packets
      
      Comments.
      
      Use vzDomObjFromDomainRef/virDomainObjEndAPI pair to get domain
      object as we use prlsdkGetStatsParam that can release domain
      object lock and thus we need a reference in case domain
      is deleated meanwhile.
      Signed-off-by: NNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
      b249069d
  13. 25 6月, 2015 1 次提交
  14. 24 6月, 2015 1 次提交
    • M
      vz: implementation of attach/detach network devices · 6de12b02
      Mikhail Feoktistov 提交于
      In this patch we add VIR_DOMAIN_DEVICE_NET handlers implementation
      for domainAttachDevice and domainDetachDevice callbacks.
      
      As soon as we don't support this operation for hypervisor type domains,
      we implement this functionality for containers only.
      
      In detach procedure we find network device by MAC address.
      Because PrlVmDevNet_GetMacAddress() returns MAC as a UTF-8 encoded
      null-terminated string, we use memcmp() to compare it.
      Also we remove corresponding virtual network by prlsdkDelNetAdapter call.
      6de12b02
  15. 17 6月, 2015 2 次提交
  16. 09 6月, 2015 1 次提交
    • N
      parallels: add block device statistics to driver · 489c81c0
      Nikolay Shirokovskiy 提交于
      Statistics provided through PCS SDK. As we have only async interface in SDK we
      need to be subscribed to statistics in order to get it. Trivial solution on
      every stat request to subscribe, wait event and then unsubscribe will lead to
      significant delays in case of a number of successive requests, as the event
      will be delivered on next PCS server notify cycle. On the other hand we don't
      want to keep unnesessary subscribtion. So we take an hibrid solution to
      subcsribe on first request and then keep a subscription while requests are
      active. We populate cache of statistics on subscribtion events and use this
      cache to serve libvirts requests.
      
       * Cache details.
      Cache is just handle to last arrived event, we call this cache
      as if this handle is valid it is used to serve synchronous
      statistics requests. We use number of successive events count
      to detect that user lost interest to statistics. We reset this
      count to 0 on every request. If more than PARALLELS_STATISTICS_DROP_COUNT
      successive events arrive we unsubscribe. Special value of -1
      of this counter is used to differentiate between subscribed/unsubscribed state
      to protect from delayed events.
      
      Values of PARALLELS_STATISTICS_DROP_COUNT and PARALLELS_STATISTICS_TIMEOUT are
      just drop-ins, choosen without special consideration.
      
       * Thread safety issues
      Use parallelsDomObjFromDomainRef in parallelsDomainBlockStats as
      we could wait on domain lock down on stack in prlsdkGetStatsParam
      and if we won't keep reference we could get dangling pointer
      on return from wait.
      Signed-off-by: NNikolay Shirokovskiy <nshirokovskiy@parallels.com>
      489c81c0
  17. 13 5月, 2015 1 次提交
    • N
      parallels: remove connection wide wait timeout · 2f1f2888
      Nikolay Shirokovskiy 提交于
      We have a lot of passing arguments code just to pass connection
      object cause it holds jobTimeout. Taking into account that
      right now this value is defined at compile time let's just
      get rid of it and make arguments list more clear in many
      places.
      
      In case we later need some runtime configurable timeout
      value we can provide this value through arguments
      function already operate such as a parallels domain
      object etc as this timeouts are operation( and thus
      object) specific in practice.
      Signed-off-by: NNikolay Shirokovskiy <nshirokovskiy@parallels.com>
      2f1f2888
  18. 29 4月, 2015 1 次提交
  19. 13 4月, 2015 1 次提交
  20. 10 4月, 2015 3 次提交
  21. 10 12月, 2014 8 次提交
  22. 25 9月, 2014 1 次提交
    • D
      parallels: login to parallels SDK · e7bb373f
      Dmitry Guryanov 提交于
      Add files parallels_sdk.c and parallels_sdk.h for code
      which works with SDK, so libvirt's code will not mix with
      dealing with parallels SDK.
      
      To use Parallels SDK you must first call PrlApi_InitEx function,
      and then you will be able to connect to a server with
      PrlSrv_LoginLocalEx function. When you've done you must call
      PrlApi_Deinit. So let's call PrlApi_InitEx on first .connectOpen,
      count number of connections and deinitialize, when this counter
      becomes zero.
      Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
      e7bb373f