Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
"(CASE WHEN ISNULL(service_offering.speed) THEN custom_speed.value ELSE service_offering.speed end) AS speed, " +
"(CASE WHEN ISNULL(service_offering.ram_size) THEN custom_ram_size.value ELSE service_offering.ram_size end) AS ram_size " +
"FROM vm_instance vi LEFT JOIN service_offering ON(((vi.service_offering_id = service_offering.id))) " +
"LEFT JOIN user_vm_details custom_cpu ON(((custom_cpu.vm_id = vi.id) AND (custom_cpu.name = 'CpuNumber'))) " +
"LEFT JOIN user_vm_details custom_speed ON(((custom_speed.vm_id = vi.id) AND (custom_speed.name = 'CpuSpeed'))) " +
"LEFT JOIN user_vm_details custom_ram_size ON(((custom_ram_size.vm_id = vi.id) AND (custom_ram_size.name = 'memory'))) ";
"LEFT JOIN vm_instance_details custom_cpu ON(((custom_cpu.vm_id = vi.id) AND (custom_cpu.name = 'CpuNumber'))) " +
"LEFT JOIN vm_instance_details custom_speed ON(((custom_speed.vm_id = vi.id) AND (custom_speed.name = 'CpuSpeed'))) " +
"LEFT JOIN vm_instance_details custom_ram_size ON(((custom_ram_size.vm_id = vi.id) AND (custom_ram_size.name = 'memory'))) ";

private static final String WHERE_STATE_IS_NOT_DESTRUCTIVE =
"WHERE ISNULL(vi.removed) AND vi.state NOT IN ('Destroyed', 'Error', 'Expunging')";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public long removeEntriesByOwner(long ownerId, ResourceOwnerType ownerType) {
+ " END)) as total "
+ " from vm_instance vm "
+ " join service_offering so on so.id = vm.service_offering_id "
+ " left join user_vm_details vmd on vmd.vm_id = vm.id and vmd.name = '%s' "
+ " left join vm_instance_details vmd on vmd.vm_id = vm.id and vmd.name = '%s' "
+ " where vm.type = 'User' and state not in ('Destroyed', 'Error', 'Expunging') and display_vm = true and account_id = ? ";

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use
+ "left join security_group on security_group_vm_map.security_group_id=security_group.id " + "left join nics on vm_instance.id=nics.instance_id "
+ "left join networks on nics.network_id=networks.id " + "left join user_ip_address on user_ip_address.vm_id=vm_instance.id " + "where vm_instance.id in (";

private static final String VMS_DETAIL_BY_NAME = "select vm_instance.instance_name, vm_instance.vm_type, vm_instance.id , user_vm_details.value, user_vm_details.name from vm_instance "
+ "left join user_vm_details on vm_instance.id = user_vm_details.vm_id where (user_vm_details.name is null or user_vm_details.name = ? ) and vm_instance.instance_name in (";
private static final String VMS_DETAIL_BY_NAME = "select vm_instance.instance_name, vm_instance.vm_type, vm_instance.id , vm_instance_details.value, vm_instance_details.name from vm_instance "
+ "left join vm_instance_details on vm_instance.id = vm_instance_details.vm_id where (vm_instance_details.name is null or vm_instance_details.name = ? ) and vm_instance.instance_name in (";

private static final int VM_DETAILS_BATCH_SIZE = 100;

Expand Down Expand Up @@ -755,7 +755,7 @@ public List<Pair<Pair<String, VirtualMachine.Type>, Pair<Long, String>>> getVmsD
while (rs.next()) {
vmsDetailByNames.add(new Pair<Pair<String, VirtualMachine.Type>, Pair<Long, String>>(new Pair<String, VirtualMachine.Type>(
rs.getString("vm_instance.instance_name"), VirtualMachine.Type.valueOf(rs.getString("vm_type"))),
new Pair<Long, String>(rs.getLong("vm_instance.id"), rs.getString("user_vm_details.value"))));
new Pair<Long, String>(rs.getLong("vm_instance.id"), rs.getString("vm_instance_details.value"))));
}
}
} catch (SQLException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ private void migrateScaleIOStoragePoolDetails(Connection conn) {

private void migrateUserVmDetails(Connection conn) {
System.out.println("Begin migrate user vm details");
migrateDetails(conn, "user_vm_details", PASSWORD);
migrateDetails(conn, "vm_instance_details", PASSWORD);
System.out.println("End migrate user vm details");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3203,7 +3203,7 @@ protected void setNewVRamSizeVmVideoCard(VirtualMachineMO vmMo, long svgaVmramSi
}

/**
* Modifies vm vram size if it was set to a different size to the one provided in svga.vramSize (user_vm_details or template_vm_details) on {@code vmConfigSpec}
* Modifies vm vram size if it was set to a different size to the one provided in svga.vramSize (vm_instance_details or template_vm_details) on {@code vmConfigSpec}
*
* @param videoCard vm's video card device
* @param vmMo virtual machine mo
Expand Down
10 changes: 5 additions & 5 deletions server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -6324,7 +6324,7 @@ public UserVm createVirtualMachine(DeployVMCmd cmd) throws InsufficientCapacityE
}
}

// Add extraConfig to user_vm_details table
// Add extraConfig to vm_instance_details table
String extraConfig = cmd.getExtraConfig();
if (StringUtils.isNotBlank(extraConfig)) {
if (EnableAdditionalVmConfig.valueIn(callerId)) {
Expand Down Expand Up @@ -6482,7 +6482,7 @@ private void checkIfVolumeTemplateIsTheSameAsTheProvided(VolumeInfo volume, Long
}

/**
* Persist extra configuration data in the user_vm_details table as key/value pair
* Persist extra configuration data in the vm_instance_details table as key/value pair
* @param decodedUrl String consisting of the extra config data to appended onto the vmx file for VMware instances
*/
protected void persistExtraConfigVmware(String decodedUrl, UserVm vm) {
Expand All @@ -6506,7 +6506,7 @@ protected void persistExtraConfigVmware(String decodedUrl, UserVm vm) {
}

/**
* Used to persist extra configuration settings in user_vm_details table for the XenServer hypervisor
* Used to persist extra configuration settings in vm_instance_details table for the XenServer hypervisor
* persists config as key/value pair e.g key = extraconfig-1 , value="PV-bootloader=pygrub" and so on to extraconfig-N where
* N denotes the number of extra configuration settings passed by user
*
Expand Down Expand Up @@ -6587,9 +6587,9 @@ protected boolean isValidXenOrVmwareConfiguration(String cfg, String[] allowedKe

/**
* Persist extra configuration data on KVM
* persisted in the user_vm_details DB as extraconfig-1, and so on depending on the number of configurations
* persisted in the vm_instance_details DB as extraconfig-1, and so on depending on the number of configurations
* For KVM, extra config is passed as XML
* @param decodedUrl string containing xml configuration to be persisted into user_vm_details table
* @param decodedUrl string containing xml configuration to be persisted into vm_instance_details table
* @param vm
*/
protected void persistExtraConfigKvm(String decodedUrl, UserVm vm) {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/component/test_rootvolume_resize.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def getDiskController(self, vm, diskcontroller="ide"):
vmid = int(qresultvmuuid[0][0])
qresult = self.dbclient.execute(
"select rootDiskController from"
" user_vm_details where id = '%s';" % vmid
" vm_instance_details where id = '%s';" % vmid
)
self.debug("Query result: %s" % qresult)
diskcontroller = qresult[0][0]
Expand Down
4 changes: 2 additions & 2 deletions test/integration/component/test_update_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def test_update_vm_details_admin(self):
vm_db_id = dbresult[0][0]
self.debug("VM has database id %d" % vm_db_id)

self.dbclient.execute("insert into user_vm_details (vm_id, name, value, display) values (%d,'%s','HOST', 0)" % (vm_db_id, hidden_detail_name))
self.dbclient.execute("insert into vm_instance_details (vm_id, name, value, display) values (%d,'%s','HOST', 0)" % (vm_db_id, hidden_detail_name))

vm = self.listVmById(self.virtual_machine.id)
self.debug("VirtualMachine fetched with details: %s of type %s" % (vm.details, type(vm.details)))
Expand Down Expand Up @@ -227,7 +227,7 @@ def test_update_vm_details_admin(self):


def detailInDatabase(self, vm_id, detail_name):
dbresult = self.dbclient.execute("select id from user_vm_details where vm_id=%s and name='%s'" % (vm_id, detail_name))
dbresult = self.dbclient.execute("select id from vm_instance_details where vm_id=%s and name='%s'" % (vm_id, detail_name))
self.debug("Detail %s for VM %s: %s" % (detail_name, vm_id, dbresult))
if validateList(dbresult)[0] == PASS:
return True
Expand Down
2 changes: 1 addition & 1 deletion test/integration/smoke/test_deploy_vgpu_enabled_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def test_3d_gpu_support(self):

qresultset = self.dbclient.execute("select id from vm_instance where uuid = '%s';" % self.virtual_machine.id)
vm_id = qresultset[0]
qresultset = self.dbclient.execute("select name, value from user_vm_details where vm_id = '%d';" % vm_id)
qresultset = self.dbclient.execute("select name, value from vm_instance_details where vm_id = '%d';" % vm_id)
detailKeys = [x[0] for x in qresultset]

self.assertTrue('mks.enable3d' in detailKeys and 'mks.use3dRenderer' in detailKeys and 'svga.autodetect' in detailKeys and 'svga.vramSize' in detailKeys, "VM details do not contain 3D GPU details")
Expand Down
Loading