Skip to content

Commit c1af92f

Browse files
Santhosh Edukullachaturvedia
authored andcommitted
Added Fix for CLOUDSTACK-5875
Added fix for exception and listing. Mentioned details under bug. Post the fix, simulator works fine. Signed-off-by: Santhosh Edukulla <Santhosh.Edukulla@citrix.com> Signed-off-by: Koushik Das <koushik@apache.org> (cherry picked from commit d31fa09) Signed-off-by: Animesh Chaturvedi <animesh@apache.org>
1 parent 01289b1 commit c1af92f

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockAgentManagerImpl.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import javax.inject.Inject;
3333
import javax.naming.ConfigurationException;
3434

35+
import com.cloud.user.AccountManager;
36+
import org.apache.cloudstack.context.CallContext;
3537
import org.apache.log4j.Logger;
3638
import org.springframework.stereotype.Component;
3739

@@ -87,6 +89,7 @@ public class MockAgentManagerImpl extends ManagerBase implements MockAgentManage
8789
MockStorageManager _storageMgr = null;
8890
@Inject
8991
ResourceManager _resourceMgr;
92+
@Inject private AccountManager _accountMgr;
9093

9194
SimulatorSecondaryDiscoverer discoverer;
9295
@Inject
@@ -306,8 +309,10 @@ private void handleSystemVMStop() {
306309
@Override
307310
@DB
308311
public void run() {
312+
CallContext.register(_accountMgr.getSystemUser(), _accountMgr.getSystemAccount());
309313
if (this.mode.equalsIgnoreCase("Stop")) {
310314
handleSystemVMStop();
315+
CallContext.unregister();
311316
return;
312317
}
313318

@@ -363,10 +368,12 @@ public void run() {
363368
_resourceMgr.discoverHosts(cmd);
364369
} catch (DiscoveryException e) {
365370
s_logger.debug("Failed to discover host: " + e.toString());
371+
CallContext.unregister();
366372
return;
367373
}
368374
} catch (ConfigurationException e) {
369375
s_logger.debug("Failed to load secondary storage resource: " + e.toString());
376+
CallContext.unregister();
370377
return;
371378
}
372379
}

setup/db/templates.simulator.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
-- under the License.
1717

1818

19-
INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type)
20-
VALUES (100, UUID(), 'simulator-domR', 'SystemVM Template (simulator)', 0, now(), 'SYSTEM', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/routing/debian/latest/systemvm.vhd.bz2', '', 0, 'SystemVM Template (simulator)', 'VHD', 15, 0, 1, 'Simulator');
21-
INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type)
22-
VALUES (111, UUID(), 'simulator-Centos', 'CentOS 5.3(64-bit) no GUI (Simulator)', 1, now(), 'BUILTIN', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/centos53-x86_64/latest/f59f18fb-ae94-4f97-afd2-f84755767aca.vhd.bz2', '', 0, 'CentOS 5.3(64-bit) no GUI (Simulator)', 'VHD', 11, 1, 1, 'Simulator');
19+
INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type, state)
20+
VALUES (100, UUID(), 'simulator-domR', 'SystemVM Template (simulator)', 0, now(), 'SYSTEM', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/routing/debian/latest/systemvm.vhd.bz2', '', 0, 'SystemVM Template (simulator)', 'VHD', 15, 0, 1, 'Simulator','Active');
21+
INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type,state)
22+
VALUES (111, UUID(), 'simulator-Centos', 'CentOS 5.3(64-bit) no GUI (Simulator)', 1, now(), 'BUILTIN', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/centos53-x86_64/latest/f59f18fb-ae94-4f97-afd2-f84755767aca.vhd.bz2', '', 0, 'CentOS 5.3(64-bit) no GUI (Simulator)', 'VHD', 11, 1, 1, 'Simulator','Active');

0 commit comments

Comments
 (0)