Name

global.FixHyperVModelForPatterns

Description

cmdb_ci_hyper_v_server

Script

var FixHyperVModelForPatterns = Class.create();
FixHyperVModelForPatterns.prototype =  Object.extendsObject(FixPatternsModelBasic, {
  WINDOWS_STEPS : 19,

  addMissingRelationsForHyperV : function() {
  	this.stepsCompleted = this.getStepsCompleted();
  	var hyperVClass = 'cmdb_ci_hyper_v_server';
  	this.addMissingRelations(hyperVClass);
  },
  	
  addMissingRelations : function(hyperVClass) {
  	// Since this can be called both from FixWindowsModelForPatterns and from standalone
  	// adjusting step count so that this can be used for either
  	var stepCount = this.stepsCompleted;
  	if (stepCount >= this.WINDOWS_STEPS)
  		stepCount -= this.WINDOWS_STEPS;

  	switch(stepCount) {
  		case 0:
  			this.infoMsg('Hyper-V: Adding Network Adapter Relationships');
  			this.addNetworkAdapter(hyperVClass);
  			this.stepsCompleted++;
  			this.updateStepsCompleted(this.stepsCompleted);
  		case 1:
  			this.infoMsg('Hyper-V: Adding File System Relationships');
  			this.addFileSystem(hyperVClass);
  			this.stepsCompleted++;
  			this.updateStepsCompleted(this.stepsCompleted);
  		case 2:
  			this.infoMsg('Hyper-V: Adding IP Address Relationships');
  			this.addIpAddress(hyperVClass);
  			this.stepsCompleted++;
  			this.updateStepsCompleted(this.stepsCompleted);
  		case 3:
  			this.infoMsg('Hyper-V: Adding Memory Module Relationships');
  			this.addMemoryModule(hyperVClass);
  			this.stepsCompleted++;
  			this.updateStepsCompleted(this.stepsCompleted);
  		case 4:
  			this.infoMsg('Hyper-V: Adding Storage Relationships');
  			this.addStorage(hyperVClass);
  			this.stepsCompleted++;
  			this.updateStepsCompleted(this.stepsCompleted);
  		case 5:
  			this.infoMsg('Hyper-V: Adding Disk Partition Relationships');
  			this.addDiskPartitions(hyperVClass);
  			this.stepsCompleted++;
  			this.updateStepsCompleted(this.stepsCompleted);
  		case 6:
  			this.infoMsg('Hyper-V: Adding Exit Interface Relationships');
  			this.addExitInterfaceRule(hyperVClass);
  			this.stepsCompleted++;
  			this.updateStepsCompleted(this.stepsCompleted);
  		case 7:
  			this.infoMsg('Hyper-V: Adding Next Hop Relationships');
  			this.addNextHopRule(hyperVClass);
  			this.stepsCompleted++;
  			this.updateStepsCompleted(this.stepsCompleted);
  		case 8:
  			this.infoMsg('Hyper-V: Adding HBA Relationships');
  			this.addHBA(hyperVClass);
  			this.stepsCompleted++;
  			this.updateStepsCompleted(this.stepsCompleted);
  		case 9:
  			this.infoMsg('Hyper-V: Adding Fibre Channel Relationships');
  			this.addFiberChannel(hyperVClass);
  			this.stepsCompleted++;
  			this.updateStepsCompleted(this.stepsCompleted);
  		case 10:
  			this.infoMsg('Hyper-V: Adding Router Interface Relationships');
  			this.addRouterInterface(hyperVClass);
  			this.stepsCompleted++;
  			this.updateStepsCompleted(this.stepsCompleted);
  		case 11:
  			this.infoMsg('Hyper-V: Adding Hyper-V Component Relationships');
  			this.addHyperVComponentsToPool('cmdb_ci_hyper_v_resource_pool');
  			this.saveLeftOversRelationsToCMDBRelCI();
  			this.stepsCompleted++;
  			this.updateStepsCompleted(this.stepsCompleted);
  		case 12:
  			this.infoMsg('Hyper-V: Updating Existing Relationships');
  			this.flipRelationship('cmdb_ci_hyper_v_resource_pool', hyperVClass, this.DEFINE_RESOURCE_FOR);
  			this.flipLayeredRelationship('cmdb_ci_storage_device', 'cmdb_ci_file_system', this.PROVIDES, hyperVClass, 'computer', 'computer');
  			this.changeRelationship('cmdb_ci_hyper_v_network', hyperVClass, this.PROVIDED_BY, this.PROVIDES);
  			this.stepsCompleted++;
  			this.updateStepsCompleted(this.stepsCompleted);
  		case 13:
  			this.infoMsg('Hyper-V: Updating File Systems');
  			this.updateFileSystems(hyperVClass);
  			this.stepsCompleted++;
  			this.updateStepsCompleted(this.stepsCompleted);
  		case 14:
  			this.infoMsg('Hyper-V: Updating Exit Interface Route Names');
  			this.updateRouteInterfaceName(hyperVClass, 'short_description');
  			this.stepsCompleted++;
  			this.updateStepsCompleted(this.stepsCompleted);
  		case 15:
  			this.infoMsg('Hyper-V: Updating Exit Interface Route Mac Address');
  			this.updateRouteInterfaceMacAddress(hyperVClass);
  			this.stepsCompleted++;
  			this.updateStepsCompleted(this.stepsCompleted);
  		case 16:
  			this.infoMsg('Hyper-V: Updating Dest IP Network Values');
  			this.fixDestIpNetwork(hyperVClass);
  			this.stepsCompleted++;
  			this.updateStepsCompleted(this.stepsCompleted);
  			break;
  		default:
  			this.infoMsg('Hyper-V migration step count check FAILED - Please check probe_to_pattern_log for issues.');
  	}
  },
  
  type: 'FixHyperVModelForPatterns'
});

Sys ID

c3a65f5a9f1123004deb91aec32e7043

Offical Documentation

Official Docs: