You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2016/12/08 11:49:13 UTC

[4/7] git commit: updated refs/heads/master to 11dd9fb

Merge pull request #1805 from sudhansu7/CLOUDSTACK-9637

CLOUDSTACK-9637: Template create from snapshot does not populate vm_t**ISSUE**
============
Template create from snapshot does not populate vm_template_details

**REPRO STEPS**
==================
1. Register a template A and specify property:
Root disk controller: scsi
NIC adapter type: E1000
Keyboard type: us

2. Create a vm instance from template A

3. Take volume snapshot for vm instance

4. Delete VM instance

5. Switch to "Storage->Snapshots", convert snapshot to a template B

6. Observe template B does not inherit property from template A, the table vm_template_details is empty

**SOLUTION**: Retrieve and add source template details to VMTemplateVO.

Before Fix:

```

mysql> select id,name,source_template_id from vm_template where id=202;
+-----+--------+--------------------+
| id  | name   | source_template_id |
+-----+--------+--------------------+
| 202 | Debian |               NULL |
+-----+--------+--------------------+
1 row in set (0.00 sec)

mysql> select * from vm_template_details where template_id=202;
+----+-------------+--------------------+-------+---------+
| id | template_id | name               | value | display |
+----+-------------+--------------------+-------+---------+
|  1 |         202 | keyboard           | us    |       1 |
|  2 |         202 | nicAdapter         | E1000 |       1 |
|  3 |         202 | rootDiskController | scsi  |       1 |
+----+-------------+--------------------+-------+---------+
3 rows in set (0.00 sec)

mysql> select id,name,source_template_id from vm_template where source_template_id=202;
+-----+----------------+--------------------+
| id  | name           | source_template_id |
+-----+----------------+--------------------+
| 203 | derived-debian |                202 |
+-----+----------------+--------------------+
1 row in set (0.00 sec)

mysql> select * from vm_template_details where template_id=203;
Empty set (0.00 sec)

After Fix:

mysql> select id,name,source_template_id from vm_template where source_template_id=202;
+-----+--------------------------+--------------------+
| id  | name                     | source_template_id |
+-----+--------------------------+--------------------+
| 203 | derived-debian           |                202 |
| 204 | debian-derived-after-fix |                202 |
+-----+--------------------------+--------------------+
2 rows in set (0.00 sec)

mysql> select * from vm_template_details where template_id=204;
+----+-------------+--------------------+-------+---------+
| id | template_id | name               | value | display |
+----+-------------+--------------------+-------+---------+
|  4 |         204 | keyboard           | us    |       1 |
|  5 |         204 | nicAdapter         | E1000 |       1 |
|  6 |         204 | rootDiskController | scsi  |       1 |
+----+-------------+--------------------+-------+---------+
3 rows in set (0.00 sec)

```

**Marvin Test :** test_template_from_snapshot_with_template_details.py

**Result:**
```
test_01_create_template_snampshot (integration.component.test_template_from_snapshot_with_template_details.TestCreateTemplate) ... === TestName: test_01_create_template_snampshot | Status : SUCCESS ===
ok

----------------------------------------------------------------------
Ran 1 test in 864.523s

OK
```

* pr/1805:
  CLOUDSTACK-9637: Template create from snapshot does not populate vm_template_details

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f70428a2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f70428a2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f70428a2

Branch: refs/heads/master
Commit: f70428a2321277adc58adbb553d96e19b9ca0727
Parents: de7a06e 545a214
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Thu Dec 8 17:14:52 2016 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Thu Dec 8 17:14:52 2016 +0530

----------------------------------------------------------------------
 .../com/cloud/template/TemplateManagerImpl.java |  10 +-
 ...template_from_snapshot_with_template_details | 386 +++++++++++++++++++
 2 files changed, 395 insertions(+), 1 deletion(-)
----------------------------------------------------------------------