Wednesday, August 2, 2017

Cloudstack primary and secondary storage internals



Systemvm template:
primary storage is mounted in the host (xenserver)
Secondary storage is mounted in the ssvm
Systemvm template id is : 1
User vm template id is : 13

template_store_ref: It will trigger and track the template download job into the secondary storage. By default systemvm template is there on the secondary storage. No job is needed. For the user vm template requires a job to download from the URL to the secondary storage.

template_spool_ref: It will have the downloaded template paths in primary storage. Also xenserver vdi path.

storage_pool: It contains the primary storages added in the cloudstack.

CopyCommand: It will copy the template from the secondary storage to primary storage.

mysql> select * from template_spool_ref\G;
*************************** 1. row ***************************
            id: 1
       pool_id: 2
   template_id: 1
       created: 2017-07-07 09:32:04
  last_updated: NULL
        job_id: NULL
  download_pct: 100
download_state: DOWNLOADED
     error_str: NULL
    local_path: 90652ba0-ae70-4934-ad29-d669571c866e
  install_path: 90652ba0-ae70-4934-ad29-d669571c866e
 template_size: 3362005504
 marked_for_gc: 0
         state: Ready
  update_count: 2
       updated: 2017-07-07 09:38:04
1 row in set (0.00 sec)

mysql> select * from storage_pool\G
*************************** 1. row ***************************
                   id: 2
                 name: pri
                 uuid: 367ff360-89ab-34cc-97c5-f11f5af3d21f
            pool_type: NetworkFilesystem
                 port: 2049
       data_center_id: 2
               pod_id: 2
           cluster_id: 2
           used_bytes: 4902829817856
       capacity_bytes: 5902284816384
         host_address: 10.147.28.7
            user_info: NULL
                 path: /export/home/jayapal/pri-acs410
              created: 2017-07-07 09:16:30
              removed: NULL
          update_time: NULL
               status: Up
storage_provider_name: DefaultPrimary
                scope: CLUSTER
           hypervisor: NULL
              managed: 0
        capacity_iops: NULL
1 row in set (0.00 sec)


In host:

[root@xenserver-jokbbgbq ~]# mount
/dev/sda1 on / type ext3 (rw)
none on /proc type proc (rw)
none on /sys type sysfs (rw)
none on /dev/pts type devpts (rw)
none on /dev/shm type tmpfs (rw)
/opt/xensource/packages/iso/XenCenter.iso on /var/xen/xc-install type iso9660 (ro,loop=/dev/loop0)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
10.147.28.7:/export/home/jayapal/pri-acs410 on /var/run/sr-mount/478b2ff9-0dc3-909a-eea4-35313d5b7951 type nfs (rw,soft,timeo=133,retrans=2147483647,tcp,actimeo=0,addr=10.147.28.7)
[root@xenserver-jokbbgbq ~]#




[root@xenserver-jokbbgbq ~]# ls -l /var/run/sr-mount/478b2ff9-0dc3-909a-eea4-35313d5b7951/90652ba0-ae70-4934-ad29-d669571c866e.vhd
-rw-r-----+ 1 root root 11264 Jul  7 14:54 /var/run/sr-mount/478b2ff9-0dc3-909a-eea4-35313d5b7951/90652ba0-ae70-4934-ad29-d669571c866e.vhd


[root@xenserver-jokbbgbq ~]# xe sr-list
uuid ( RO)                : f198ac96-e837-924f-11b4-9ce38ce72056
          name-label ( RW): XenServer Tools
    name-description ( RW): XenServer Tools ISOs
                host ( RO): xenserver-jokbbgbq
                type ( RO): iso
        content-type ( RO): iso


uuid ( RO)                : 478b2ff9-0dc3-909a-eea4-35313d5b7951
          name-label ( RW): 367ff360-89ab-34cc-97c5-f11f5af3d21f
    name-description ( RW): 2
                host ( RO): xenserver-jokbbgbq
                type ( RO): nfs
        content-type ( RO): user


uuid ( RO)                : c9c528a4-713b-109d-6c99-e9ff24c32af8
          name-label ( RW): Removable storage
    name-description ( RW):
                host ( RO): xenserver-jokbbgbq
                type ( RO): udev
        content-type ( RO): disk


uuid ( RO)                : 10c2eb3c-8d87-63d7-64b6-51f1a5a93926
          name-label ( RW): DVD drives
    name-description ( RW): Physical DVD drives
                host ( RO): xenserver-jokbbgbq
                type ( RO): udev
        content-type ( RO): iso


uuid ( RO)                : 48c0f536-4397-8c8a-1c7e-bb9083b1d6f1
          name-label ( RW): 48c0f536-4397-8c8a-1c7e-bb9083b1d6f1
    name-description ( RW): Cloud Stack Local LVM Storage Pool for 46c764d3-5e06-4b02-8103-4842fe486e66
                host ( RO): xenserver-jokbbgbq
                type ( RO): lvm
        content-type ( RO): user


[root@xenserver-jokbbgbq ~]#




mysql> select * from template_store_ref\G
*************************** 1. row ***************************
                  id: 6
            store_id: 1
         template_id: 1
             created: 2017-07-07 09:18:56
        last_updated: 2017-07-07 09:41:33
              job_id: NULL
        download_pct: 100
                size: 3362005504
          store_role: Image
       physical_size: 3362005504
      download_state: DOWNLOADED
           error_str: NULL
          local_path: NULL
        install_path: template/tmpl/1/1/8aeb5feb-a793-496a-9bcc-a96ee9549ab8.vhd
                 url: http://download.cloudstack.org/systemvm/4.6/systemvm64template-4.6.0-xen.vhd.bz2
               state: Ready
           destroyed: 0
             is_copy: 0
        update_count: 0
             ref_cnt: 0
             updated: NULL
download_url_created: NULL
        download_url: NULL
*************************** 2. row ***************************
                  id: 7
            store_id: 1
         template_id: 13
             created: 2017-07-07 09:41:33
        last_updated: 2017-07-07 09:57:23
              job_id: fa8b9703-2bc6-4060-8d27-ace34e9e637b
        download_pct: 100
                size: 2147483648
          store_role: Image
       physical_size: 2151682560
      download_state: DOWNLOADED
           error_str: Install completed successfully at 7/7/17 9:57 AM
          local_path: /mnt/SecStorage/bfae623b-24eb-3d9d-802e-79e7c2bcfe68/template/tmpl/1/13/dnld772577941095871679tmp_
        install_path: template/tmpl/1/13/3e186b35-c8c3-3dc0-b6d7-f5f94a57f1e7.vhd
                 url: NULL
               state: Ready
           destroyed: 0
             is_copy: 0
        update_count: 2
             ref_cnt: 0
             updated: 2017-07-07 09:57:23
download_url_created: NULL
        download_url: NULL
2 rows in set (0.01 sec)



root@s-4-VM:~# mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_inodes=59455,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=50784k,mode=755)
/dev/disk/by-uuid/bec0865c-a811-406b-9557-68ab5423034e on / type ext4 (rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=174660k)
/dev/xvda1 on /boot type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered)
/dev/xvda6 on /home type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered)
/dev/xvda8 on /opt type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered)
/dev/xvda11 on /tmp type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered)
/dev/xvda7 on /usr type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered)
/dev/xvda9 on /var type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered)
/dev/xvda10 on /var/log type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered)
none on /proc/xen type xenfs (rw,relatime)
rpc_pipefs on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime)
10.147.28.7:/export/home/jayapal/sec-acs410 on /mnt/SecStorage/bfae623b-24eb-3d9d-802e-79e7c2bcfe68 type nfs (rw,relatime,vers=3,rsize=32768,wsize=32768,namlen=255,acdirmin=0,acdirmax=0,soft,proto=tcp,timeo=133,retrans=2147483647,sec=sys,mountaddr=10.147.28.7,mountvers=3,mountport=53363,mountproto=tcp,local_lock=none,addr=10.147.28.7)
root@s-4-VM:~#

=== When ssvm is up it copies the user vm template (centos) from the template URL to the secondary storage. MS inserts a template download job in template_store_ref. This "jobId":"fa8b9703-2bc6-4060-8d27-ace34e9e637b will track the template download job.


2017-07-07 09:51:52,553 DEBUG [cloud.agent.Agent] (agentRequest-Handler-10:null) Request:Seq 3-5699023853460652083:  { Cmd , MgmtId: 4278190080, via: 3, Ver: v1, Flags: 100011, [{"org.apache.cloudstack.storage.command.DownloadProgressCommand":{"jobId":"fa8b9703-2bc6-4060-8d27-ace34e9e637b","request":"GET_STATUS","hvm":false,"description":"CentOS 6.5(64-bit) no GUI (XenServer)","checksum":"d1a8f3c4e69e31499ef6e59f1ab2401f","maxDownloadSizeInBytes":53687091200,"id":13,"resourceType":"TEMPLATE","installPath":"template/tmpl/1/13","_store":{"com.cloud.agent.api.to.NfsTO":{"_url":"nfs://10.147.28.7/export/home/jayapal/sec-acs410","_role":"Image"}},"url":"http://s3.download.accelerite.com/templates/builtin/centos65-x86_64-xen.vhd.bz2","format":"VHD","accountId":1,"name":"centos65-x86_64-XenServer","secUrl":"nfs://10.147.28.7/export/home/jayapal/sec-acs410","wait":0}}] }
2017-07-07 09:51:52,553 DEBUG [cloud.agent.Agent] (agentRequest-Handler-10:null) Processing command: org.apache.cloudstack.storage.command.DownloadProgressCommand
2017-07-07 09:51:52,554 DEBUG [cloud.agent.Agent] (agentRequest-Handler-10:null) Seq 3-5699023853460652083:  { Ans: , MgmtId: 4278190080, via: 3, Ver: v1, Flags: 10,
 [{"com.cloud.agent.api.storage.DownloadAnswer":{"jobId":"fa8b9703-2bc6-4060-8d27-ace34e9e637b","downloadPct":100,"errorString":"Download success, starting install ","downloadStatus":"DOWNLOAD_IN_PROGRESS","downloadPath":"/mnt/SecStorage/bfae623b-24eb-3d9d-802e-79e7c2bcfe68/template/tmpl/1/13/dnld772577941095871679tmp_","installPath":"template/tmpl/1/13/3e186b35-c8c3-3dc0-b6d7-f5f94a57f1e7.vhd","templateSize":0,"templatePhySicalSize":0,"checkSum":"d1a8f3c4e69e31499ef6e59f1ab2401f","result":true,"details":"Download success, starting install ","wait":0}}] }
==


2017-07-07 15:37:01,460 DEBUG [c.c.a.t.Request] (Work-Job-Executor-34:ctx-138e1a90 job-63/job-64 ctx-1ba9e51f) (logid:67e0e6c0) Seq 2-2953798405601624177: Sending  { Cmd , MgmtId: 4278190080, via: 2(xenserver-jokbbgbq), Ver: v1, Flags: 100111, [{"org.apache.cloudstack.storage.command.CopyCommand":{"srcTO":{"org.apache.cloudstack.storage.to.TemplateObjectTO":{"path":"90652ba0-ae70-4934-ad29-d669571c866e","origUrl":"http://download.cloudstack.org/systemvm/4.6/systemvm64template-4.6.0-xen.vhd.bz2","uuid":"e033220c-62ef-11e7-8285-2c6781531a89","id":1,"format":"VHD","accountId":1,"checksum":"8886f554a499ec5405b6f203d9d36460","hvm":false,"displayText":"SystemVM Template (XenServer)","imageDataStore":{"org.apache.cloudstack.storage.to.PrimaryDataStoreTO":{"uuid":"367ff360-89ab-34cc-97c5-f11f5af3d21f","name":"pri","id":2,"poolType":"NetworkFilesystem","host":"10.147.28.7","path":"/export/home/jayapal/pri-acs410","port":2049,"url":"NetworkFilesystem://10.147.28.7/export/home/jayapal/pri-acs410/?ROLE=Primary&STOREUUID=367ff360-89ab-34cc-97c5-f11f5af3d21f","isManaged":false}},"name":"routing-1","hypervisorType":"XenServer"}},"destTO":{"org.apache.cloudstack.storage.to.VolumeObjectTO":{"uuid":"f332087e-32c5-4742-8d35-88fe1ba4cf66","volumeType":"ROOT","dataStore":{"org.apache.cloudstack.storage.to.PrimaryDataStoreTO":{"uuid":"367ff360-89ab-34cc-97c5-f11f5af3d21f","name":"pri","id":2,"poolType":"NetworkFilesystem","host":"10.147.28.7","path":"/export/home/jayapal/pri-acs410","port":2049,"url":"NetworkFilesystem://10.147.28.7/export/home/jayapal/pri-acs410/?ROLE=Primary&STOREUUID=367ff360-89ab-34cc-97c5-f11f5af3d21f","isManaged":false}},"name":"ROOT-7","size":3362005504,"volumeId":4,"vmName":"r-7-VM","accountId":2,"format":"VHD","provisioningType":"THIN","id":4,"deviceId":0,"hypervisorType":"XenServer"}},"executeInSequence":true,"options":{},"options2":{},"wait":0}}] }




======host mount output after the user vm deployed ===========
[root@xenserver-jokbbgbq ~]# mount
/dev/sda1 on / type ext3 (rw)
none on /proc type proc (rw)
none on /sys type sysfs (rw)
none on /dev/pts type devpts (rw)
none on /dev/shm type tmpfs (rw)
/opt/xensource/packages/iso/XenCenter.iso on /var/xen/xc-install type iso9660 (ro,loop=/dev/loop0)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
10.147.28.7:/export/home/jayapal/pri-acs410 on /var/run/sr-mount/478b2ff9-0dc3-909a-eea4-35313d5b7951 type nfs (rw,soft,timeo=133,retrans=2147483647,tcp,actimeo=0,addr=10.147.28.7)
10.147.28.7:/export/home/jayapal/sec-acs410/template/tmpl/1/13 on /var/run/cloud_mount/3a002bc4-bd4c-463a-b7f0-0876c9d6d3dc type nfs (ro,tcp,soft,timeo=133,retrans=1,addr=10.147.28.7)
[root@xenserver-jokbbgbq ~]#



==============
user vm template vhd location

mysql> select * from template_spool_ref\G
*************************** 1. row ***************************
            id: 1
       pool_id: 2
   template_id: 1
       created: 2017-07-07 09:32:04
  last_updated: NULL
        job_id: NULL
  download_pct: 100
download_state: DOWNLOADED
     error_str: NULL
    local_path: 90652ba0-ae70-4934-ad29-d669571c866e
  install_path: 90652ba0-ae70-4934-ad29-d669571c866e
 template_size: 3362005504
 marked_for_gc: 0
         state: Ready
  update_count: 2
       updated: 2017-07-07 09:38:04
*************************** 2. row ***************************
            id: 2
       pool_id: 2
   template_id: 13
       created: 2017-07-07 10:12:46
  last_updated: NULL
        job_id: NULL
  download_pct: 100
download_state: DOWNLOADED
     error_str: NULL
    local_path: 79a40480-876d-450b-9703-611243101c03
  install_path: 79a40480-876d-450b-9703-611243101c03
 template_size: 2151682560
 marked_for_gc: 0
         state: Ready
  update_count: 2
       updated: 2017-07-07 10:24:53
2 rows in set (0.00 sec)



[root@xenserver-jokbbgbq ~]# ls -l /var/run/sr-mount/478b2ff9-0dc3-909a-eea4-35313d5b7951/79a40480-876d-450b-9703-611243101c03.vhd
-rw-r-----+ 1 root root 8704 Jul  7 15:41 /var/run/sr-mount/478b2ff9-0dc3-909a-eea4-35313d5b7951/79a40480-876d-450b-9703-611243101c03.vhd

No comments:

Post a Comment