You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by jf...@apache.org on 2014/11/07 21:36:19 UTC
svn commit: r1637443 - /vcl/trunk/web/.ht-inc/xmlrpcWrappers.php
Author: jfthomps
Date: Fri Nov 7 20:36:18 2014
New Revision: 1637443
URL: http://svn.apache.org/r1637443
Log:
VCL-776 - rework resource code to have a base class for all resources and inheriting classes for each resource type
xmlrpcWrappers.php:
-modified XMLRPCautoCapture: changed keys of some fields in $data array to match what is in addResource; added query to set state of request to image and update imageid and imagerevisionid of reservation
-modified XMLRPCfinishBaseImageCapture: removed require_once for images.php; added require_once for resource.php and image.php; create Image object and call addImagePermissions on it instead of addImagePermissions directly (which does not exist anymore)
Modified:
vcl/trunk/web/.ht-inc/xmlrpcWrappers.php
Modified: vcl/trunk/web/.ht-inc/xmlrpcWrappers.php
URL: http://svn.apache.org/viewvc/vcl/trunk/web/.ht-inc/xmlrpcWrappers.php?rev=1637443&r1=1637442&r2=1637443&view=diff
==============================================================================
--- vcl/trunk/web/.ht-inc/xmlrpcWrappers.php (original)
+++ vcl/trunk/web/.ht-inc/xmlrpcWrappers.php Fri Nov 7 20:36:18 2014
@@ -1322,14 +1322,15 @@ function XMLRPCautoCapture($requestid) {
'desc' => $desc,
'usage' => '',
'owner' => "{$ownerdata['unityid']}@{$ownerdata['affiliation']}",
- 'prettyname' => "Autocaptured ({$ownerdata['unityid']} - $requestid)",
- 'minram' => 64,
- 'minprocnumber' => 1,
- 'minprocspeed' => 500,
- 'minnetwork' => 10,
- 'maxconcurrent' => '',
+ 'name' => "Autocaptured ({$ownerdata['unityid']} - $requestid)",
+ 'ram' => 64,
+ 'cores' => 1,
+ 'cpuspeed' => 500,
+ 'networkspeed' => 10,
+ 'concurrent' => '',
'checkuser' => 1,
'rootaccess' => 1,
+ 'checkout' => 1,
'sysprep' => 1,
'basedoffrevisionid' => $reqData['reservations'][0]['imagerevisionid'],
'platformid' => $imageData[$imageid]['platformid'],
@@ -1339,12 +1340,21 @@ function XMLRPCautoCapture($requestid) {
'connectmethodids' => implode(',', array_keys($connectmethods)),
'autocaptured' => 1);
$obj = new Image();
- $rc = $obj->addResource($data);
- if($rc == 0) {
+ $imageid = $obj->addResource($data);
+ if($imageid == 0) {
return array('status' => 'error',
'errorcode' => 50,
'errormsg' => 'error encountered while attempting to create image');
}
+
+ $query = "UPDATE request rq, "
+ . "reservation rs "
+ . "SET rs.imageid = $imageid, "
+ . "rs.imagerevisionid = {$obj->imagerevisionid}, "
+ . "rq.stateid = 16 "
+ . "WHERE rq.id = $requestid AND "
+ . "rq.id = rs.requestid";
+ doQuery($query);
}
return array('status' => 'success');
}
@@ -3706,8 +3716,10 @@ function XMLRPCfinishBaseImageCapture($o
'errorcode' => 91,
'errormsg' => 'Invalid resourceid submitted');
}
- require_once(".ht-inc/images.php");
- addImagePermissions($ownerdata, $resourceid, $virtual);
+ require_once(".ht-inc/resource.php");
+ require_once(".ht-inc/image.php");
+ $obj = new Image();
+ $obj->addImagePermissions($ownerdata, $resourceid, $virtual);
return array('status' => 'success');
}
?>