Re: [ClusterLabs] Q: VirtualDomain RA

2021-03-02 Thread Roger Zhou



On 3/1/21 7:17 PM, Ulrich Windl wrote:

Hi!

I have a question about the VirtualDomain RA (as in SLES15 SP2):
Why does the RA "undefine", then "create" a domain instead of just "start"ing a 
domain?
I mean: Assuming that an "installation" does "define" the domains, why bother with configuration 
files and "create" when a simple "start" would do also?



It makes sense to clean up the certain situation to avoid the "create" failure. 
Example:


1. given foobar.xml doesn't provide UUID
2. `virsh define foobar.xml`
3. `virsh create foobar.xml` <-- error: Failed to create domain from foobar.xml

Cheers,
Roger



Specifically this code:
verify_undefined() {
 local tmpf
 if virsh --connect=${OCF_RESKEY_hypervisor} list --all --name 2>/dev/null | grep 
-wqs "$DOMAIN_NAME"
 then
 tmpf=$(mktemp -t vmcfgsave.XX)
 if [ ! -r "$tmpf" ]; then
 ocf_log warn "unable to create temp file, disk full?"
 # we must undefine the domain
 virsh $VIRSH_OPTIONS undefine $DOMAIN_NAME > /dev/null 
2>&1
 else
 cp -p $OCF_RESKEY_config $tmpf
 virsh $VIRSH_OPTIONS undefine $DOMAIN_NAME > /dev/null 
2>&1
 [ -f $OCF_RESKEY_config ] || cp -f $tmpf 
$OCF_RESKEY_config
 rm -f $tmpf
 fi
 fi
}

Regards,
Ulrich


___
Manage your subscription:
https://lists.clusterlabs.org/mailman/listinfo/users

ClusterLabs home: https://www.clusterlabs.org/



___
Manage your subscription:
https://lists.clusterlabs.org/mailman/listinfo/users

ClusterLabs home: https://www.clusterlabs.org/


[ClusterLabs] Q: VirtualDomain RA

2021-03-01 Thread Ulrich Windl
Hi!

I have a question about the VirtualDomain RA (as in SLES15 SP2):
Why does the RA "undefine", then "create" a domain instead of just "start"ing a 
domain?
I mean: Assuming that an "installation" does "define" the domains, why bother 
with configuration files and "create" when a simple "start" would do also?

Specifically this code:
verify_undefined() {
local tmpf
if virsh --connect=${OCF_RESKEY_hypervisor} list --all --name 
2>/dev/null | grep -wqs "$DOMAIN_NAME"
then
tmpf=$(mktemp -t vmcfgsave.XX)
if [ ! -r "$tmpf" ]; then
ocf_log warn "unable to create temp file, disk full?"
# we must undefine the domain
virsh $VIRSH_OPTIONS undefine $DOMAIN_NAME > /dev/null 
2>&1
else
cp -p $OCF_RESKEY_config $tmpf
virsh $VIRSH_OPTIONS undefine $DOMAIN_NAME > /dev/null 
2>&1
[ -f $OCF_RESKEY_config ] || cp -f $tmpf 
$OCF_RESKEY_config
rm -f $tmpf
fi
fi
}

Regards,
Ulrich


___
Manage your subscription:
https://lists.clusterlabs.org/mailman/listinfo/users

ClusterLabs home: https://www.clusterlabs.org/