Author: fapeeler
Date: Mon Mar 14 15:33:00 2011
New Revision: 1081425

URL: http://svn.apache.org/viewvc?rev=1081425&view=rev
Log:
VCL-436

Extended a query to restrict which images can be loaded on the node based on 
the mappings of OSinstalltype and installtype


Modified:
    incubator/vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_1.pm

Modified: 
incubator/vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_1.pm
URL: 
http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_1.pm?rev=1081425&r1=1081424&r2=1081425&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_1.pm 
(original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/Predictive/Level_1.pm Mon 
Mar 14 15:33:00 2011
@@ -164,7 +164,7 @@ sub get_next_image {
        # get machine type
        my $select_type = "
     SELECT
-    type
+    type,provisioningid
         FROM
          computer
          WHERE
@@ -176,6 +176,7 @@ sub get_next_image {
                return 0;
        }
        my $type = $data[0]{type};
+       my $provisioningid = $data[0]{provisioningid};
 
        # online machines
        my $select_online = "
@@ -319,20 +320,28 @@ sub get_next_image {
                return 0;
        }
 
+
        $inlist = join(',', @imggroups);
        my $select_imageids = "
         SELECT
         DISTINCT(r.subid)
         FROM
         image i,
+       OS o,
         resource r,
-        resourcegroupmembers rgm
+        resourcegroupmembers rgm,
+       OSinstalltype osit,
+       provisioningOSinstalltype posit
         WHERE
         rgm.resourceid = r.id
         AND r.resourcetypeid = 13
         AND rgm.resourcegroupid IN ($inlist)
         AND r.subid = i.id
         AND i.deleted = 0
+       AND i.OSid = o.id
+       AND o.installtype = osit.name
+       AND osit.id = posit.OSinstalltypeid
+       AND posit.provisioningid = $provisioningid
         ";
        my @imgids;
        @data = database_select($select_imageids);


Reply via email to