{"id":3247,"date":"2012-09-27T20:03:26","date_gmt":"2012-09-27T18:03:26","guid":{"rendered":"http:\/\/contoso.se\/blog\/?p=3247"},"modified":"2012-09-27T20:17:02","modified_gmt":"2012-09-27T18:17:02","slug":"handle-disk-iops-when-deployingdeleting-or-update-a-virtual-machine","status":"publish","type":"post","link":"https:\/\/contoso.se\/blog\/?p=3247","title":{"rendered":"Handle disk IOPS when deploying\/deleting or update a virtual machine"},"content":{"rendered":"<p>A couple of weeks ago I needed to build a solution where disk IOPS are allocated when a new virtual machine is deployed. The scenario was that virtualization\u00c2\u00a0administrators wanted to make sure no disks was over allocated looking at disk performance. When Virtual Machine Manager deploy a new virtual machine it doesn&#8217;t look at what kind of virtual machines that are already deployed at the disk, only at the current disk load. In worst case this could result in very poor disk performance if all virtual machines start working\u00c2\u00a0heavily\u00c2\u00a0with the disk at the same time. In the virtual environment we had three virtual machine templates, small, medium and large. There was a estimate of disk IOPS\u00c2\u00a0required\u00c2\u00a0by each template. Virtualization\u00c2\u00a0administrators needed to make sure that not more than one virtual machine based on the large template was deployed to a disk and that new virtual machines was deployed to the disk with most free IOPS. Also make sure that no disk was over allocated when looking at disk IOPS.<\/p>\n<p>In Service Manager disks will show up as CI if you have a connect to Operations Manager. But default properties of the disk class was not enough, we needed to store information about disk IOPS and didn&#8217;t want to affect anything else, so we created a new configure item class, that would only be used for this purpose. The new class was created with Service Manager authoring tool, example\u00c2\u00a0<a title=\"How to create a new CI class and a new form\" href=\"http:\/\/contoso.se\/blog\/?p=1707\">here<\/a>.<\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_04.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-3252\" title=\"20120921_IOPS_04\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_04-300x104.jpg\" alt=\"\" width=\"300\" height=\"104\" srcset=\"https:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_04-300x104.jpg 300w, https:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_04.jpg 510w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_05.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-3253\" title=\"20120921_IOPS_05\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_05-300x284.jpg\" alt=\"\" width=\"300\" height=\"284\" srcset=\"https:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_05-300x284.jpg 300w, https:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_05.jpg 617w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>We could now create CI objects for each disk that the virtual environment was using. Disk CI include max, allocated and free IOPS. We then published an offering in the Service Manager self-service to request new virtual machines. We used a runbook to deploy the new virtual machine. As you can see in the runbook below we have a main runbook building the virtual machines, then we invoke another runbook to figure out which disk to use. The runbook also write a register value to the new machine with information of the template used. Operations Manager will later discover this information and start monitor the new virtual machine based on the virtual machine template. Virtual machines are monitored with different thresholds and in different ways based on which template that was used during deployment.<\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_06.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-3255\" title=\"20120921_IOPS_06\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_06-300x100.jpg\" alt=\"\" width=\"300\" height=\"100\" srcset=\"https:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_06-300x100.jpg 300w, https:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_06-1024x344.jpg 1024w, https:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_06.jpg 1272w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>The &#8220;Get disk&#8221; figure out which disk to use. It use a temp database to store disk information in, so the first step in the runbook is to clean this database to make sure it runs with fresh data. It then adds data to the temp database about each virtual machine template, and query Service Manager to find all disks that have\u00c2\u00a0enough free IOPS based on the virtual machine template. After the junction activity the runbook runs a SQL query to find out which disk to use, if we are about to deploy a new virtual machine based on the large template we also check if there is a free disk with\u00c2\u00a0enough\u00c2\u00a0IOPS that\u00c2\u00a0don&#8217;t\u00c2\u00a0already host a large virtual machine. \u00c2\u00a0\u00c2\u00a0In the end the runbook updates the disk CI in Service Manager, allocate the disk IOPS,then\u00c2\u00a0returns\u00c2\u00a0which disk to use to the &#8220;main&#8221; runbook that will continue to build the virtual machine.<\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_07.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-3257\" title=\"20120921_IOPS_07\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_07-300x135.jpg\" alt=\"\" width=\"300\" height=\"135\" srcset=\"https:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_07-300x135.jpg 300w, https:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_07-1024x464.jpg 1024w, https:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_07.jpg 1240w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>We also created a runbook to handle deletion<span style=\"font-family: Arial;\">\u00c2\u00a0<\/span>of a virtual machine, including giving back allocated disk IOPS to the correct disk CI. We created one portal offering also around update a virtual machine, for example if a machine is running based on the medium template but need more RAM we can update it to a large template. Portal offerings for deletes and updates virtual machines use a query result to show only virtual machines there the portal user are owner, to make sure no one deletes or updates the wrong virtual machine.<\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_01.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-3258\" title=\"20120921_IOPS_01\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_01-278x300.jpg\" alt=\"\" width=\"278\" height=\"300\" srcset=\"https:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_01-278x300.jpg 278w, https:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_01.jpg 393w\" sizes=\"(max-width: 278px) 100vw, 278px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_03.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-3259\" title=\"20120921_IOPS_03\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_03-300x230.jpg\" alt=\"\" width=\"300\" height=\"230\" srcset=\"https:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_03-300x230.jpg 300w, https:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_03.jpg 483w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>example of the runbook that update of virtual machines<\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_08.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-3260\" title=\"20120921_IOPS_08\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_08-300x79.jpg\" alt=\"\" width=\"300\" height=\"79\" srcset=\"https:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_08-300x79.jpg 300w, https:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_08-1024x272.jpg 1024w, https:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_08.jpg 1261w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>example of the runbook that delete virtual machines<\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_09.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-3261\" title=\"20120921_IOPS_09\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_09-300x127.jpg\" alt=\"\" width=\"300\" height=\"127\" srcset=\"https:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_09-300x127.jpg 300w, https:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_09-1024x434.jpg 1024w, https:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/09\/20120921_IOPS_09.jpg 1295w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A couple of weeks ago I needed to build a solution where disk IOPS are allocated when a new virtual machine is deployed. The scenario was that virtualization\u00c2\u00a0administrators wanted to make sure no disks was over allocated looking at disk performance. When Virtual Machine Manager deploy a new virtual machine it doesn&#8217;t look at what &hellip; <a href=\"https:\/\/contoso.se\/blog\/?p=3247\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[60,25,35],"tags":[],"_links":{"self":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3247"}],"collection":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3247"}],"version-history":[{"count":20,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3247\/revisions"}],"predecessor-version":[{"id":3271,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3247\/revisions\/3271"}],"wp:attachment":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3247"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3247"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3247"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}