-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update how template disks are created #1400
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Can we expose
clone
parameter in the summary view? We could name itindependent virtual machine
following naming in the API. - What happens if those rules are violated? Will the backend return an error?
src/sagas/vmChanges.js
Outdated
@@ -200,6 +200,7 @@ function* composeProvisionSourceTemplate ({ vm, basic, disks }) { | |||
|
|||
// did the storage domain change? | |||
if (disk.storageDomainId !== templateDisk.get('storageDomainId')) { | |||
vmRequiresClone = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we unit test this saga? Just the case we are modifying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably but the infrastructure isn't in place to do it. Maybe a followup PR? I would prefer to not spend that time at the moment.
aea1a37
to
d4bd67a
Compare
What would the purpose of that be? It wasn't important to display an auto-calculated value previously. Since there is no way for the user to control that setting my initial thought is that it would be more confusing than helpful.
Yes, the backend |
d4bd67a
to
765b37c
Compare
Great! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've created a couple of VMs optimized for Server, Desktop, template based and also user selected, played with the disks, it works for me as expected. The code changes LGTM.
Regarding Radek's suggestions, I suggest to implement them later, in a followup PR. Let's move this forward! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This
When trying to create a VM via web-ui optimized for "Server" and based on a template with 2 disks (one is preallocated and one is thin), the VM creation failed on backend with the following error: "ERROR [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (EE-ManagedScheduledExecutorService-engineScheduledThreadPool-Thread- Trying to create a VM based on the same template but optimized to "Desktop" was succeeded. Need to debug the backend for understaning why it failed. |
Changes have been made to following how Admin Portal works when creating VMs from a template. How template disks are created depends on (1) the Template and VM's optimized for selection, and (2) if a new storage domain needs to be selected. The VM's "Optimized For" selection drives the default disk type for the template disks. In Admin Portal, selecting **Desktop** resets the "Storage Allocation" selection to **Thin**. Selecting **Server** or **High Performance** resets "Storage Allocation" to **Clone**. If VM's optimized for selection is **Desktop**: - behavior matches when Admin Portal **Storage Allocation** is **Thin** - all of the template disks' disk types are forced to "Thin Provisioned" - the VM create is sent: - `clone=true` if AT LEAST ONE of the disks has a storage domain that differs from the template's disk - `clone=false` as long as all of the template disk's storage domains remain unchanged If VM's optimized for selection is **Server**: - behavior matches when Admin Portal's Storage Allocation** is **Clone** - the template disks use the disk type as defined by the template - the VM create is sent `clone=true` Fixes: oVirt#1371
765b37c
to
3089abd
Compare
I was forcing the disk format to |
When creating a disk from a template, it is not necessary, and sometime wrong, to force a disk's format to 'raw' when changing/cloning to a different storage domain.
I saw the same error message when testing things out with a non-admin user against a 4.4.5.10 engine. Then I tried the same thing with the non-admin user but with patch 114092 applied my master branch dev engine (version 4.4.6.6_master). The patch adding business logic around disk volumeType and volumeFormat pulled from the webadmin code. With the patch applied, the creations from web-ui work as expected. The specific case:
Results from creating from webadmin with an admin user:
Hard detailstemplate info: > curl -k -u"admin@internal:admin" -H"Accept: application/json" -H"Filter:false" \
"https://engine-dev.ovirt:8443/ovirt-engine/api/templates/?follow=disk_attachments.disk&search=name=TemplateServer" \
| jq '.template[] | { name: .name, desc: .description, optimizedFor: .type, disks: [.disk_attachments.disk_attachment[].disk | { alias:.alias, format:.format, sparse:.sparse, sd:.storage_domains.storage_domain[0].id }]|sort_by(.alias) }'
{
"name": "TemplateServer",
"desc": "",
"optimizedFor": "server",
"disks": [
{
"alias": "MSD1_Pre",
"format": "raw",
"sparse": "false",
"sd": "d67501e7-572e-4683-a71e-a11697c98d16"
},
{
"alias": "MSD1_Thin",
"format": "raw",
"sparse": "true",
"sd": "d67501e7-572e-4683-a71e-a11697c98d16"
}
]
}
webadmin created VMs (admin user): > curl -k -u"admin@internal:password" -H"Accept: application/json" -H"Filter:false" \
"https://engine-dev.ovirt:8443/ovirt-engine/api/vms/?follow=disk_attachments.disk,template,original_template&search=name=TS*%20sortby%20name%20asc" \
| jq '.vm[] | { name: .name, desc: .description, optimizedFor: .type, template: .template.name, originalTemplate: .original_template.name, disks: [.disk_attachments.disk_attachment[].disk | { alias:.alias, format:.format, sparse:.sparse, sd:.storage_domains.storage_domain[0].id }]|sort_by(.alias) }'
{
"name": "TS-webadmin-A",
"desc": "no changes",
"optimizedFor": "server",
"template": "Blank",
"originalTemplate": "TemplateServer",
"disks": [
{
"alias": "MSD1_Pre",
"format": "raw",
"sparse": "false",
"sd": "d67501e7-572e-4683-a71e-a11697c98d16"
},
{
"alias": "MSD1_Thin",
"format": "raw",
"sparse": "true",
"sd": "d67501e7-572e-4683-a71e-a11697c98d16"
}
]
}
{
"name": "TS-webadmin-B",
"desc": "optimized for desktop",
"optimizedFor": "desktop",
"template": "TemplateServer",
"originalTemplate": "TemplateServer",
"disks": [
{
"alias": "MSD1_Pre",
"format": "cow",
"sparse": "true",
"sd": "d67501e7-572e-4683-a71e-a11697c98d16"
},
{
"alias": "MSD1_Thin",
"format": "cow",
"sparse": "true",
"sd": "d67501e7-572e-4683-a71e-a11697c98d16"
}
]
}
{
"name": "TS-webadmin-diskSD-1",
"desc": "change disk storage domains",
"optimizedFor": "server",
"template": "Blank",
"originalTemplate": "TemplateServer",
"disks": [
{
"alias": "MSD1_Pre",
"format": "raw",
"sparse": "false",
"sd": "96f05ec8-6bea-4ed2-b59c-965e583e5428"
},
{
"alias": "MSD1_Thin",
"format": "raw",
"sparse": "true",
"sd": "96f05ec8-6bea-4ed2-b59c-965e583e5428"
}
]
}
{
"name": "TS-webadmin-diskSD-2",
"desc": "optimized for desktop, change disk storage domains (required changing storage allocation to clone)",
"optimizedFor": "desktop",
"template": "Blank",
"originalTemplate": "TemplateServer",
"disks": [
{
"alias": "MSD1_Pre",
"format": "cow",
"sparse": "true",
"sd": "96f05ec8-6bea-4ed2-b59c-965e583e5428"
},
{
"alias": "MSD1_Thin",
"format": "cow",
"sparse": "true",
"sd": "96f05ec8-6bea-4ed2-b59c-965e583e5428"
}
]
} web-ui created VMs (admin user):
> curl -k -u"admin@internal:password" -H"Accept: application/json" -H"Filter:false" \
"https://engine-dev.ovirt:8443/ovirt-engine/api/vms/?follow=disk_attachments.disk,template,original_template&search=name=TS-vmportalA*%20sortby%20name%20asc" \
| jq '.vm[] | { name: .name, desc: .description, optimizedFor: .type, template: .template.name, originalTemplate: .original_template.name, disks: [.disk_attachments.disk_attachment[].disk | { alias:.alias, format:.format, sparse:.sparse, sd:.storage_domains.storage_domain[0].id }]|sort_by(.alias) }'
{
"name": "TS-vmportalA-1",
"desc": "no changes",
"optimizedFor": "server",
"template": "Blank",
"originalTemplate": "TemplateServer",
"disks": [
{
"alias": "MSD1_Pre",
"format": "raw",
"sparse": "false",
"sd": "d67501e7-572e-4683-a71e-a11697c98d16"
},
{
"alias": "MSD1_Thin",
"format": "raw",
"sparse": "true",
"sd": "d67501e7-572e-4683-a71e-a11697c98d16"
}
]
}
{
"name": "TS-vmportalA-2",
"desc": "optimized for Desktop",
"optimizedFor": "desktop",
"template": "TemplateServer",
"originalTemplate": "TemplateServer",
"disks": [
{
"alias": "MSD1_Pre",
"format": "cow",
"sparse": "true",
"sd": "d67501e7-572e-4683-a71e-a11697c98d16"
},
{
"alias": "MSD1_Thin",
"format": "cow",
"sparse": "true",
"sd": "d67501e7-572e-4683-a71e-a11697c98d16"
}
]
} web-ui created VMs (non-admin user with permissions defined above):
> curl -k -u"admin@internal:admin" -H"Accept: application/json" -H"Filter:false" \
"https://engine-dev.ovirt:8443/ovirt-engine/api/vms/?follow=disk_attachments.disk,template,original_template&search=name=TS-vmportalU*%20sortby%20name%20asc" \
| jq '.vm[] | { name: .name, desc: .description, optimizedFor: .type, template: .template.name, originalTemplate: .original_template.name, disks: [.disk_attachments.disk_attachment[].disk | { alias:.alias, format:.format, sparse:.sparse, sd:.storage_domains.storage_domain[0].id }]|sort_by(.alias) }'
{
"name": "TS-vmportalU-1",
"desc": "no changes, forced to choose new disk SDs",
"optimizedFor": "server",
"template": "Blank",
"originalTemplate": "TemplateServer",
"disks": [
{
"alias": "MSD1_Pre",
"format": "raw",
"sparse": "false",
"sd": "96f05ec8-6bea-4ed2-b59c-965e583e5428"
},
{
"alias": "MSD1_Thin",
"format": "raw",
"sparse": "true",
"sd": "96f05ec8-6bea-4ed2-b59c-965e583e5428"
}
]
}
{
"name": "TS-vmportalU-2",
"desc": "optimized for Desktop, forced to choose new disk SDs",
"optimizedFor": "desktop",
"template": "Blank",
"originalTemplate": "TemplateServer",
"disks": [
{
"alias": "MSD1_Pre",
"format": "cow",
"sparse": "true",
"sd": "96f05ec8-6bea-4ed2-b59c-965e583e5428"
},
{
"alias": "MSD1_Thin",
"format": "cow",
"sparse": "true",
"sd": "96f05ec8-6bea-4ed2-b59c-965e583e5428"
}
]
} |
NOTE: Without patch 114092, the non-admin user test 2 fails with the error:
|
I verified and can confirm that patch 114092 solves this mentioned issue. I found another issue that when creating a VM optimized to "Server" and based on a template with disk's format set to QCOW2 (for both clone/not clone senarios): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM except 2 found issues:
- will be solved by patch 114092
- A separate issue will be opened for it: Create VM Wizard- disk type of new disks based on a 'server/HP' template should be based on the template's disk format #1416
I prefer to merge this fix since it did fix part of the already known issues.
LGTM |
Changes have been made to following how Admin Portal works when creating VMs from a template. How template disks are created depends on (1) the VM's optimized for selection, and (2) if a new storage domain needs to be selected.
The VM's "Optimized For" selection drives the default disk type for the template disks. In Admin Portal, selecting Desktop resets the "Storage Allocation" selection to Thin. Selecting Server or High Performance resets "Storage Allocation" to Clone.
If VM's optimized for selection is Desktop:
clone=true
if AT LEAST ONE of the disks has a storage domain that differs from the template's diskclone=false
as long as all of the template disk's storage domains remain unchangedIf VM's optimized for selection is Server:
clone=true
Fixes: #1371